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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations