Search in sources :

Example 21 with ArrayDesign

use of ubic.gemma.model.expression.arrayDesign.ArrayDesign 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 22 with ArrayDesign

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

the class MeanVarianceServiceTest method testServiceCreateOneColor.

@Test
public final void testServiceCreateOneColor() {
    qt = this.createOrUpdateQt(ScaleType.LOG2);
    qt.setIsNormalized(false);
    quantitationTypeService.update(qt);
    // update ArrayDesign to ONECOLOR
    Collection<ArrayDesign> aas = eeService.getArrayDesignsUsed(ee);
    assertEquals(1, aas.size());
    ArrayDesign des = aas.iterator().next();
    des.setTechnologyType(TechnologyType.ONECOLOR);
    arrayDesignService.update(des);
    // check that ArrayDesign is the right TechnologyType
    aas = eeService.getArrayDesignsUsed(ee);
    assertEquals(1, aas.size());
    des = aas.iterator().next();
    assertEquals(TechnologyType.ONECOLOR, des.getTechnologyType());
    MeanVarianceRelation mvr = meanVarianceService.create(ee, true);
    // convert byte[] to array[]
    // warning: order may have changed
    double[] means = MeanVarianceServiceTest.bac.byteArrayToDoubles(mvr.getMeans());
    double[] variances = MeanVarianceServiceTest.bac.byteArrayToDoubles(mvr.getVariances());
    Arrays.sort(means);
    Arrays.sort(variances);
    // check sizes
    int expectedMeanVarianceLength = 75;
    // NAs removed
    int expectedLowessLength = 75;
    assertEquals(expectedMeanVarianceLength, means.length);
    assertEquals(expectedMeanVarianceLength, variances.length);
    // check results
    int idx = 0;
    assertEquals(-0.3484, means[idx], 0.0001);
    assertEquals(0.001569, variances[idx], 0.0001);
    idx = expectedLowessLength - 1;
    assertEquals(0.05115, means[idx], 0.0001);
    assertEquals(0.12014, variances[idx], 0.0001);
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) MeanVarianceRelation(ubic.gemma.model.expression.bioAssayData.MeanVarianceRelation) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 23 with ArrayDesign

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

the class MeanVarianceServiceTest method testServiceCreateTwoColor.

@Test
public final void testServiceCreateTwoColor() {
    qt = this.createOrUpdateQt(ScaleType.LOG2);
    qt.setIsNormalized(false);
    quantitationTypeService.update(qt);
    // update ArrayDesign to TWOCOLOR
    Collection<ArrayDesign> aas = eeService.getArrayDesignsUsed(ee);
    assertEquals(1, aas.size());
    ArrayDesign des = aas.iterator().next();
    des.setTechnologyType(TechnologyType.TWOCOLOR);
    arrayDesignService.update(des);
    aclTestUtils.checkHasAcl(des);
    // check that ArrayDesign is the right TechnologyType
    aas = eeService.getArrayDesignsUsed(ee);
    assertEquals(1, aas.size());
    des = aas.iterator().next();
    assertEquals(TechnologyType.TWOCOLOR, des.getTechnologyType());
    MeanVarianceRelation mvr = meanVarianceService.create(ee, true);
    aclTestUtils.checkEEAcls(ee);
    ee = eeService.thaw(ee);
    assertEquals(97, ee.getProcessedExpressionDataVectors().size());
    // convert byte[] to array[]
    // warning: order may have changed
    double[] means = MeanVarianceServiceTest.bac.byteArrayToDoubles(mvr.getMeans());
    double[] variances = MeanVarianceServiceTest.bac.byteArrayToDoubles(mvr.getVariances());
    Arrays.sort(means);
    Arrays.sort(variances);
    // after filtering
    int expectedLength = 75;
    assertEquals(expectedLength, means.length);
    assertEquals(expectedLength, variances.length);
    int idx = 0;
    assertEquals(-0.34836, means[idx], 0.0001);
    assertEquals(0.001569, variances[idx], 0.0001);
    idx = expectedLength - 1;
    assertEquals(0.05115, means[idx], 0.0001);
    assertEquals(0.12014, variances[idx], 0.0001);
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) MeanVarianceRelation(ubic.gemma.model.expression.bioAssayData.MeanVarianceRelation) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Example 24 with ArrayDesign

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

the class VectorMergingServiceTest method tearDown.

@Before
@After
public void tearDown() {
    try {
        ee = eeService.findByShortName("GSE3443");
        if (ee != null) {
            mergedAA = eeService.getArrayDesignsUsed(ee).iterator().next();
            eeService.remove(ee);
            if (mergedAA != null) {
                mergedAA.setMergees(new HashSet<ArrayDesign>());
                arrayDesignService.update(mergedAA);
                mergedAA = arrayDesignService.thawLite(mergedAA);
                for (ArrayDesign arrayDesign : mergedAA.getMergees()) {
                    arrayDesign.setMergedInto(null);
                    arrayDesignService.update(arrayDesign);
                }
                arrayDesignService.remove(mergedAA);
                for (ArrayDesign arrayDesign : mergedAA.getMergees()) {
                    arrayDesignService.remove(arrayDesign);
                }
            }
        }
    } catch (Exception e) {
        // oh well. Test might fail, it might not.
        log.info(e.getMessage(), e);
    }
}
Also used : ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) Before(org.junit.Before) After(org.junit.After)

Example 25 with ArrayDesign

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

the class ArrayDesignSequenceProcessorTest method testFetchAndLoadWithIdentifiers.

@Test
public void testFetchAndLoadWithIdentifiers() throws Exception {
    String fastacmdExe = Settings.getString(SimpleFastaCmd.FASTA_CMD_ENV_VAR);
    if (fastacmdExe == null) {
        log.warn("No fastacmd executable is configured, skipping test");
        return;
    }
    File fi = new File(fastacmdExe);
    if (!fi.canRead()) {
        log.warn(fastacmdExe + " not found, skipping test");
        return;
    }
    GeoService geoService = this.getBean(GeoService.class);
    geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath()));
    @SuppressWarnings("unchecked") final Collection<ArrayDesign> ads = (Collection<ArrayDesign>) geoService.fetchAndLoad("GPL226", true, true, false, true, true);
    result = ads.iterator().next();
    result = arrayDesignService.thaw(result);
    // have to specify taxon as this has two taxons in it
    try (InputStream f = this.getClass().getResourceAsStream("/data/loader/expression/arrayDesign/identifierTest.txt")) {
        Collection<BioSequence> res = app.processArrayDesign(result, f, new String[] { "testblastdb", "testblastdbPartTwo" }, FileTools.resourceToPath("/data/loader/genome/blast"), taxon, true);
        assertNotNull(res);
        for (BioSequence sequence : res) {
            assertNotNull(sequence.getSequence());
        }
        for (CompositeSequence cs : result.getCompositeSequences()) {
            assert cs.getBiologicalCharacteristic() != null;
        }
    }
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) InputStream(java.io.InputStream) GeoService(ubic.gemma.core.loader.expression.geo.service.GeoService) Collection(java.util.Collection) File(java.io.File) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) GeoDomainObjectGeneratorLocal(ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

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