Search in sources :

Example 1 with CoexpressionAnalysis

use of ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis in project Gemma by PavlidisLab.

the class LinkAnalysisPersisterImpl method saveLinksToDb.

@Override
public void saveLinksToDb(LinkAnalysis la) {
    if (!la.getConfig().isUseDb()) {
        throw new IllegalArgumentException("Analysis is not configured to use the db to persist");
    }
    this.deleteAnalyses(la.getExpressionExperiment());
    // the analysis object will get updated.
    CoexpressionAnalysis analysisObj = la.getAnalysisObj();
    analysisObj.setCoexpCorrelationDistribution(la.getCorrelationDistribution());
    analysisObj = (CoexpressionAnalysis) persisterHelper.persist(analysisObj);
    /*
         * At this point we have the populated analysis object, but no links.
         */
    la.setAnalysisObj(analysisObj);
    StopWatch watch = new StopWatch();
    watch.start();
    ObjectArrayList links = la.getKeep();
    int numSaved = this.saveLinks(la, links);
    LinkAnalysisPersisterImpl.log.info("Seconds to process " + numSaved + " links (plus flipped versions):" + watch.getTime() / 1000.0);
    watch.stop();
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis) ObjectArrayList(cern.colt.list.ObjectArrayList) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 2 with CoexpressionAnalysis

use of ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis in project Gemma by PavlidisLab.

the class LinkAnalysisPersisterImpl method deleteAnalyses.

@Override
public boolean deleteAnalyses(BioAssaySet ee) {
    Collection<CoexpressionAnalysis> oldAnalyses = coexpressionAnalysisService.findByInvestigation(ee);
    if (oldAnalyses.isEmpty())
        return false;
    LinkAnalysisPersisterImpl.log.info("Deleting old coexpression analysis, link data and 'genes tested-in' for " + ee);
    for (CoexpressionAnalysis old : oldAnalyses) {
        coexpressionAnalysisService.remove(old);
    }
    return true;
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis)

Example 3 with CoexpressionAnalysis

use of ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis in project Gemma by PavlidisLab.

the class CoexpressionAnalysisServiceImpl method getExperimentsWithAnalysis.

@Override
@Transactional(readOnly = true)
public Collection<Long> getExperimentsWithAnalysis(Taxon taxon) {
    Collection<Long> haveCoexpressionAnalysis = new HashSet<>();
    Collection<CoexpressionAnalysis> analyses = this.findByTaxon(taxon);
    for (CoexpressionAnalysis a : analyses) {
        haveCoexpressionAnalysis.add(a.getExperimentAnalyzed().getId());
    }
    return haveCoexpressionAnalysis;
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis) HashSet(java.util.HashSet) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with CoexpressionAnalysis

use of ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis in project Gemma by PavlidisLab.

the class CoexpressionAnalysisServiceImpl method addCoexpCorrelationDistribution.

@Override
@Transactional
public void addCoexpCorrelationDistribution(ExpressionExperiment expressionExperiment, CoexpCorrelationDistribution coexpd) {
    Collection<CoexpressionAnalysis> analyses = this.findByInvestigation(expressionExperiment);
    if (analyses.size() > 1) {
        throw new IllegalStateException("Multiple coexpression analyses for one experiment");
    } else if (analyses.isEmpty()) {
        throw new IllegalStateException("No coexpression analysis");
    }
    CoexpressionAnalysis analysis = analyses.iterator().next();
    analysis.setCoexpCorrelationDistribution(coexpd);
    this.update(analysis);
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with CoexpressionAnalysis

use of ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis in project Gemma by PavlidisLab.

the class LinkAnalysisServiceImpl method addAnalysisObj.

private void addAnalysisObj(ExpressionExperiment ee, FilterConfig filterConfig, LinkAnalysisConfig linkAnalysisConfig, LinkAnalysis la) {
    /*
         * Set up basics.
         */
    CoexpressionAnalysis analysis = linkAnalysisConfig.toAnalysis();
    analysis.setExperimentAnalyzed(ee);
    analysis.setName(ee.getShortName() + " link analysis");
    analysis.getProtocol().setDescription(analysis.getProtocol().getDescription() + "# FilterConfig:\n" + filterConfig.toString());
    la.setAnalysisObj(analysis);
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis)

Aggregations

CoexpressionAnalysis (ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis)11 Transactional (org.springframework.transaction.annotation.Transactional)2 DifferentialExpressionAnalysis (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)2 Protocol (ubic.gemma.model.common.protocol.Protocol)2 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)2 ObjectArrayList (cern.colt.list.ObjectArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 StopWatch (org.apache.commons.lang3.time.StopWatch)1 Test (org.junit.Test)1 Link (ubic.basecode.dataStructure.Link)1 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)1 Investigation (ubic.gemma.model.analysis.Investigation)1 RawExpressionDataVector (ubic.gemma.model.expression.bioAssayData.RawExpressionDataVector)1 BioAssaySet (ubic.gemma.model.expression.experiment.BioAssaySet)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1 Gene (ubic.gemma.model.genome.Gene)1 LinkCreator (ubic.gemma.persistence.service.association.coexpression.LinkCreator)1 NonPersistentNonOrderedCoexpLink (ubic.gemma.persistence.service.association.coexpression.NonPersistentNonOrderedCoexpLink)1