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