use of ubic.gemma.core.tasks.analysis.diffex.DifferentialExpressionAnalysisTaskCommand in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisController method run.
/**
* AJAX entry point when running completely automatically.
*
* @param id id
* @return string
*/
public String run(Long id) {
ExpressionExperiment ee = expressionExperimentService.load(id);
if (ee == null) {
throw new IllegalArgumentException("Cannot access experiment with id=" + id);
}
this.experimentReportService.evictFromCache(ee.getId());
ee = expressionExperimentService.thawLite(ee);
DifferentialExpressionAnalysisTaskCommand cmd = new DifferentialExpressionAnalysisTaskCommand(ee);
boolean rnaSeq = expressionExperimentService.isRNASeq(ee);
cmd.setUseWeights(rnaSeq);
cmd.setFactors(ExperimentalDesignUtils.factorsWithoutBatch(ee.getExperimentalDesign().getExperimentalFactors()));
// if possible, might get dropped.
cmd.setIncludeInteractions(true);
return taskRunningService.submitRemoteTask(cmd);
}
use of ubic.gemma.core.tasks.analysis.diffex.DifferentialExpressionAnalysisTaskCommand in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisController method refreshStats.
public String refreshStats(Long eeId, Long id) {
ExpressionExperiment ee = expressionExperimentService.load(eeId);
if (ee == null) {
throw new IllegalArgumentException("Cannot access experiment with id=" + eeId);
}
DifferentialExpressionAnalysis toRefresh = differentialExpressionAnalysisService.load(id);
if (toRefresh == null) {
throw new IllegalArgumentException("Cannot access analysis with id=" + id);
}
this.experimentReportService.evictFromCache(ee.getId());
DifferentialExpressionAnalysisTaskCommand cmd = new DifferentialExpressionAnalysisTaskCommand(ee, toRefresh);
return taskRunningService.submitLocalTask(cmd);
}
use of ubic.gemma.core.tasks.analysis.diffex.DifferentialExpressionAnalysisTaskCommand in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisController method redo.
/**
* AJAX entry point to redo an analysis.
*
* @param eeId ee id
* @param id id
* @return string
* @throws Exception exception
*/
public String redo(Long eeId, Long id) {
ExpressionExperiment ee = expressionExperimentService.load(eeId);
if (ee == null) {
throw new IllegalArgumentException("Cannot access experiment with id=" + eeId);
}
DifferentialExpressionAnalysis toRedo = differentialExpressionAnalysisService.load(id);
if (toRedo == null) {
throw new IllegalArgumentException("Cannot access analysis with id=" + id);
}
this.experimentReportService.evictFromCache(ee.getId());
DifferentialExpressionAnalysisTaskCommand cmd = new DifferentialExpressionAnalysisTaskCommand(ee, toRedo);
return taskRunningService.submitRemoteTask(cmd);
}
use of ubic.gemma.core.tasks.analysis.diffex.DifferentialExpressionAnalysisTaskCommand in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalysisController method runCustom.
public String runCustom(Long id, Collection<Long> factorids, boolean includeInteractions, Long subsetFactorId) {
if (factorids.isEmpty()) {
throw new IllegalArgumentException("You must provide at least one factor to analyze");
}
ExpressionExperiment ee = expressionExperimentService.load(id);
if (ee == null) {
throw new IllegalArgumentException("Cannot access experiment with id=" + id);
}
ee = expressionExperimentService.thawLite(ee);
/*
* Get the factors matching the factorids
*/
Collection<ExperimentalFactor> factors = new HashSet<>();
for (ExperimentalFactor ef : ee.getExperimentalDesign().getExperimentalFactors()) {
if (factorids.contains(ef.getId())) {
factors.add(ef);
}
}
if (factors.size() != factorids.size()) {
throw new IllegalArgumentException("Unknown factors?");
}
ExperimentalFactor subsetFactor = null;
if (subsetFactorId != null) {
for (ExperimentalFactor ef : ee.getExperimentalDesign().getExperimentalFactors()) {
if (subsetFactorId.equals(ef.getId())) {
subsetFactor = ef;
break;
}
}
if (subsetFactor == null) {
throw new IllegalArgumentException("Unknown subset factor?");
}
if (factors.contains(subsetFactor)) {
throw new IllegalArgumentException("Subset factor must not be one of the factors used in the analysis");
}
}
DifferentialExpressionAnalysisTaskCommand cmd = new DifferentialExpressionAnalysisTaskCommand(ee);
boolean rnaSeq = expressionExperimentService.isRNASeq(ee);
cmd.setUseWeights(rnaSeq);
cmd.setFactors(factors);
cmd.setSubsetFactor(subsetFactor);
for (ExperimentalFactor ef : factors) {
if (BatchInfoPopulationServiceImpl.isBatchFactor(ef)) {
/*
* This is a policy and I am pretty sure it makes sense!
*/
DifferentialExpressionAnalysisController.log.warn("Removing interaction term because it includes 'batch'");
includeInteractions = false;
}
}
cmd.setIncludeInteractions(includeInteractions);
DifferentialExpressionAnalysisController.log.info("Initializing analysis");
this.experimentReportService.evictFromCache(ee.getId());
return taskRunningService.submitRemoteTask(cmd);
}
Aggregations