use of ubic.gemma.model.expression.experiment.ExperimentalFactor in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalyzerServiceTest method testAnalyzeAndDeleteSpecificAnalysisWithSubset.
/**
* Tests running with a subset factor, then deleting.
*/
@Test
public void testAnalyzeAndDeleteSpecificAnalysisWithSubset() {
ExperimentalFactor[] factors = ee.getExperimentalDesign().getExperimentalFactors().toArray(new ExperimentalFactor[] {});
List<ExperimentalFactor> factorsToUse = Collections.singletonList(factors[0]);
ExperimentalFactor subsetFactor = factors[1];
DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
config.setFactorsToInclude(factorsToUse);
config.setSubsetFactor(subsetFactor);
Collection<DifferentialExpressionAnalysis> analyses = differentialExpressionAnalyzerService.runDifferentialExpressionAnalyses(ee, config);
assertTrue(!analyses.isEmpty());
differentialExpressionAnalyzerService.deleteAnalysis(ee, analyses.iterator().next());
}
use of ubic.gemma.model.expression.experiment.ExperimentalFactor in project Gemma by PavlidisLab.
the class DifferentialExpressionAnalyzerServiceTest method testWritePValuesHistogram.
@Test
public void testWritePValuesHistogram() {
DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
Collection<ExperimentalFactor> factors = ee.getExperimentalDesign().getExperimentalFactors();
config.setFactorsToInclude(factors);
Collection<DifferentialExpressionAnalysis> analyses = differentialExpressionAnalyzerService.runDifferentialExpressionAnalyses(ee, config);
for (DifferentialExpressionAnalysis analysis : analyses) {
differentialExpressionAnalysisService.thaw(analysis);
for (ExpressionAnalysisResultSet resultSet : analysis.getResultSets()) {
Histogram hist = resultService.loadPvalueDistribution(resultSet.getId());
assertNotNull(hist);
}
}
}
use of ubic.gemma.model.expression.experiment.ExperimentalFactor in project Gemma by PavlidisLab.
the class SubsettedAnalysis2Test method test.
@Test
public void test() {
ee = expressionExperimentService.thawLite(ee);
Collection<ExperimentalFactor> factors = ee.getExperimentalDesign().getExperimentalFactors();
// includes batch
assertEquals(4, factors.size());
for (BioAssay ba : ee.getBioAssays()) {
assertEquals(4, ba.getSampleUsed().getFactorValues().size());
}
ExperimentalFactor strainOrLine = null;
ExperimentalFactor genotype = null;
ExperimentalFactor phenotype = null;
for (ExperimentalFactor ef : factors) {
switch(ef.getCategory().getValue()) {
case "genotype":
genotype = ef;
break;
case "strain":
strainOrLine = ef;
break;
case "phenotype":
phenotype = ef;
break;
}
}
assertNotNull(strainOrLine);
assertNotNull(phenotype);
assertNotNull(genotype);
DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
config.getFactorsToInclude().add(genotype);
config.getFactorsToInclude().add(phenotype);
config.setSubsetFactor(strainOrLine);
analyzer = this.getBean(DiffExAnalyzer.class);
Collection<DifferentialExpressionAnalysis> result = analyzer.run(ee, config);
// two subsets
assertEquals(2, result.size());
}
use of ubic.gemma.model.expression.experiment.ExperimentalFactor in project Gemma by PavlidisLab.
the class TwoWayAnovaWithInteractionsTest2 method test.
@Test
public void test() {
ee = expressionExperimentService.thawLite(ee);
Collection<ExperimentalFactor> factors = ee.getExperimentalDesign().getExperimentalFactors();
assertEquals(2, factors.size());
for (BioAssay ba : ee.getBioAssays()) {
assertEquals(2, ba.getSampleUsed().getFactorValues().size());
}
AnalysisType aa = analysisService.determineAnalysis(ee, ee.getExperimentalDesign().getExperimentalFactors(), null, true);
assertEquals(AnalysisType.TWO_WAY_ANOVA_WITH_INTERACTION, aa);
DifferentialExpressionAnalysisConfig config = new DifferentialExpressionAnalysisConfig();
config.setAnalysisType(aa);
config.setFactorsToInclude(factors);
config.addInteractionToInclude(factors);
analyzer = this.getBean(DiffExAnalyzer.class);
Collection<DifferentialExpressionAnalysis> result = analyzer.run(ee, config);
assertEquals(1, result.size());
DifferentialExpressionAnalysis analysis = result.iterator().next();
assertNotNull(analysis);
assertEquals(3, analysis.getResultSets().size());
}
use of ubic.gemma.model.expression.experiment.ExperimentalFactor in project Gemma by PavlidisLab.
the class ContinuousVariableDiffExTest method setup.
@Before
public void setup() throws Exception {
/*
* this is an exon array data set that has the data present. It's an annoying choice for a test in that it
* exposes issues with our attempts to ignore the data from exon arrays until we get it from the raw CEL files.
*/
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(FileTools.resourceToPath("/data/analysis/expression/gse13949short")));
try {
Collection<?> results = geoService.fetchAndLoad("GSE13949", false, true, false);
ee = (ExpressionExperiment) results.iterator().next();
} catch (AlreadyExistsInSystemException e) {
ee = (ExpressionExperiment) ((Collection<?>) e.getData()).iterator().next();
}
ee = expressionExperimentService.thawLite(ee);
Collection<ExperimentalFactor> toremove = new HashSet<>(ee.getExperimentalDesign().getExperimentalFactors());
for (ExperimentalFactor ef : toremove) {
experimentalFactorService.delete(ef);
ee.getExperimentalDesign().getExperimentalFactors().remove(ef);
}
expressionExperimentService.update(ee);
processedExpressionDataVectorService.computeProcessedExpressionData(ee);
ee = expressionExperimentService.thaw(ee);
designImporter.importDesign(ee, this.getClass().getResourceAsStream("/data/analysis/expression/gse13949short/1151_GSE13949_expdesign.data.txt"));
}
Aggregations