Search in sources :

Example 6 with AnalysisType

use of ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalyzerServiceImpl.AnalysisType in project Gemma by PavlidisLab.

the class DifferentialExpressionAnalysisController method determineAnalysisType.

/**
 * Ajax method. Pick the analysis type when we want it to be completely automated.
 *
 * @param id id
 * @return analysis info
 */
public DifferentialExpressionAnalyzerInfo determineAnalysisType(Long id) {
    ExpressionExperiment ee = expressionExperimentService.load(id);
    if (ee == null) {
        throw new IllegalArgumentException("Cannot access experiment with id=" + id);
    }
    ee = expressionExperimentService.thawLite(ee);
    Collection<ExperimentalFactor> factorsWithoutBatch = ExperimentalDesignUtils.factorsWithoutBatch(ee.getExperimentalDesign().getExperimentalFactors());
    AnalysisType analyzer = this.analysisSelectionAndExecutionService.determineAnalysis(ee, factorsWithoutBatch, null, true);
    DifferentialExpressionAnalyzerInfo result = new DifferentialExpressionAnalyzerInfo();
    // we include all factors here, so that batch can be used for subsetting (up to client)
    for (ExperimentalFactor factor : ee.getExperimentalDesign().getExperimentalFactors()) {
        result.getFactors().add(new ExperimentalFactorValueObject(factor));
    }
    if (analyzer == null) {
        /*
             * Either there are no viable automatic choices, or there are no usable factors...
             */
        if (factorsWithoutBatch.size() < 2) {
            throw new IllegalStateException("This data set does not seem suitable for analysis.");
        }
        result.setType(AnalysisType.GENERICLM.toString());
    } else {
        result.setType(analyzer.toString());
    }
    return result;
}
Also used : AnalysisType(ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalyzerServiceImpl.AnalysisType) ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) ExperimentalFactorValueObject(ubic.gemma.model.expression.experiment.ExperimentalFactorValueObject) ExpressionExperiment(ubic.gemma.model.expression.experiment.ExpressionExperiment)

Aggregations

AnalysisType (ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalyzerServiceImpl.AnalysisType)6 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)5 Test (org.junit.Test)4 DifferentialExpressionAnalysis (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)4 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)3 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)1 ExpressionAnalysisResultSet (ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)1 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)1 ExperimentalFactorValueObject (ubic.gemma.model.expression.experiment.ExperimentalFactorValueObject)1 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)1 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)1