Search in sources :

Example 6 with VocabCharacteristic

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);
        }
    }
}
Also used : GZIPInputStream(java.util.zip.GZIPInputStream) Gene(ubic.gemma.model.genome.Gene) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) Gene2GOAssociation(ubic.gemma.model.association.Gene2GOAssociation) Before(org.junit.Before)

Example 7 with VocabCharacteristic

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;
}
Also used : VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) OntologyTerm(ubic.basecode.ontology.model.OntologyTerm)

Example 8 with VocabCharacteristic

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());
    }
}
Also used : Characteristic(ubic.gemma.model.common.description.Characteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

Example 9 with VocabCharacteristic

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;
}
Also used : VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic) OntologyTerm(ubic.basecode.ontology.model.OntologyTerm)

Example 10 with VocabCharacteristic

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;
}
Also used : VocabCharacteristic(ubic.gemma.model.common.description.VocabCharacteristic)

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