Search in sources :

Example 26 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class SVDServiceImplTest method testsvdGapped.

/*
     * See bug 2139; two different sets of bioassays in the data.
     */
@Test
public void testsvdGapped() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse482short")));
    // also used in the GeoDatasetServiceIntegrationTest.
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE482", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        if (e.getData() instanceof List) {
            ee = (ExpressionExperiment) ((List<?>) e.getData()).iterator().next();
        } else {
            ee = (ExpressionExperiment) e.getData();
        }
    }
    assertNotNull(ee);
    ee = eeService.thaw(ee);
    processedExpressionDataVectorService.createProcessedDataVectors(ee);
    ee = eeService.findByShortName("GSE482");
    assertNotNull(ee);
    SVDValueObject svd = svdService.svd(ee.getId());
    assertNotNull(svd);
    assertNotNull(svd.getvMatrix());
    assertEquals(10, svd.getBioMaterialIds().length);
}
Also used : List(java.util.List) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 27 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class DataUpdaterTest method testLoadRNASeqData.

/*
     * More realistic test of RNA seq. GSE19166
     *

     */
@Test
public void testLoadRNASeqData() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
    ExpressionExperiment ee;
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE19166", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
    }
    ee = experimentService.thaw(ee);
    // Load the data from a text file.
    DoubleMatrixReader reader = new DoubleMatrixReader();
    try (InputStream countData = this.getClass().getResourceAsStream("/data/loader/expression/flatfileload/GSE19166_expression_count.test.txt");
        InputStream rpkmData = this.getClass().getResourceAsStream("/data/loader/expression/flatfileload/GSE19166_expression_RPKM.test.txt")) {
        DoubleMatrix<String, String> countMatrix = reader.read(countData);
        DoubleMatrix<String, String> rpkmMatrix = reader.read(rpkmData);
        List<String> probeNames = countMatrix.getRowNames();
        assertEquals(199, probeNames.size());
        // we have to find the right generic platform to use.
        targetArrayDesign = this.getTestPersistentArrayDesign(probeNames, taxonService.findByCommonName("human"));
        targetArrayDesign = arrayDesignService.thaw(targetArrayDesign);
        assertEquals(199, targetArrayDesign.getCompositeSequences().size());
        // Main step.
        dataUpdater.addCountData(ee, targetArrayDesign, countMatrix, rpkmMatrix, 36, true, false);
    }
    ee = experimentService.thaw(ee);
    // should have: log2cpm, counts, rpkm, and counts-masked ('preferred')
    assertEquals(4, ee.getQuantitationTypes().size());
    for (BioAssay ba : ee.getBioAssays()) {
        assertEquals(targetArrayDesign, ba.getArrayDesignUsed());
    }
    assertNotNull(ee.getNumberOfDataVectors());
    assertEquals(199, ee.getNumberOfDataVectors().intValue());
    // GSM475204 GSM475205 GSM475206 GSM475207 GSM475208 GSM475209
    // 3949585 3929008 3712314 3693219 3574068 3579631
    ExpressionDataDoubleMatrix mat = dataMatrixService.getProcessedExpressionDataMatrix(ee);
    assertEquals(199, mat.rows());
    TestUtils.assertBAs(ee, targetArrayDesign, "GSM475204", 3949585);
    assertEquals(3 * 199, ee.getRawExpressionDataVectors().size());
    assertEquals(199, ee.getProcessedExpressionDataVectors().size());
    Collection<DoubleVectorValueObject> processedDataArrays = dataVectorService.getProcessedDataArrays(ee);
    assertEquals(199, processedDataArrays.size());
    for (DoubleVectorValueObject v : processedDataArrays) {
        assertEquals(6, v.getBioAssays().size());
    }
    assertTrue(!dataVectorService.getProcessedDataVectors(experimentService.load(ee.getId())).isEmpty());
}
Also used : InputStream(java.io.InputStream) ExpressionDataDoubleMatrix(ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) DoubleMatrixReader(ubic.basecode.io.reader.DoubleMatrixReader) GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) DoubleVectorValueObject(ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 28 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testFetchAndLoadGSE1133.

/*
     * Has multiple species (mouse and human, one and two platforms respectively), also test publication entry.
     */
@Test
public void testFetchAndLoadGSE1133() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("gse1133Short")));
    Collection<?> results;
    try {
        results = geoService.fetchAndLoad("GSE1133", false, true, false);
    } catch (AlreadyExistsInSystemException e) {
        log.warn("Test skipped because GSE1133 was not removed from the system prior to test");
        return;
    }
    assertEquals(2, results.size());
    for (Object o : results) {
        ExpressionExperiment e = (ExpressionExperiment) o;
        e = eeService.thawLite(e);
        aclTestUtils.checkEEAcls(e);
        assertNotNull(e.getPrimaryPublication());
        assertEquals("6062-7", e.getPrimaryPublication().getPages());
        try {
            eeService.remove(e);
        } catch (Exception ex) {
            log.info("Failed to remove EE after test");
        }
    }
}
Also used : AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 29 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testLoadGSE30521ExonArray.

@Test
public void testLoadGSE30521ExonArray() throws Exception {
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
        Collection<?> results = geoService.fetchAndLoad("GSE30521", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        log.info("Test skipped because GSE30521 was already loaded - clean the DB before running the test");
        return;
    }
    ee = this.eeService.thawLite(ee);
    /*
         * Should load okay, but should not load the data.
         */
    try {
        processedExpressionDataVectorService.computeProcessedExpressionData(ee);
        fail("Should not have any data vectors for exon arrays on first loading");
    } catch (Exception e) {
    // OK
    }
}
Also used : AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 30 with AlreadyExistsInSystemException

use of ubic.gemma.core.loader.util.AlreadyExistsInSystemException in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testFetchAndLoadGSE37646RNASEQ.

@Test
public void testFetchAndLoadGSE37646RNASEQ() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE37646", false, true, false);
        ee = (ExpressionExperiment) results.iterator().next();
        aclTestUtils.checkEEAcls(ee);
    } catch (AlreadyExistsInSystemException e) {
        log.warn("Test skipped because GSE1133 was not removed from the system prior to test");
    }
}
Also used : AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Aggregations

AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)41 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)33 Test (org.junit.Test)29 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)29 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)27 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)10 Collection (java.util.Collection)9 HashSet (java.util.HashSet)8 Before (org.junit.Before)8 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)8 InputStream (java.io.InputStream)7 List (java.util.List)7 GeoDomainObjectGenerator (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator)6 ProcessedExpressionDataVector (ubic.gemma.model.expression.bioAssayData.ProcessedExpressionDataVector)6 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)5 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)5 DoubleVectorValueObject (ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)5 DoubleMatrixReader (ubic.basecode.io.reader.DoubleMatrixReader)4 File (java.io.File)3 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)3