use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.
the class GeneMultifunctionalityPopulationServiceTest method setUp.
@Before
public void setUp() throws Exception {
if (goService.isRunning()) {
goService.shutDown();
}
gene2GoService.removeAll();
goService.loadTermsInNameSpace(new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/ontology/molecular-function.test.owl.gz")));
testTaxon = taxonService.findOrCreate(Taxon.Factory.newInstance("foobly" + RandomStringUtils.randomAlphabetic(2), "doobly" + RandomStringUtils.randomAlphabetic(2), "bar" + RandomStringUtils.randomAlphabetic(2), RandomUtils.nextInt(5000), true, true));
/*
* Create genes
*/
for (int i = 0; i < 120; i++) {
Gene gene = this.getTestPersistentGene(testTaxon);
// Some genes get no terms.
if (i >= 100)
continue;
/*
* Add up to 5 GO terms. Parents mean more will be added.
*/
for (int j = 0; j <= Math.floor(i / 20); j++) {
VocabCharacteristic oe = VocabCharacteristic.Factory.newInstance();
oe.setValueUri(GeneOntologyService.BASE_GO_URI + goTerms[j]);
oe.setValue(goTerms[j]);
Gene2GOAssociation g2Go1 = Gene2GOAssociation.Factory.newInstance(gene, oe, GOEvidenceCode.EXP);
gene2GoService.create(g2Go1);
}
}
}
use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.
the class PhenotypeAssoOntologyHelperImpl method characteristicValueObject2Characteristic.
@Override
public VocabCharacteristic characteristicValueObject2Characteristic(CharacteristicValueObject characteristicValueObject) {
VocabCharacteristic characteristic = VocabCharacteristic.Factory.newInstance();
characteristic.setCategory(characteristicValueObject.getCategory());
characteristic.setCategoryUri(characteristicValueObject.getCategoryUri());
characteristic.setValue(characteristicValueObject.getValue());
if (characteristic.getValueUri() != null && !characteristic.getValueUri().equals("")) {
characteristic.setValueUri(characteristicValueObject.getValueUri());
} else {
// format the query for lucene to look for ontology terms with an exact match for the value
String value = "\"" + StringUtils.join(characteristicValueObject.getValue().trim().split(" "), " AND ") + "\"";
Collection<OntologyTerm> ontologyTerms = this.ontologyService.findTerms(value);
for (OntologyTerm ontologyTerm : ontologyTerms) {
if (ontologyTerm.getLabel().equalsIgnoreCase(characteristicValueObject.getValue())) {
characteristic.setValueUri(ontologyTerm.getUri());
break;
}
}
}
return characteristic;
}
use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.
the class CharacteristicBrowserController method populateClassValues.
private void populateClassValues(Characteristic c, AnnotationValueObject avo) {
if (c instanceof VocabCharacteristic) {
VocabCharacteristic vc = (VocabCharacteristic) c;
avo.setClassUri(vc.getCategoryUri());
avo.setTermUri(vc.getValueUri());
avo.setObjectClass(VocabCharacteristic.class.getSimpleName());
} else {
avo.setObjectClass(Characteristic.class.getSimpleName());
}
}
use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.
the class ExperimentalDesignImporterImpl method termForCategoryLookup.
/**
* Does a lookup for the Ontology term to match the category.
*
* @param category category
* @return vocab characteristic
*/
private VocabCharacteristic termForCategoryLookup(String category, Collection<OntologyTerm> terms) {
OntologyTerm t = null;
String lookup = category.replaceAll("_", " ").toLowerCase();
for (OntologyTerm to : terms) {
if (to.getTerm().equals(category) || to.getTerm().equals(lookup)) {
t = to;
break;
}
}
if (t == null) {
throw new IllegalArgumentException("No term matches '" + category + "' - formalized to: " + lookup);
}
VocabCharacteristic vc = VocabCharacteristic.Factory.newInstance();
vc.setCategoryUri(t.getUri());
vc.setCategory(t.getTerm());
vc.setValueUri(t.getUri());
vc.setValue(t.getTerm());
vc.setEvidenceCode(GOEvidenceCode.IC);
return vc;
}
use of ubic.gemma.model.common.description.VocabCharacteristic in project Gemma by PavlidisLab.
the class GeoChannel method getMoleculeAsCharacteristic.
/**
* Convert the molecule into a MGED Ontology-based MaterialType VocabCharacteristic. If "other" we just return a
* plain text value.
*
* @return characteristic
*/
public Characteristic getMoleculeAsCharacteristic() {
VocabCharacteristic result = VocabCharacteristic.Factory.newInstance();
result.setDescription("Material Type");
result.setCategory("molecular entity");
result.setCategoryUri("http://purl.obolibrary.org/obo/CHEBI_23367");
switch(this.molecule) {
case cytoplasmicRNA:
result.setValue("cytoplasmic RNA extract");
result.setValueUri("http://purl.obolibrary.org/obo/OBI_0000876");
break;
case polyARNA:
result.setValue("polyA RNA");
result.setValueUri("http://purl.obolibrary.org/obo/OBI_0000869");
break;
case genomicDNA:
result.setValue("genomic DNA");
result.setValueUri("http://purl.org/obo/owl/SO#SO_0000991");
break;
case totalRNA:
result.setValue("total RNA");
result.setValueUri("http://www.ebi.ac.uk/efo/EFO_0004964");
break;
case nuclearRNA:
result.setValue("nuclear RNA extract");
result.setValueUri("http://purl.obolibrary.org/obo/OBI_0000862");
break;
case protein:
result.setValue("protein");
result.setValueUri("http://purl.obolibrary.org/obo/CHEBI_36080");
break;
case other:
result.setValue("Other material type");
break;
default:
break;
}
return result;
}
Aggregations