Search in sources :

Example 1 with FileRepositoryCollection

use of org.molgenis.data.file.support.FileRepositoryCollection in project molgenis by molgenis.

the class OntologyImportServiceIT method testDoImportOwl.

private void testDoImportOwl() {
    String fileName = "ontology-small.owl.zip";
    File file = getFile("/owl/" + fileName);
    FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file);
    ImportService importService = importServiceFactory.getImportService(file, repoCollection);
    EntityImportReport importReport = importService.doImport(repoCollection, ADD, PACKAGE_DEFAULT);
    validateImportReport(importReport, ImmutableMap.of("sys_ont_OntologyTermDynamicAnnotation", 4, "sys_ont_OntologyTermSynonym", 9, "sys_ont_OntologyTermNodePath", 10, "sys_ont_Ontology", 1, "sys_ont_OntologyTerm", 9), emptySet());
    // Verify the import as system as we need write permissions on sys tables to carry out the verification
    runAsSystem(this::verifyOwlAsSystem);
}
Also used : ImportService(org.molgenis.data.importer.ImportService) FileRepositoryCollection(org.molgenis.data.file.support.FileRepositoryCollection) File(java.io.File) EntityImportReport(org.molgenis.data.importer.EntityImportReport)

Example 2 with FileRepositoryCollection

use of org.molgenis.data.file.support.FileRepositoryCollection in project molgenis by molgenis.

the class VcfImportServiceIT method testDoImportVcfWithoutSamples.

private void testDoImportVcfWithoutSamples() {
    String entityTypeId = "variantsWithoutSamples";
    String fileName = entityTypeId + ".vcf";
    File file = getFile("/vcf/" + fileName);
    FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file);
    ImportService importService = importServiceFactory.getImportService(file, repoCollection);
    EntityImportReport importReport = importService.doImport(repoCollection, ADD, PACKAGE_DEFAULT);
    validateImportReport(importReport, ImmutableMap.of(entityTypeId, 10), ImmutableSet.of(entityTypeId));
    assertVariants(entityTypeId, false);
}
Also used : ImportService(org.molgenis.data.importer.ImportService) FileRepositoryCollection(org.molgenis.data.file.support.FileRepositoryCollection) File(java.io.File) EntityImportReport(org.molgenis.data.importer.EntityImportReport)

Example 3 with FileRepositoryCollection

use of org.molgenis.data.file.support.FileRepositoryCollection in project molgenis by molgenis.

the class VcfImportServiceIT method testDoImportVcfGzWithSamples.

private void testDoImportVcfGzWithSamples() {
    String entityTypeId = "variantsWithSamplesGz";
    String fileName = entityTypeId + ".vcf.gz";
    File file = getFile("/vcf/" + fileName);
    FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file);
    ImportService importService = importServiceFactory.getImportService(file, repoCollection);
    EntityImportReport importReport = importService.doImport(repoCollection, ADD, PACKAGE_DEFAULT);
    validateImportReport(importReport, ImmutableMap.of("variantsWithSamplesGz", 10, "variantsWithSamplesGzSample", 10), ImmutableSet.of("variantsWithSamplesGz", "variantsWithSamplesGzSample"));
    assertVariants(entityTypeId, true);
}
Also used : ImportService(org.molgenis.data.importer.ImportService) FileRepositoryCollection(org.molgenis.data.file.support.FileRepositoryCollection) File(java.io.File) EntityImportReport(org.molgenis.data.importer.EntityImportReport)

Example 4 with FileRepositoryCollection

use of org.molgenis.data.file.support.FileRepositoryCollection in project molgenis by molgenis.

the class VcfImportServiceIT method testDoImportVcfWithSamples.

private void testDoImportVcfWithSamples() {
    String entityTypeId = "variantsWithSamples";
    String fileName = entityTypeId + ".vcf";
    File file = getFile("/vcf/" + fileName);
    FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file);
    ImportService importService = importServiceFactory.getImportService(file, repoCollection);
    EntityImportReport importReport = importService.doImport(repoCollection, ADD, PACKAGE_DEFAULT);
    validateImportReport(importReport, ImmutableMap.of(entityTypeId, 10, entityTypeId + "Sample", 10), ImmutableSet.of(entityTypeId, entityTypeId + "Sample"));
    assertVariants(entityTypeId, true);
}
Also used : ImportService(org.molgenis.data.importer.ImportService) FileRepositoryCollection(org.molgenis.data.file.support.FileRepositoryCollection) File(java.io.File) EntityImportReport(org.molgenis.data.importer.EntityImportReport)

Example 5 with FileRepositoryCollection

use of org.molgenis.data.file.support.FileRepositoryCollection in project molgenis by molgenis.

the class EmxImportServiceIT method testDoImportEmxCsvZip.

private void testDoImportEmxCsvZip() {
    String fileName = "emx-csv.zip";
    File file = getFile("/csv/" + fileName);
    FileRepositoryCollection repoCollection = fileRepositoryCollectionFactory.createFileRepositoryCollection(file);
    ImportService importService = importServiceFactory.getImportService(file, repoCollection);
    EntityImportReport importReport = importService.doImport(repoCollection, ADD, PACKAGE_DEFAULT);
    validateImportReport(importReport, ImmutableMap.of(CSV_HOSPITAL, 3, CSV_PATIENTS, 3), ImmutableSet.of(CSV_HOSPITAL, CSV_PATIENTS));
    verifyFirstAndLastRows(CSV_HOSPITAL, hospitalFirstRow, hospitalLastRow);
    verifyFirstAndLastRows(CSV_PATIENTS, patientsFirstRow, patientsLastRow);
}
Also used : ImportService(org.molgenis.data.importer.ImportService) FileRepositoryCollection(org.molgenis.data.file.support.FileRepositoryCollection) File(java.io.File) EntityImportReport(org.molgenis.data.importer.EntityImportReport)

Aggregations

FileRepositoryCollection (org.molgenis.data.file.support.FileRepositoryCollection)11 EntityImportReport (org.molgenis.data.importer.EntityImportReport)10 ImportService (org.molgenis.data.importer.ImportService)10 File (java.io.File)9 IOException (java.io.IOException)1 MolgenisDataException (org.molgenis.data.MolgenisDataException)1 FileMeta (org.molgenis.data.file.model.FileMeta)1 FileIngestJobExecution (org.molgenis.file.ingest.meta.FileIngestJobExecution)1