Search in sources :

Example 1 with GeoDomainObjectGenerator

use of ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator in project Gemma by PavlidisLab.

the class DataUpdaterTest method testLoadRNASeqDataWithMissingSamples.

/*
     * Test case where some samples cannot be used.
     *
     */
@Test
public void testLoadRNASeqDataWithMissingSamples() throws Exception {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
    ExpressionExperiment ee = experimentService.findByShortName("GSE29006");
    if (ee != null) {
        experimentService.remove(ee);
    }
    assertTrue(experimentService.findByShortName("GSE29006") == null);
    try {
        Collection<?> results = geoService.fetchAndLoad("GSE29006", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        throw new IllegalStateException("Need to remove this data set before test is run");
    }
    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/GSE29006_expression_count.test.txt");
        InputStream rpkmData = this.getClass().getResourceAsStream("/data/loader/expression/flatfileload/GSE29006_expression_RPKM.test.txt")) {
        DoubleMatrix<String, String> countMatrix = reader.read(countData);
        DoubleMatrix<String, String> rpkmMatrix = reader.read(rpkmData);
        List<String> probeNames = countMatrix.getRowNames();
        // we have to find the right generic platform to use.
        targetArrayDesign = this.getTestPersistentArrayDesign(probeNames, taxonService.findByCommonName("human"));
        targetArrayDesign = arrayDesignService.thaw(targetArrayDesign);
        try {
            dataUpdater.addCountData(ee, targetArrayDesign, countMatrix, rpkmMatrix, 36, true, false);
            fail("Should have gotten an exception");
        } catch (IllegalArgumentException e) {
        // Expected
        }
        dataUpdater.addCountData(ee, targetArrayDesign, countMatrix, rpkmMatrix, 36, true, true);
    }
    /*
         * Check
         */
    ee = experimentService.thaw(ee);
    for (BioAssay ba : ee.getBioAssays()) {
        assertEquals(targetArrayDesign, ba.getArrayDesignUsed());
    }
    ExpressionDataDoubleMatrix mat = dataMatrixService.getProcessedExpressionDataMatrix(ee);
    assertEquals(199, mat.rows());
    assertTrue(mat.getQuantitationTypes().iterator().next().getName().startsWith("log2cpm"));
    assertEquals(4, ee.getBioAssays().size());
    assertEquals(199 * 3, ee.getRawExpressionDataVectors().size());
    assertEquals(199, ee.getProcessedExpressionDataVectors().size());
    Collection<DoubleVectorValueObject> processedDataArrays = dataVectorService.getProcessedDataArrays(ee);
    assertEquals(199, processedDataArrays.size());
    TestUtils.assertBAs(ee, targetArrayDesign, "GSM718709", 320383);
    for (DoubleVectorValueObject v : processedDataArrays) {
        assertEquals(4, v.getBioAssays().size());
    }
}
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 2 with GeoDomainObjectGenerator

use of ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator in project Gemma by PavlidisLab.

the class ExpressionExperimentPlatformSwitchTest method test.

/**
 * for bug 3451
 */
@Test
public void test() {
    // GSE36025
    // 
    // GPL9250
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
    Collection<?> results = geoService.fetchAndLoad("GSE36025", false, false, false);
    ExpressionExperiment ee = (ExpressionExperiment) results.iterator().next();
    results = geoService.fetchAndLoad("GPL13112", true, false, false);
    ArrayDesign arrayDesign = (ArrayDesign) results.iterator().next();
    arrayDesign = arrayDesignService.thaw(arrayDesign);
    ee = experimentPlatformSwitchService.switchExperimentToArrayDesign(ee, arrayDesign);
    assertNotNull(ee);
    Collection<ArrayDesign> arrayDesignsUsed = experimentService.getArrayDesignsUsed(ee);
    assertEquals(1, arrayDesignsUsed.size());
    assertEquals(arrayDesign, arrayDesignsUsed.iterator().next());
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 3 with GeoDomainObjectGenerator

use of ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method fetchASeries.

@SuppressWarnings("unused")
// !! Please leave this here, we use it to load data sets for chopping.
void fetchASeries(String accession) {
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
    geoService.fetchAndLoad(accession, false, false, false);
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator)

Example 4 with GeoDomainObjectGenerator

use of ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator in project Gemma by PavlidisLab.

the class ExonArrayDataAddIntegrationTest method testAddAffyExonRat.

@Test
public void testAddAffyExonRat() {
    if (!hasApt) {
        log.warn("Test skipped due to lack of Affy Power Tools executable");
        return;
    }
    // GSE33597
    ExpressionExperiment ee;
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
        Collection<?> results = geoService.fetchAndLoad("GSE33597", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
    }
    dataUpdater.addAffyExonArrayData(ee);
    experimentService.load(ee.getId());
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 5 with GeoDomainObjectGenerator

use of ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator in project Gemma by PavlidisLab.

the class ExonArrayDataAddIntegrationTest method testAddAffyExonHuman.

@Test
public void testAddAffyExonHuman() {
    if (!hasApt) {
        log.warn("Test skipped due to lack of Affy Power Tools executable");
        return;
    }
    // GSE22498
    ExpressionExperiment ee;
    try {
        geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGenerator());
        Collection<?> results = geoService.fetchAndLoad("GSE22498", false, false, false);
        ee = (ExpressionExperiment) results.iterator().next();
    } catch (AlreadyExistsInSystemException e) {
        ee = (ExpressionExperiment) ((List<?>) e.getData()).get(0);
    }
    dataUpdater.addAffyExonArrayData(ee);
    experimentService.load(ee.getId());
}
Also used : GeoDomainObjectGenerator(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator) AlreadyExistsInSystemException(ubic.gemma.core.loader.util.AlreadyExistsInSystemException) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Aggregations

GeoDomainObjectGenerator (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGenerator)12 Test (org.junit.Test)7 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)7 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)7 AlreadyExistsInSystemException (ubic.gemma.core.loader.util.AlreadyExistsInSystemException)6 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)6 InputStream (java.io.InputStream)5 DoubleMatrixReader (ubic.basecode.io.reader.DoubleMatrixReader)4 DoubleVectorValueObject (ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)3 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)2 GeoConverter (ubic.gemma.core.loader.expression.geo.GeoConverter)2 GeoService (ubic.gemma.core.loader.expression.geo.service.GeoService)2 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)2 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStreamReader (java.io.InputStreamReader)1 Collection (java.util.Collection)1 Before (org.junit.Before)1 PreprocessingException (ubic.gemma.core.analysis.preprocess.PreprocessingException)1