use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject in project Gemma by PavlidisLab.
the class GeneDifferentialExpressionServiceImpl method getDifferentialExpression.
@Override
public Collection<DifferentialExpressionValueObject> getDifferentialExpression(Gene gene, double threshold, Collection<DiffExpressionSelectedFactorCommand> factorMap) {
StopWatch timer = new StopWatch();
timer.start();
Collection<DifferentialExpressionValueObject> result = new ArrayList<>();
if (gene == null)
return result;
Map<ExpressionExperimentValueObject, List<DifferentialExpressionValueObject>> rawDiffEx = differentialExpressionResultService.find(gene, threshold, null);
// Collection<DifferentialExpressionValueObject> rawProcResults = postProcessDiffExResults( gene, threshold,
// rawDiffEx );
Map<Long, DiffExpressionSelectedFactorCommand> eeId2FactorCommand = new HashMap<>();
for (DiffExpressionSelectedFactorCommand dsfc : factorMap) {
eeId2FactorCommand.put(dsfc.getEeId(), dsfc);
}
for (ExpressionExperimentValueObject ee : rawDiffEx.keySet()) {
for (DifferentialExpressionValueObject raw : rawDiffEx.get(ee)) {
if (eeId2FactorCommand.containsKey(raw.getExpressionExperiment().getId())) {
DiffExpressionSelectedFactorCommand factorCommandForEE = eeId2FactorCommand.get(raw.getExpressionExperiment().getId());
assert !raw.getExperimentalFactors().isEmpty();
// interaction term?
if (raw.getExperimentalFactors().size() > 1) {
continue;
}
ExperimentalFactorValueObject efvo = raw.getExperimentalFactors().iterator().next();
if (factorCommandForEE.getEfId().equals(efvo.getId())) {
result.add(raw);
}
}
}
}
timer.stop();
if (timer.getTime() > 1000) {
GeneDifferentialExpressionServiceImpl.log.info("Diff ex results: " + timer.getTime() + " ms");
}
return result;
}
use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject in project Gemma by PavlidisLab.
the class GeneDifferentialExpressionServiceImpl method getDifferentialExpression.
@Override
public Collection<DifferentialExpressionValueObject> getDifferentialExpression(Gene gene, Collection<BioAssaySet> ees) {
StopWatch timer = new StopWatch();
timer.start();
Collection<DifferentialExpressionValueObject> devos = new ArrayList<>();
if (gene == null)
return devos;
Map<ExpressionExperimentValueObject, List<DifferentialExpressionValueObject>> results = differentialExpressionResultService.find(gene, EntityUtils.getIds(ees));
timer.stop();
if (timer.getTime() > 1000) {
GeneDifferentialExpressionServiceImpl.log.info("Diff ex results: " + timer.getTime() + " ms");
}
return this.postProcessDiffExResults(results);
}
use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject in project Gemma by PavlidisLab.
the class GeneDifferentialExpressionServiceImpl method getDifferentialExpression.
@Override
public Collection<DifferentialExpressionValueObject> getDifferentialExpression(Gene gene, Collection<BioAssaySet> ees, double threshold, Integer limit) {
StopWatch timer = new StopWatch();
timer.start();
Collection<DifferentialExpressionValueObject> devos = new ArrayList<>();
if (gene == null)
return devos;
Map<ExpressionExperimentValueObject, List<DifferentialExpressionValueObject>> results = differentialExpressionResultService.find(gene, EntityUtils.getIds(ees), threshold, limit);
timer.stop();
if (timer.getTime() > 1000) {
GeneDifferentialExpressionServiceImpl.log.info("Diff ex results: " + timer.getTime() + " ms");
}
return this.postProcessDiffExResults(results);
}
use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject in project Gemma by PavlidisLab.
the class DifferentialExpressionProbeResultEndpoint method buildXMLResponse.
private void buildXMLResponse(Document document, Element responseElement, String gene, String ee, Collection<DifferentialExpressionValueObject> parCol) {
if (parCol != null) {
for (DifferentialExpressionValueObject par : parCol) {
// gene id output
Element e1 = document.createElement("gene_id");
e1.appendChild(document.createTextNode(gene));
responseElement.appendChild(e1);
// ee id output
Element e2 = document.createElement("ee_id");
e2.appendChild(document.createTextNode(ee));
responseElement.appendChild(e2);
Element e3 = document.createElement("probe");
e3.appendChild(document.createTextNode(par.getProbe()));
responseElement.appendChild(e3);
Element e4 = document.createElement("q_value");
e4.appendChild(document.createTextNode(par.getCorrP().toString()));
responseElement.appendChild(e4);
}
} else {
// gene id output
Element e1 = document.createElement("gene_id");
e1.appendChild(document.createTextNode(gene));
responseElement.appendChild(e1);
// ee id output
Element e2 = document.createElement("ee_id");
e2.appendChild(document.createTextNode(ee));
responseElement.appendChild(e2);
Element e3 = document.createElement("probe");
e3.appendChild(document.createTextNode("NaN"));
responseElement.appendChild(e3);
Element e4 = document.createElement("q_value");
e4.appendChild(document.createTextNode("NaN"));
responseElement.appendChild(e4);
}
}
Aggregations