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;
}
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);
}
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);
}
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);
}
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"));
}
}
Aggregations