Search in sources :

Example 26 with FactorValue

use of ubic.gemma.model.expression.experiment.FactorValue in project Gemma by PavlidisLab.

the class DetectFactorBaselineTest method testIsBaselineA.

@Test
public void testIsBaselineA() {
    FactorValue fv = FactorValue.Factory.newInstance();
    fv.setValue("fv");
    VocabCharacteristic c = VocabCharacteristic.Factory.newInstance();
    c.setValue("control_group");
    fv.getCharacteristics().add(c);
    boolean actual = BaselineSelection.isBaselineCondition(fv);
    assertTrue(actual);
}
Also used : FactorValue(ubic.gemma.model.expression.experiment.FactorValue) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) Test(org.junit.Test)

Example 27 with FactorValue

use of ubic.gemma.model.expression.experiment.FactorValue in project Gemma by PavlidisLab.

the class DetectFactorBaselineTest method testIsBaselineB.

@Test
public void testIsBaselineB() {
    FactorValue fv = FactorValue.Factory.newInstance();
    fv.setValue("fv");
    VocabCharacteristic c = VocabCharacteristic.Factory.newInstance();
    c.setValueUri("http://purl.org/nbirn/birnlex/ontology/BIRNLex-Investigation.owl#birnlex_2201");
    fv.getCharacteristics().add(c);
    boolean actual = BaselineSelection.isBaselineCondition(fv);
    assertTrue(actual);
}
Also used : FactorValue(ubic.gemma.model.expression.experiment.FactorValue) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) Test(org.junit.Test)

Example 28 with FactorValue

use of ubic.gemma.model.expression.experiment.FactorValue in project Gemma by PavlidisLab.

the class DetectFactorBaselineTest method testIsNotBaselineA.

@Test
public void testIsNotBaselineA() {
    FactorValue fv = FactorValue.Factory.newInstance();
    fv.setValue("fv");
    VocabCharacteristic c = VocabCharacteristic.Factory.newInstance();
    c.setValueUri("http://purl.org/obo/owl/CHEBI#CHEBI_16236");
    fv.getCharacteristics().add(c);
    boolean actual = BaselineSelection.isBaselineCondition(fv);
    assertTrue(!actual);
}
Also used : FactorValue(ubic.gemma.model.expression.experiment.FactorValue) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) Test(org.junit.Test)

Example 29 with FactorValue

use of ubic.gemma.model.expression.experiment.FactorValue in project Gemma by PavlidisLab.

the class ExperimentalDesignImporterTestB method testParseLoadDelete.

@Test
public final void testParseLoadDelete() throws Exception {
    try (InputStream is = this.getClass().getResourceAsStream("/data/loader/expression/gill2007temperatureGemmaAnnotationData.txt")) {
        experimentalDesignImporter.importDesign(ee, is);
    }
    this.checkResults();
    this.aclTestUtils.checkEEAcls(ee);
    ee = this.expressionExperimentService.load(ee.getId());
    ee = expressionExperimentService.thawLite(ee);
    int s = ee.getExperimentalDesign().getExperimentalFactors().size();
    ExperimentalFactor toDelete = ee.getExperimentalDesign().getExperimentalFactors().iterator().next();
    experimentalFactorService.delete(toDelete);
    ee = this.expressionExperimentService.load(ee.getId());
    ee = expressionExperimentService.thawLite(ee);
    assertEquals(s - 1, ee.getExperimentalDesign().getExperimentalFactors().size());
    for (BioAssay ba : ee.getBioAssays()) {
        BioMaterial bm = ba.getSampleUsed();
        for (FactorValue fv : bm.getFactorValues()) {
            assertTrue(!fv.getExperimentalFactor().equals(toDelete));
        }
    }
}
Also used : BioMaterial(ubic.gemma.model.expression.biomaterial.BioMaterial) FactorValue(ubic.gemma.model.expression.experiment.FactorValue) InputStream(java.io.InputStream) ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) BioAssay(ubic.gemma.model.expression.bioAssay.BioAssay) Test(org.junit.Test) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest)

Example 30 with FactorValue

use of ubic.gemma.model.expression.experiment.FactorValue in project Gemma by PavlidisLab.

the class DiffExMetaAnalyzerServiceImpl method validate.

private void validate(ExpressionAnalysisResultSet rs) {
    if (rs.getExperimentalFactors().size() > 1) {
        throw new IllegalArgumentException("Cannot do a meta-analysis on interaction terms");
    }
    ExperimentalFactor factor = rs.getExperimentalFactors().iterator().next();
    /*
         * We need to check this just in the subset of samples actually used.
         */
    BioAssaySet experimentAnalyzed = rs.getAnalysis().getExperimentAnalyzed();
    assert experimentAnalyzed != null;
    if (experimentAnalyzed instanceof ExpressionExperimentSubSet) {
        ExpressionExperimentSubSet eesubset = (ExpressionExperimentSubSet) experimentAnalyzed;
        Collection<FactorValue> factorValuesUsed = expressionExperimentSubSetService.getFactorValuesUsed(eesubset, factor);
        if (factorValuesUsed.size() > 2) {
            throw new IllegalArgumentException("Cannot do a meta-analysis including a factor that has more than two levels: " + factor + " has " + factor.getFactorValues().size() + " levels from " + experimentAnalyzed);
        }
    } else {
        if (factor.getFactorValues().size() > 2) {
            /*
                 * Note that this doesn't account for continuous factors.
                 */
            throw new IllegalArgumentException("Cannot do a meta-analysis including a factor that has more than two levels: " + factor + " has " + factor.getFactorValues().size() + " levels from " + experimentAnalyzed);
        }
    }
}
Also used : FactorValue(ubic.gemma.model.expression.experiment.FactorValue) BioAssaySet(ubic.gemma.model.expression.experiment.BioAssaySet) ExperimentalFactor(ubic.gemma.model.expression.experiment.ExperimentalFactor) ExpressionExperimentSubSet(ubic.gemma.model.expression.experiment.ExpressionExperimentSubSet)

Aggregations

FactorValue (ubic.gemma.model.expression.experiment.FactorValue)55 ExperimentalFactor (ubic.gemma.model.expression.experiment.ExperimentalFactor)30 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)27 Test (org.junit.Test)12 VocabCharacteristic (ubic.gemma.model.common.description.VocabCharacteristic)8 BioAssay (ubic.gemma.model.expression.bioAssay.BioAssay)8 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)8 HashSet (java.util.HashSet)7 Characteristic (ubic.gemma.model.common.description.Characteristic)6 DifferentialExpressionAnalysis (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysis)5 ArrayList (java.util.ArrayList)4 AbstractGeoServiceTest (ubic.gemma.core.loader.expression.geo.AbstractGeoServiceTest)4 CompositeSequence (ubic.gemma.model.expression.designElement.CompositeSequence)4 FactorValueValueObject (ubic.gemma.model.expression.experiment.FactorValueValueObject)4 StopWatch (org.apache.commons.lang3.time.StopWatch)3 DifferentialExpressionAnalysisResult (ubic.gemma.model.analysis.expression.diff.DifferentialExpressionAnalysisResult)3 ExpressionAnalysisResultSet (ubic.gemma.model.analysis.expression.diff.ExpressionAnalysisResultSet)3 AnnotationValueObject (ubic.gemma.model.common.description.AnnotationValueObject)3 Measurement (ubic.gemma.model.common.measurement.Measurement)3 BioAssaySet (ubic.gemma.model.expression.experiment.BioAssaySet)3