Search in sources :

Example 31 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class ArrayDesignMapResultServiceImpl method summarizeMapResults.

@Override
public Collection<CompositeSequenceMapSummary> summarizeMapResults(Collection<CompositeSequence> compositeSequences) {
    Collection<CompositeSequenceMapSummary> result = new HashSet<>();
    int count = 0;
    for (CompositeSequence cs : compositeSequences) {
        CompositeSequenceMapSummary summary = new CompositeSequenceMapSummary(cs);
        BioSequence bioSequence = cs.getBiologicalCharacteristic();
        if (bioSequence == null) {
            result.add(summary);
            continue;
        }
        Collection<BlatResult> blats = blatResultService.findByBioSequence(bioSequence);
        summary.setBlatResults(blats);
        Collection<BlatAssociation> maps = blatAssociationService.find(bioSequence);
        blatAssociationService.thaw(maps);
        for (BlatAssociation association : maps) {
            summary.getGeneProducts().add(association.getGeneProduct());
            summary.getGenes().add(association.getGeneProduct().getGene());
        }
        result.add(summary);
        if (++count % 1000 == 0) {
            ArrayDesignMapResultServiceImpl.log.info("Processed " + count + " elements...");
        }
    }
    ArrayDesignMapResultServiceImpl.log.info("Done, processed " + count + " elements");
    return result;
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) BlatAssociation(ubic.gemma.model.genome.sequenceAnalysis.BlatAssociation) BlatResult(ubic.gemma.model.genome.sequenceAnalysis.BlatResult)

Example 32 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class GeoDatasetServiceTest method testMatrixValue.

private void testMatrixValue(ExpressionExperiment exp, ExpressionDataMatrix<Double> matrix, String probeToTest, String sampleToTest, double expectedValue) {
    CompositeSequence soughtDesignElement = null;
    BioAssay soughtBioAssay = null;
    Collection<RawExpressionDataVector> vectors = exp.getRawExpressionDataVectors();
    for (DesignElementDataVector vector : vectors) {
        CompositeSequence de = vector.getDesignElement();
        if (de.getName().equals(probeToTest)) {
            soughtDesignElement = de;
        }
        BioAssayDimension bad = vector.getBioAssayDimension();
        for (BioAssay ba : bad.getBioAssays()) {
            if (ba.getAccession().getAccession().equals(sampleToTest)) {
                soughtBioAssay = ba;
            }
        }
    }
    if (soughtDesignElement == null || soughtBioAssay == null)
        fail("didn't find values for " + sampleToTest);
    Double actualValue = matrix.get(soughtDesignElement, soughtBioAssay);
    assertNotNull("No value for " + soughtBioAssay, actualValue);
    assertEquals(expectedValue, actualValue, 0.00001);
}
Also used : BioAssayDimension(ubic.gemma.model.expression.bioAssayData.BioAssayDimension) RawExpressionDataVector(ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector) DesignElementDataVector(ubic.gemma.model.expression.bioAssayData.DesignElementDataVector) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay)

Example 33 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class LowVarianceDataTest method checkResults.

public void checkResults(DifferentialExpressionAnalysis analysis) {
    Collection<ExpressionAnalysisResultSet> resultSets = analysis.getResultSets();
    assertEquals(2, resultSets.size());
    boolean found1 = false;
    for (ExpressionAnalysisResultSet rs : resultSets) {
        Collection<DifferentialExpressionAnalysisResult> results = rs.getResults();
        for (DifferentialExpressionAnalysisResult r : results) {
            CompositeSequence probe = r.getProbe();
            switch(probe.getName()) {
                case "1552338_at":
                    fail("Should not have found a result for constant probe: 1552338_at");
                    break;
                case "1552337_s_at":
                    fail("Should not have found a result for constant probe: 1552337_s_at");
                    break;
                case "1552391_at":
                    fail("Should not have found a result for constant probe: 1552391_at");
                    break;
                default:
                    found1 = true;
                    break;
            }
        }
    }
    assertTrue(found1);
}
Also used : DifferentialExpressionAnalysisResult(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisResult) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) ExpressionAnalysisResultSet(ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)

Example 34 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.

the class TwoWayAnovaWithInteractionTest2 method checkResults.

public void checkResults(DifferentialExpressionAnalysis analysis) {
    Collection<ExpressionAnalysisResultSet> resultSets = analysis.getResultSets();
    assertEquals(3, resultSets.size());
    boolean found1 = false, found2 = false, found3 = false, found4 = false;
    for (ExpressionAnalysisResultSet rs : resultSets) {
        boolean interaction = false;
        boolean sexFactor = false;
        Collection<DifferentialExpressionAnalysisResult> results = rs.getResults();
        if (rs.getExperimentalFactors().size() == 1) {
            ExperimentalFactor factor = rs.getExperimentalFactors().iterator().next();
            sexFactor = factor.getName().equals("Sex");
        } else {
            interaction = true;
        }
        assertEquals(8, results.size());
        /*
             * Test values here are computed in R, using anova(lm(unlist(expData["205969_at",])~Treatment*Sex )) etc.
             */
        for (DifferentialExpressionAnalysisResult r : results) {
            CompositeSequence probe = r.getProbe();
            Double pvalue = r.getPvalue();
            switch(probe.getName()) {
                case "205969_at":
                    if (sexFactor) {
                        found1 = true;
                        assertEquals(0.3333, pvalue, 0.001);
                    } else if (interaction) {
                        found2 = true;
                        assertEquals(0.8480, pvalue, 0.001);
                    } else {
                        found3 = true;
                        assertEquals(0.1323, pvalue, 0.001);
                    }
                    break;
                case "217757_at":
                    if (interaction) {
                        found4 = true;
                        assertEquals(0.7621, pvalue, 0.001);
                    }
                    break;
                case "constant":
                    fail("Should not have found a result for constant probe");
                    break;
            }
        }
    }
    assertTrue(found1 && found2 && found3 && found4);
}
Also used : ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) DifferentialExpressionAnalysisResult(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisResult) CompositeSequence(ubic.gemma.model.expression.designElement.CompositeSequence) ExpressionAnalysisResultSet(ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)

Example 35 with CompositeSequence

use of ubic.gemma.model.expression.designElement.CompositeSequence 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)

Aggregations

CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)206 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)43 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)40 Gene (ubic.gemma.model.genome.Gene)32 Test (org.junit.Test)30 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)19 ExpressionDataDoubleMatrix (ubic.gemma.core.datastructure.matrix.ExpressionDataDoubleMatrix)18 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)18 DesignElementDataVector (ubic.gemma.model.expression.bioAssayData.DesignElementDataVector)18 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)18 StopWatch (org.apache.commons.lang3.time.StopWatch)17 HashSet (java.util.HashSet)15 BioAssayDimension (ubic.gemma.model.expression.bioAssayData.BioAssayDimension)15 CompositeSequenceValueObject (ubic.gemma.model.expression.designElement.CompositeSequenceValueObject)15 ArrayList (java.util.ArrayList)14 QuantitationType (ubic.gemma.model.common.quantitationtype.QuantitationType)14 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)13 Taxon (ubic.gemma.model.genome.Taxon)12 Collection (java.util.Collection)11 ByteArrayConverter (ubic.basecode.io.ByteArrayConverter)11