Search in sources :

Example 11 with DifferentialExpressionValueObject

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;
}
Also used : DoubleArrayList(cern.colt.list.DoubleArrayList) DifferentialExpressionValueObject(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject) DoubleArrayList(cern.colt.list.DoubleArrayList) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 12 with DifferentialExpressionValueObject

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);
}
Also used : DoubleArrayList(cern.colt.list.DoubleArrayList) DifferentialExpressionValueObject(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject) DoubleArrayList(cern.colt.list.DoubleArrayList) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 13 with DifferentialExpressionValueObject

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);
}
Also used : DoubleArrayList(cern.colt.list.DoubleArrayList) DifferentialExpressionValueObject(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject) DoubleArrayList(cern.colt.list.DoubleArrayList) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 14 with DifferentialExpressionValueObject

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);
    }
}
Also used : Element(org.w3c.dom.Element) DifferentialExpressionValueObject(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject)

Aggregations

DifferentialExpressionValueObject (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionValueObject)14 StopWatch (org.apache.commons.lang3.time.StopWatch)8 DoubleArrayList (cern.colt.list.DoubleArrayList)6 Element (org.w3c.dom.Element)2 DoubleVectorValueObject (ubic.gemma.model.expression.bioAssayData.DoubleVectorValueObject)2 BioAssaySet (ubic.gemma.model.expression.experiment.BioAssaySet)2 Gene (ubic.gemma.model.genome.Gene)2 GeneValueObject (ubic.gemma.model.genome.gene.GeneValueObject)2 DiffExpressionSelectedFactorCommand (ubic.gemma.core.analysis.expression.diff.DiffExpressionSelectedFactorCommand)1 ExpressionExperimentSet (ubic.gemma.model.analysis.expression.ExpressionExperimentSet)1 ExpressionAnalysisResultSet (ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)1 BioAssayValueObject (ubic.gemma.model.expression.bioAssay.BioAssayValueObject)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1 ExpressionExperimentValueObject (ubic.gemma.model.expression.experiment.ExpressionExperimentValueObject)1 Taxon (ubic.gemma.model.genome.Taxon)1 ExpressionExperimentExperimentalFactorValueObject (ubic.gemma.web.controller.expression.experiment.ExpressionExperimentExperimentalFactorValueObject)1 VisualizationValueObject (ubic.gemma.web.controller.visualization.VisualizationValueObject)1