Search in sources :

Example 26 with VocabCharacteristic

use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.

the class AclAdviceTest method testExpressionExperimentAcls.

/*
     * Test of EE ACLs and also SecurityNotInherited on EE set.
     */
@Test
public void testExpressionExperimentAcls() {
    ExpressionExperiment ee = this.getTestPersistentCompleteExpressionExperiment(false);
    aclTestUtils.checkEEAcls(ee);
    /*
         * Make public, and then add a factor and factorvalue.
         */
    securityService.makePublic(ee);
    ExperimentalFactor ef = ExperimentalFactor.Factory.newInstance();
    VocabCharacteristic cat = VocabCharacteristic.Factory.newInstance();
    cat.setCategory("foo");
    cat.setCategoryUri("bar");
    ef.setName("TESTING ACLS");
    ef.setCategory(cat);
    ef.setType(FactorType.CATEGORICAL);
    ef = expressionExperimentService.addFactor(ee, ef);
    FactorValue fv = FactorValue.Factory.newInstance(ef);
    fv.setValue("ack");
    fv = FactorValue.Factory.newInstance(ef);
    fv.setValue("adddck");
    expressionExperimentService.addFactorValue(ee, fv);
    securityService.makePrivate(ee);
    aclTestUtils.checkEEAcls(ee);
    /*
         * Now associate with ee set, remove the set and then the ee, make sure things are done correctly!
         */
    ExpressionExperimentSet ees = ExpressionExperimentSet.Factory.newInstance();
    ees.getExperiments().add(ee);
    ees.setName(this.randomName());
    persisterHelper.persist(ees);
    // make sure the ACL for objects are there (throws an exception if not).
    Acl eeacl = aclService.readAclById(new AclObjectIdentity(ee));
    aclService.readAclById(new AclObjectIdentity(ees));
    assertNull(eeacl.getParentAcl());
    expressionExperimentSetService.remove(ees);
    // make sure ACL for ees is gone
    aclTestUtils.checkDeletedAcl(ees);
    // make sure the ACL for ee is still there
    aclTestUtils.checkHasAcl(ee);
    expressionExperimentService.remove(ee);
    aclTestUtils.checkDeleteEEAcls(ee);
}
Also used : VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) ExpressionExperimentSet(ubic.gemma.model.analysis.expression.ExpressionExperimentSet) Acl(org.springframework.security.acls.model.Acl) AclObjectIdentity(gemma.gsec.acl.domain.AclObjectIdentity) BaseSpringContextTest(ubic.gemma.core.testing.BaseSpringContextTest) Test(org.junit.Test)

Example 27 with VocabCharacteristic

use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.

the class SearchServiceTest method setup.

