Search in sources :

Example 6 with GeoPlatform

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

the class GeoFamilyParserTest method testParseBigBPlatformOnly.

@Test
public void testParseBigBPlatformOnly() throws Exception {
    is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/fullSizeTests/GSE1623_family.soft.txt.gz"));
    parser.setProcessPlatformsOnly(true);
    parser.parse(is);
    Assert.assertEquals(0, ((GeoParseResult) parser.getResults().iterator().next()).getSamples().size());
    Assert.assertEquals(0, ((GeoParseResult) parser.getResults().iterator().next()).getSeries().size());
    Assert.assertEquals(1, ((GeoParseResult) parser.getResults().iterator().next()).getPlatforms().size());
    GeoPlatform p = ((GeoParseResult) parser.getResults().iterator().next()).getPlatforms().values().iterator().next();
    Assert.assertEquals(12488, p.getColumnData("GB_ACC").size());
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GeoPlatform(ubic.gemma.core.loader.expression.geo.model.GeoPlatform) Test(org.junit.Test)

Example 7 with GeoPlatform

use of ubic.gemma.core.loader.expression.geo.model.GeoPlatform 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 8 with GeoPlatform

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

the class GeoConverterTest method testSingleTaxonOnArrayWithNoOrganismColumn.

/*
     * Ensure that if platform has one taxon then taxon is still set correctly
     */
@Test
public void testSingleTaxonOnArrayWithNoOrganismColumn() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL226_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.setProcessPlatformsOnly(true);
    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);
    Set<Taxon> listPossibleTaxonValues = new HashSet<>();
    BioSequence bs;
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        bs = cs.getBiologicalCharacteristic();
        if (bs != null) {
            listPossibleTaxonValues.add(bs.getTaxon());
        }
    }
    assertEquals(1, listPossibleTaxonValues.size());
}
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) Taxon(ubic.gemma.model.genome.Taxon) 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 9 with GeoPlatform

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

the class GeoConverterTest method testIllegalArgumentExceptionMultipleTaxaOnArrayWithNoOrganismColumn.

/*
     * Tests that if platform is defined as having multiple organisms but no column can be found that defines the taxon
     * at the probe level then an Exception is thrown
     */
@Test
public void testIllegalArgumentExceptionMultipleTaxaOnArrayWithNoOrganismColumn() throws Exception {
    try {
        InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL226_family.soft.gz"));
        GeoFamilyParser parser = new GeoFamilyParser();
        // should not be necessary.
        parser.setProcessPlatformsOnly(true);
        parser.parse(is);
        GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL226");
        // add an extra organism to the platform to make a pretend 2 orgnaism array
        platform.addToOrganisms("Rattus norvegicus");
        this.gc.convert(platform);
        // thrown an error
        fail();
    } catch (IllegalArgumentException e) {
    // assertEquals(
    // "2 taxon found on platform: Mus musculus: Rattus norvegicus but there is no probe specific taxon Column
    // found for platform GPL226",
    // e.getMessage() );
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) GZIPInputStream(java.util.zip.GZIPInputStream) InputStream(java.io.InputStream) GeoPlatform(ubic.gemma.core.loader.expression.geo.model.GeoPlatform) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Aggregations

GZIPInputStream (java.util.zip.GZIPInputStream)9 Test (org.junit.Test)9 GeoPlatform (ubic.gemma.core.loader.expression.geo.model.GeoPlatform)9 InputStream (java.io.InputStream)8 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)8 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)6 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)6 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)6 Taxon (ubic.gemma.model.genome.Taxon)3 Transactional (org.springframework.transaction.annotation.Transactional)1 GeoSeries (ubic.gemma.core.loader.expression.geo.model.GeoSeries)1 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)1 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1