Search in sources :

Example 41 with ArrayDesign

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

the class GeoConverterTest method testWithImages.

/*
     * Has image clones.
     */
@Test
public final void testWithImages() throws Exception {
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.setProcessPlatformsOnly(true);
    try (InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL890_family.soft.gz"))) {
        parser.parse(is);
    }
    GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL890");
    Object result = this.gc.convert(platform);
    ArrayDesign ad = (ArrayDesign) result;
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        BioSequence bs = cs.getBiologicalCharacteristic();
        if (bs != null && bs.getSequence() != null) {
            return;
        }
    }
    fail("No sequences!");
}
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 42 with ArrayDesign

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

the class GeoConverterTest method testMultipleTaxaIdentifiedBYAbbreviationsOnArrayWithOrganismColumn.

/*
     * Method to test that an array design can have multiple taxa stored against it and that if abbreviations used as
     * probe names mapped to the scientific names correctly if the abbreviation is stored in DB.
     */
@Test
public void testMultipleTaxaIdentifiedBYAbbreviationsOnArrayWithOrganismColumn() throws Exception {
    Taxon rainbowTroat = taxonService.findByAbbreviation("omyk");
    Taxon whiteFish = taxonService.findByAbbreviation("cclu");
    Taxon rainbowSmelt = taxonService.findByAbbreviation("omor");
    Taxon atlanticSalm = taxonService.findByAbbreviation("ssal");
    assertNotNull(atlanticSalm);
    // prototype bean.
    gc = this.getBean(GeoConverter.class);
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL2899_family.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    // parse only the plaform
    parser.setProcessPlatformsOnly(true);
    parser.parse(is);
    GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL2899");
    Object result = gc.convert(platform);
    ArrayDesign ad = (ArrayDesign) result;
    assertNotNull(ad);
    Set<Taxon> taxa = new HashSet<>();
    BioSequence bs;
    for (CompositeSequence cs : ad.getCompositeSequences()) {
        bs = cs.getBiologicalCharacteristic();
        if (bs != null) {
            assertNotNull(bs.getTaxon());
            taxa.add(bs.getTaxon());
        }
    }
    assertEquals(4, taxa.size());
    // original file has five taxa, test file just kept four.
    assertTrue(taxa.contains(atlanticSalm));
    assertTrue(taxa.contains(rainbowTroat));
    assertTrue(taxa.contains(whiteFish));
    assertTrue(taxa.contains(rainbowSmelt));
}
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 43 with ArrayDesign

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

the class GeoConverterTest method testConvertGSE4229IMAGE.

/*
     * See bug 3328 - we don't want to use IMAGE clone IDs
     */
@Test
public void testConvertGSE4229IMAGE() throws Exception {
    InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/gse4229Short/GSE4229.soft.gz"));
    GeoFamilyParser parser = new GeoFamilyParser();
    parser.parse(is);
    GeoSeries series = ((GeoParseResult) parser.getResults().iterator().next()).getSeriesMap().get("GSE4229");
    DatasetCombiner datasetCombiner = new DatasetCombiner();
    GeoSampleCorrespondence correspondence = datasetCombiner.findGSECorrespondence(series);
    series.setSampleCorrespondence(correspondence);
    Object result = this.gc.convert(series);
    assertNotNull(result);
    @SuppressWarnings("unchecked") Collection<ExpressionExperiment> ees = (Collection<ExpressionExperiment>) result;
    ExpressionExperiment ee = ees.iterator().next();
    ArrayDesign platform = ee.getBioAssays().iterator().next().getArrayDesignUsed();
    BioSequence seq = platform.getCompositeSequences().iterator().next().getBiologicalCharacteristic();
    assertNotNull(seq.getSequenceDatabaseEntry());
    String acc = seq.getSequenceDatabaseEntry().getAccession();
    assertEquals("Genbank", seq.getSequenceDatabaseEntry().getExternalDatabase().getName());
    assertTrue(!acc.startsWith("IMAGE"));
}
Also used : 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) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment) GZIPInputStream(java.util.zip.GZIPInputStream) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 44 with ArrayDesign

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

the class RNASeqDataAddCli method locateArrayDesign.

private ArrayDesign locateArrayDesign(String name) {
    ArrayDesign arrayDesign = null;
    ArrayDesignService arrayDesignService = this.getBean(ArrayDesignService.class);
    Collection<ArrayDesign> byname = arrayDesignService.findByName(name.trim().toUpperCase());
    if (byname.size() > 1) {
        throw new IllegalArgumentException("Ambiguous name: " + name);
    } else if (byname.size() == 1) {
        arrayDesign = byname.iterator().next();
    }
    if (arrayDesign == null) {
        arrayDesign = arrayDesignService.findByShortName(name);
    }
    if (arrayDesign == null) {
        AbstractCLI.log.error("No arrayDesign " + name + " found");
        this.bail(ErrorCode.INVALID_OPTION);
    }
    return arrayDesign;
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) ArrayDesignService(ubic.gemma.persistence.service.expression.arrayDesign.ArrayDesignService)

Example 45 with ArrayDesign

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

the class TwoChannelMissingValueCLI method processForMissingValues.

private void processForMissingValues(ExpressionExperiment ee) {
    Collection<ArrayDesign> arrayDesignsUsed = eeService.getArrayDesignsUsed(ee);
    boolean wasProcessed = false;
    for (ArrayDesign design : arrayDesignsUsed) {
        TechnologyType tt = design.getTechnologyType();
        if (tt == TechnologyType.TWOCOLOR || tt == TechnologyType.DUALMODE) {
            AbstractCLI.log.info(ee + " uses a two-color array design, processing...");
            if (arrayDesignsUsed.size() == 1) {
                // save the slower query.
                wasProcessed = this.processExperiment(ee);
            } else {
                wasProcessed = this.processExperiment(ee);
            }
        }
    }
    if (!wasProcessed) {
        errorObjects.add(ee.getShortName());
    } else {
        successObjects.add(ee.toString());
    }
}
Also used : TechnologyType(ubic.gemma.model.expression.arrayDesign.TechnologyType) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign)

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