Search in sources :

Example 26 with GeoSeries

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

the class GeoConverterTest method testArrayTaxonDifferentToSampleTaxon.

/*
     * GSE2388 is an example of where the array and sample taxon do not match. This test checks that the biomaterial and
     * array taxons are set correctly.
     *
     */
@SuppressWarnings("unchecked")
@Test
@Transactional
public void testArrayTaxonDifferentToSampleTaxon() throws Exception {
    Taxon rainbowTrout = taxonService.findByAbbreviation("omyk");
    assertNotNull(rainbowTrout);
    Taxon atlanticSalm = taxonService.findByAbbreviation("ssal");
    assertNotNull(atlanticSalm);
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE2388_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE2388");
    GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL966");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    // assert that the biomaterials have been set as one taxon
    Object seriesResult = gc.convert(series);
    assertNotNull(seriesResult);
    Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) seriesResult;
    ExpressionExperiment exper = ees.iterator().next();
    Collection<BioAssay> bioassays = exper.getBioAssays();
    BioMaterial material = bioassays.iterator().next().getSampleUsed();
    Taxon taxon = material.getSourceTaxon();
    assertEquals("Oncorhynchus kisutch", taxon.getScientificName());
    // assert that the platform is another taxon
    Object resultPlatForm = gc.convert(platform);
    ArrayDesign ad = (ArrayDesign) resultPlatForm;
    assertNotNull(ad);
    Set<Taxon> taxa = new HashSet<>();
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        BioSequence bs = cs.getBiologicalCharacteristic();
        if (bs != null) {
            assertNotNull(bs.getTaxon());
            log.info(bs.getTaxon());
            taxa.add(bs.getTaxon());
        }
    }
    // can be empty taxon if the probe does not have a sequence which is why taxon size is 3.
    assertEquals(2, taxa.size());
    assertTrue(taxa.contains(rainbowTrout));
    assertTrue(taxa.contains(atlanticSalm));
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Taxon(ubic.gemma.model.genome.Taxon) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) GeoPlatform(ubic.gemma.core.loader.expression.geo.model.GeoPlatform) GZIPInputStream(java.util.zip.GZIPInputStream) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 27 with GeoSeries

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

the class GeoConverterTest method testIllegalArgumentExceptionChannel1Channel2taxonDifferent.

/*
     * GSE4047 is an example of where some of the samples used have channel 1 and channel 2 taxon different. And thus an
     * exception should be thrown
     */
@Test
public void testIllegalArgumentExceptionChannel1Channel2taxonDifferent() throws Exception {
    try {
        InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE4047_family.soft.gz"));
        GeoFamilyParser parser = new GeoFamilyParser();
        parser.parse(is);
        GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE4047");
        DatasetCombiner datasetCombiner = new DatasetCombiner();
        GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
        series.setSampleCorrespondence(correspondence);
        this.gc.convert(series);
        fail();
    } catch (IllegalArgumentException e) {
        assertTrue(e.getMessage().startsWith("Sample has two different organisms; One channel taxon is"));
    // assertEquals(
    // "Channel 1 taxon is Danio rerio Channel 2 taxon is Pomacentrus moluccensis Check that is expected for
    // sample GSM104737",
    // e.getMessage() );
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 28 with GeoSeries

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

the class GeoConverterTest method testConvertGSE29014.

/*
     * Lacks data for some samples (on purpose)
     *
     */
@SuppressWarnings("unchecked")
@Test
public void testConvertGSE29014() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE29014.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE29014");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
    assertEquals(1, ees.size());
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 29 with GeoSeries

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

the class GeoConverterTest method testParseGSE18707.

@Test
public void testParseGSE18707() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GSE18707.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE18707");
    DatasetCombiner datasetCombiner = new DatasetCombiner(false);
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Set<?> result = (Set<?>) this.gc.convert(series);
    ExpressionExperiment e = (ExpressionExperiment) result.iterator().next();
    assertEquals(100, e.getRawExpressionDataVectors().size());
    // this is normal, before any processing.
    assertEquals(1, e.getQuantitationTypes().size());
    QuantitationType qt = e.getQuantitationTypes().iterator().next();
    assertEquals("Processed Affymetrix Rosetta intensity values", qt.getDescription());
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) QuantitationType(ubic.gemma.model.common.quantitationtype.QuantitationType) StandardQuantitationType(ubic.gemma.model.common.quantitationtype.StandardQuantitationType) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 30 with GeoSeries

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

the class GeoConverterTest method testConvertGSE18Stress.

/*
     * This is one of our longer/slower tests.
     *
     */
@Test
public void testConvertGSE18Stress() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GSE18.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS15.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS16.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS17.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS18.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS19.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS20.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS21.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS30.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS31.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS33.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS34.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS35.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS36.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS108.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS111.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS112.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS113.soft.gz"));
    parser.parse(is);
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse18short/GDS115.soft.gz"));
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE18");
    DatasetCombiner datasetCombiner = new DatasetCombiner(false);
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    ExpressionExperiment result = (ExpressionExperiment) ((Set<?>) this.gc.convert(series)).iterator().next();
    assertEquals(156, result.getBioAssays().size());
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoSeries(ubic.gemma.core.loader.expression.geo.model.GeoSeries) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Aggregations

Test (org.junit.Test)38 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)38 GZIPInputStream (java.util.zip.GZIPInputStream)37 InputStream (java.io.InputStream)36 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)33 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)29 Collection (java.util.Collection)6 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)6 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)5 StandardQuantitationType (ubic.gemma.model.common.quantitationtype.StandardQuantitationType)5 HashSet (java.util.HashSet)3 Set (java.util.Set)3 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)3 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)3 GeoDataset (ubic.gemma.core.loader.expression.geo.model.GeoDataset)2 Taxon (ubic.gemma.model.genome.Taxon)2 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)2 Transactional (org.springframework.transaction.annotation.Transactional)1 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)1 ExpressionDataSVD (ubic.gemma.core.analysis.preprocess.svd.ExpressionDataSVD)1