Search in sources :

Example 31 with DifferentialExpressionAnalysis

use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.

the class AnalysisUtilServiceImpl method deleteOldAnalyses.

@Override
public boolean deleteOldAnalyses(ExpressionExperiment expExp) {
    boolean removedAll = true;
    AnalysisUtilServiceImpl.log.info("Removing old analyses for " + expExp);
    if (principalComponentAnalysisService.loadForExperiment(expExp) != null) {
        try {
            principalComponentAnalysisService.removeForExperiment(expExp);
        } catch (Exception e) {
            AnalysisUtilServiceImpl.log.warn("Could not remove pca for: " + expExp);
            removedAll = false;
        }
    }
    for (DifferentialExpressionAnalysis diff : differentialExpressionAnalysisService.findByInvestigation(expExp)) {
        try {
            differentialExpressionAnalysisService.remove(diff);
        } catch (Exception e) {
            AnalysisUtilServiceImpl.log.warn("Could not remove analysis: " + diff + ": " + e.getMessage());
            removedAll = false;
        }
    }
    for (CoexpressionAnalysis coex : coexpressionAnalysisService.findByInvestigation(expExp)) {
        try {
            coexpressionAnalysisService.remove(coex);
        } catch (Exception e) {
            AnalysisUtilServiceImpl.log.warn("Could not remove analysis: " + coex + ": " + e.getMessage());
            removedAll = false;
        }
    }
    return removedAll;
}
Also used : CoexpressionAnalysis(ubic.gemma.model.analysis.expression.coexpression.CoexpressionAnalysis) DifferentialExpressionAnalysis(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)

Example 32 with DifferentialExpressionAnalysis

use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.

the class AbstractDifferentialExpressionAnalyzer method initAnalysisEntity.

DifferentialExpressionAnalysis initAnalysisEntity(BioAssaySet bioAssaySet, DifferentialExpressionAnalysisConfig config) {
    if (config == null) {
        config = new DifferentialExpressionAnalysisConfig();
    }
    DifferentialExpressionAnalysis expressionAnalysis = config.toAnalysis();
    expressionAnalysis.setExperimentAnalyzed(bioAssaySet);
    return expressionAnalysis;
}
Also used : DifferentialExpressionAnalysis(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)

Example 33 with DifferentialExpressionAnalysis

use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.

the class ExpressionExperimentSubSetServiceImpl method remove.

/**
 * doesn't include removal of sample coexpression matrices, PCA, probe2probe coexpression links, or adjusting
 * experiment set members
 *
 * @param subset subset
 */
@Override
@Transactional
public void remove(ExpressionExperimentSubSet subset) {
    if (subset == null) {
        throw new IllegalArgumentException("ExperimentSubSet cannot be null");
    }
    // Remove differential expression analyses
    Collection<DifferentialExpressionAnalysis> diffAnalyses = this.differentialExpressionAnalysisDao.findByInvestigation(subset);
    for (DifferentialExpressionAnalysis de : diffAnalyses) {
        Long toDelete = de.getId();
        this.differentialExpressionAnalysisDao.remove(toDelete);
    }
    this.expressionExperimentSubSetDao.remove(subset);
/*
         * FIXME Coexpression involving this data set will linger on ...
         */
}
Also used : DifferentialExpressionAnalysis(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis) Transactional(org.springframework.transaction.annotation.Transactional)

Example 34 with DifferentialExpressionAnalysis

use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.

the class ExperimentalFactorServiceImpl method delete.

@Override
public void delete(ExperimentalFactor experimentalFactor) {
    /*
         * First, check to see if there are any diff results that use this factor.
         */
    Collection<DifferentialExpressionAnalysis> analyses = differentialExpressionAnalysisDao.findByFactor(experimentalFactor);
    for (DifferentialExpressionAnalysis a : analyses) {
        differentialExpressionAnalysisDao.remove(a);
    }
    this.experimentalFactorDao.remove(experimentalFactor);
}
Also used : DifferentialExpressionAnalysis(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)

Example 35 with DifferentialExpressionAnalysis

use of ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis in project Gemma by PavlidisLab.

the class DiffExWithInvalidInteractionTest method test.

/**
 * This should automatically drop the interaction. If it fails on a 'no residual degrees of freedom' it means we're
 * not detecting thatS
 */
@Test
public void test() {
    ee = expressionExperimentService.thawLite(ee);
    Collection<ExperimentalFactor> factors = ee.getExperimentalDesign().getExperimentalFactors();
    // includes batch
    assertEquals(3, factors.size());
    for (BioAssay ba : ee.getBioAssays()) {
        assertEquals(3, ba.getSampleUsed().getFactorValues().size());
    }
    ExperimentalFactor timepoint = null;
    ExperimentalFactor treatment = null;
    for (ExperimentalFactor ef : factors) {
        if (ef.getCategory().getValue().equals("timepoint")) {
            timepoint = ef;
        } else if (ef.getCategory().getValue().equals("treatment")) {
            treatment = ef;
        }
    }
    assertNotNull(treatment);
    assertNotNull(timepoint);
    DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
    config.getFactorsToInclude().add(timepoint);
    config.getFactorsToInclude().add(treatment);
    config.addInteractionToInclude(treatment, timepoint);
    analyzer = this.getBean(AnalysisSelectionAndExecutionService.class);
    Collection<DifferentialExpressionAnalysis> result = analyzer.analyze(ee, config);
    assertEquals(1, result.size());
}
Also used : ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) DifferentialExpressionAnalysis(ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) AbstractGeoServiceTest(ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest) Test(org.junit.Test)

Aggregations

DifferentialExpressionAnalysis (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)53 Test (org.junit.Test)26 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)26 ExpressionAnalysisResultSet (ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)21 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)13 DifferentialExpressionAnalysisResult (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisResult)11 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)8 HashSet (java.util.HashSet)5 ContrastResult (ubic.gemma.model.analysis.expression.diff.ContrastResult)5 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)5 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)5 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)5 AnalysisType (ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalyzerServiceImpl.AnalysisType)4 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 Transactional (org.springframework.transaction.annotation.Transactional)3 DifferentialExpressionAnalysisConfig (ubic.gemma.core.analysis.expression.diff.DifferentialExpressionAnalysisConfig)3 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)3 DoubleMatrixReader (ubic.basecode.io.reader.DoubleMatrixReader)2 GeoDomainObjectGeneratorLocal (ubic.gemma.core.loader.expression.geo.GeoDomainObjectGeneratorLocal)2