use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.
the class PersistentDummyObjectHelper method addTestAnalyses.
public void addTestAnalyses(ExpressionExperiment ee) {
/*
* Add analyses
*/
CoexpressionAnalysis pca = CoexpressionAnalysis.Factory.newInstance();
pca.setName(RandomStringUtils.randomNumeric(PersistentDummyObjectHelper.RANDOM_STRING_LENGTH));
pca.setExperimentAnalyzed(ee);
persisterHelper.persist(pca);
/*
* Diff
*/
DifferentialExpressionAnalysis expressionAnalysis = DifferentialExpressionAnalysis.Factory.newInstance();
Protocol protocol = Protocol.Factory.newInstance();
protocol.setName("Differential expression analysis settings");
protocol.setDescription("qvalue: " + true);
expressionAnalysis.setProtocol(protocol);
expressionAnalysis.setExperimentAnalyzed(ee);
persisterHelper.persist(expressionAnalysis);
}
use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisTaskImpl method execute.
@Override
public TaskResult execute() {
if (taskCommand instanceof DifferentialExpressionAnalysisRemoveTaskCommand) {
DifferentialExpressionAnalysis toRemove = ((DifferentialExpressionAnalysisRemoveTaskCommand) taskCommand).getToRemove();
if (toRemove == null) {
throw new IllegalArgumentException("Analysis to remove must not be null");
}
log.info("Removing analysis ...");
this.differentialExpressionAnalysisService.remove(toRemove);
return new TaskResult(taskCommand, true);
}
Collection<DifferentialExpressionAnalysis> results = doAnalysis();
Collection<DifferentialExpressionAnalysis> minimalResults = new HashSet<>();
for (DifferentialExpressionAnalysis r : results) {
/* Don't send the full analysis to the space. Instead, create a minimal result. */
DifferentialExpressionAnalysis minimalResult = DifferentialExpressionAnalysis.Factory.newInstance();
minimalResult.setName(r.getName());
minimalResult.setDescription(r.getDescription());
minimalResult.setAuditTrail(r.getAuditTrail());
minimalResults.add(minimalResult);
}
return new TaskResult(taskCommand, minimalResults);
}
use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisTaskImpl method doAnalysis.
private Collection<DifferentialExpressionAnalysis> doAnalysis() {
ExpressionExperiment ee = taskCommand.getExpressionExperiment();
if (taskCommand.getToRedo() != null) {
log.info("Redoing analysis");
ee = expressionExperimentService.thawLite(ee);
return differentialExpressionAnalyzerService.redoAnalysis(ee, taskCommand.getToRedo(), true);
}
ee = expressionExperimentService.thawLite(ee);
Collection<DifferentialExpressionAnalysis> diffAnalyses = differentialExpressionAnalysisService.getAnalyses(ee);
if (!diffAnalyses.isEmpty()) {
log.info("This experiment has some existing analyses; if they overlap with the new analysis they will be deleted after the run.");
}
Collection<DifferentialExpressionAnalysis> results;
Collection<ExperimentalFactor> factors = taskCommand.getFactors();
DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
boolean rnaSeq = expressionExperimentService.isRNASeq(ee);
config.setUseWeights(rnaSeq);
config.setFactorsToInclude(factors);
config.setSubsetFactor(taskCommand.getSubsetFactor());
if (taskCommand.isIncludeInteractions() && factors.size() == 2) {
/*
* We should not include 'batch' in an interaction. But I don't want to enforce that here.
*/
for (ExperimentalFactor ef : factors) {
if (BatchInfoPopulationServiceImpl.isBatchFactor(ef)) {
log.warn("Batch is included in the interaction!");
}
}
// might get dropped.
config.addInteractionToInclude(factors);
}
DifferentialExpressionAnalyzerServiceImpl.AnalysisType analyzer = analysisSelectionAndExecutionService.determineAnalysis(ee, config);
if (analyzer == null) {
throw new IllegalStateException("Data set cannot be analyzed");
}
config.setAnalysisType(analyzer);
results = differentialExpressionAnalyzerService.runDifferentialExpressionAnalyses(ee, config);
return results;
}
Aggregations