Search in sources :

Example 36 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class GeoSuperSeriesLoadTest method tearDown.

@After
public void tearDown() {
    if (ee != null) {
        try {
            this.removeOldData(ee);
        } catch (Exception e) {
            log.warn("Removing expression experiment thew an Exception");
        }
    }
    // this is somewhat overkill...
    for (ExpressionExperiment ee4 : ees.loadAll()) {
        try {
            ees.remove(ee4);
        } catch (Exception e) {
            log.warn("Removing all expression experiments thew an Exception");
        }
    }
    for (ArrayDesign a : adService.loadAll()) {
        try {
            a = adService.thawLite(a);
            for (ArrayDesign b : a.getSubsumedArrayDesigns()) {
                adService.remove(b);
            }
            adService.remove(a);
        } catch (Exception e) {
            log.warn("Removing all array designs thew an Exception");
        }
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) After(org.junit.After)

Example 37 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class ExperimentalDesignImporterTestC method setup.

@Before
public void setup() throws Exception {
    /*
         * Have to add ssal for this platform.
         */
    super.executeSqlScript("/script/sql/add-fish-taxa.sql", false);
    Taxon salmon = taxonService.findByCommonName("atlantic salmon");
    assertNotNull(salmon);
    /*
         * Load the array design (platform).
         */
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("designLoadTests")));
    geoService.fetchAndLoad("GPL2899", true, true, false);
    ArrayDesign ad = arrayDesignService.findByShortName("GPL2899");
    assertNotNull(ad);
    SimpleExpressionExperimentMetaData metaData = new SimpleExpressionExperimentMetaData();
    metaData.setShortName(RandomStringUtils.randomAlphabetic(10));
    metaData.setDescription("bar");
    metaData.setIsRatio(false);
    metaData.setTaxon(salmon);
    metaData.setQuantitationTypeName("value");
    metaData.setScale(ScaleType.LOG2);
    metaData.setType(StandardQuantitationType.AMOUNT);
    metaData.getArrayDesigns().add(ad);
    try (InputStream data = this.getClass().getResourceAsStream("/data/loader/expression/geo/designLoadTests/expressionDataBrain2003TestFile.txt")) {
        ee = simpleExpressionDataLoaderService.create(metaData, data);
    }
// ee = this.eeService.thawLite( ee );
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) InputStream(java.io.InputStream) Taxon(ubic.gemma.model.genome.Taxon) SimpleExpressionExperimentMetaData(ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) Before(org.junit.Before)

Example 38 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class GeoConverterTest method testWithImageNoGenbank.

/*
     * Platform has IMAGE:CCCCC in CLONE_ID column, no genbank accessions anywhere.
     */
@Test
public final void testWithImageNoGenbank() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL222_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.setProcessPlatformsOnly(true);
    parser.parse(is);
    GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL222");
    Object result = this.gc.convert(platform);
    ArrayDesign ad = (ArrayDesign) result;
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        BioSequence bs = cs.getBiologicalCharacteristic();
        assertTrue(bs.getName().startsWith("IMAGE"));
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) GeoPlatform(ubic.gemma.core.loader.expression.geo.model.GeoPlatform) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 39 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class GeoConverterTest method testConvertMultiSeriesPerSample.

/*
     * Case where the same sample can be in multiple series, we had problems with it.
     */
@Test
public void testConvertMultiSeriesPerSample() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE3193Short/GSE3193_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE3193");
    DatasetCombiner datasetCombiner = new DatasetCombiner(false);
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    ExpressionExperiment ee = (ExpressionExperiment) ((Collection<?>) result).iterator().next();
    // assertEquals( 85, ee.getBioAssays().size() );
    Map<ArrayDesign, Integer> ads = new HashMap<>();
    for (BioAssay b : ee.getBioAssays()) {
        if (ads.containsKey(b.getArrayDesignUsed())) {
            ads.put(b.getArrayDesignUsed(), ads.get(b.getArrayDesignUsed()) + 1);
        } else {
            ads.put(b.getArrayDesignUsed(), 1);
        }
    }
    assertEquals(4, ads.size());
    for (ArrayDesign ad : ads.keySet()) {
        Integer count = ads.get(ad);
        switch(ad.getName()) {
            case "SHAC":
                // ok
                assertEquals(8, count.intValue());
                break;
            case "SVJ":
                // ok
                assertEquals(1, count.intValue());
                break;
            case "SVL_SVM_SVN_SVO":
                assertEquals(32, count.intValue());
                break;
            case "SVC":
                assertEquals(44, count.intValue());
                break;
            default:
                fail("Name was " + ad.getName());
                break;
        }
    }
}
Also used : GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GZIPInputStream(java.util.zip.GZIPInputStream) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 40 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign in project Gemma by PavlidisLab.

the class GeoConverterTest method testImageClones.

/*
     * We should not longer use IMAGE:XXXXX as the sequence name.
     */
@Test
public void testImageClones() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL226_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL226");
    Object result = this.gc.convert(platform);
    ArrayDesign ad = (ArrayDesign) result;
    assertNotNull(ad);
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        BioSequence bs = cs.getBiologicalCharacteristic();
        assertTrue("Got: " + bs.getName(), !bs.getName().startsWith("IMAGE") || bs.getSequenceDatabaseEntry() == null);
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) GeoPlatform(ubic.gemma.core.loader.expression.geo.model.GeoPlatform) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Aggregations

ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)186 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)43 Test (org.junit.Test)32 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)26 InputStream (java.io.InputStream)25 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)24 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)24 Taxon (ubic.gemma.model.genome.Taxon)23 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)19 HashSet (java.util.HashSet)16 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)16 Collection (java.util.Collection)14 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)13 StopWatch (org.apache.commons.lang3.time.StopWatch)12 Before (org.junit.Before)12 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)12 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)9 GZIPInputStream (java.util.zip.GZIPInputStream)8 SimpleExpressionExperimentMetaData (ubic.gemma.core.loader.expression.simple.model.SimpleExpressionExperimentMetaData)8 File (java.io.File)7