public void setup() throws Exception {
    try (InputStream is = this.getClass().getResourceAsStream("/data/loader/ontology/fma.test.owl")) {
        assert is != null;
        ontologyService.getFmaOntologyService().loadTermsInNameSpace(is);
    }
    ee = this.getTestPersistentBasicExpressionExperiment();
    VocabCharacteristic eeCharSpinalCord = VocabCharacteristic.Factory.newInstance();
    eeCharSpinalCord.setCategory(SearchServiceTest.SPINAL_CORD);
    eeCharSpinalCord.setCategoryUri(SearchServiceTest.SPINAL_CORD);
    eeCharSpinalCord.setValue(SearchServiceTest.SPINAL_CORD);
    eeCharSpinalCord.setValueUri(SearchServiceTest.SPINAL_CORD);
    characteristicService.create(eeCharSpinalCord);
    VocabCharacteristic eeCharGeneURI = VocabCharacteristic.Factory.newInstance();
    eeCharGeneURI.setCategory(SearchServiceTest.GENE_URI);
    eeCharGeneURI.setCategoryUri(SearchServiceTest.GENE_URI);
    eeCharGeneURI.setValue(SearchServiceTest.GENE_URI);
    eeCharGeneURI.setValueUri(SearchServiceTest.GENE_URI);
    characteristicService.create(eeCharGeneURI);
    VocabCharacteristic eeCharCortexURI = VocabCharacteristic.Factory.newInstance();
    eeCharCortexURI.setCategory(SearchServiceTest.BRAIN_CAVITY);
    eeCharCortexURI.setCategoryUri(SearchServiceTest.BRAIN_CAVITY);
    eeCharCortexURI.setValue(SearchServiceTest.BRAIN_CAVITY);
    eeCharCortexURI.setValueUri(SearchServiceTest.BRAIN_CAVITY);
    characteristicService.create(eeCharCortexURI);
    Collection<Characteristic> chars = new HashSet<>();
    chars.add(eeCharSpinalCord);
    chars.add(eeCharGeneURI);
    chars.add(eeCharCortexURI);
    ee.setCharacteristics(chars);
    eeService.update(ee);
    gene = this.getTestPersistentGene();
    this.geneNcbiId = RandomStringUtils.randomNumeric(8);
    gene.setNcbiGeneId(new Integer(geneNcbiId));
    geneService.update(gene);
    thePastUserQuery = UserQuery.Factory.newInstance();
    Calendar calendar = Calendar.getInstance();
    // the past
    calendar.set(Calendar.YEAR, 1979);
    calendar.set(Calendar.MONTH, 1);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    thePastUserQuery.setLastUsed(calendar.getTime());
    SearchSettings settings = SearchSettings.Factory.newInstance();
    settings.noSearches();
    // should hit 'cavity of brain'.
    settings.setQuery("Brain");
    settings.setSearchExperiments(true);
    settings.setUseCharacteristics(true);
    settings.setUseIndices(false);
    settings.setUseDatabase(false);
    thePastUserQuery.setSearchSettings(settings);
    thePastUserQuery.setUrl("someUrl");
    // the future
    calendar.add(Calendar.YEAR, 2000);
    theFutureUserQuery = UserQuery.Factory.newInstance();
    theFutureUserQuery.setLastUsed(calendar.getTime());
    SearchSettings futureSettings = SearchSettings.Factory.newInstance();
    futureSettings.noSearches();
    // should hit 'cavity of brain'.
    futureSettings.setQuery("Brain");
    futureSettings.setSearchExperiments(true);
    futureSettings.setUseCharacteristics(true);
    theFutureUserQuery.setSearchSettings(futureSettings);
    theFutureUserQuery.setUrl("someUrl");
    // save to db to load later to test if the pipes are clean
    userQueryService.create(thePastUserQuery);
    userQueryService.create(theFutureUserQuery);
}
Also used : InputStream(java.io.InputStream) Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) SearchSettings(ubic.gemma.model.common.search.SearchSettings)

Example 28 with VocabCharacteristic

use of ubic.gemma.model.common.description.VocabCharacteristic 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 29 with VocabCharacteristic

use of ubic.gemma.model.common.description.VocabCharacteristic 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 30 with VocabCharacteristic

use of ubic.gemma.model.common.description.VocabCharacteristic 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)

Aggregations

VocabCharacteristic (ubic.gemma.model.common.description.VocabCharacteristic)44 Characteristic (ubic.gemma.model.common.description.Characteristic)15 OntologyTerm (ubic.basecode.ontology.model.OntologyTerm)10 FactorValue (ubic.gemma.model.expression.experiment.FactorValue)7 Test (org.junit.Test)6 AnnotationValueObject (ubic.gemma.model.common.description.AnnotationValueObject)4 Gene (ubic.gemma.model.genome.Gene)4 HashSet (java.util.HashSet)3 Gene2GOAssociation (ubic.gemma.model.association.Gene2GOAssociation)3 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)2 StopWatch (org.apache.commons.lang3.time.StopWatch)2 ConcurrentHashSet (org.compass.core.util.concurrent.ConcurrentHashSet)2 OntologyIndividual (ubic.basecode.ontology.model.OntologyIndividual)2 OntologyResource (ubic.basecode.ontology.model.OntologyResource)2 BaseSpringContextTest (ubic.gemma.core.testing.BaseSpringContextTest)2 BioMaterial (ubic.gemma.model.expression.biomaterial.BioMaterial)2 CharacteristicValueObject (ubic.gemma.model.genome.gene.phenotype.valueObject.CharacteristicValueObject)2 AclObjectIdentity (gemma.gsec.acl.domain.AclObjectIdentity)1 InputStream (java.io.InputStream)1