/** * This method will copy basic properties and parent/children from a ontology term source to a ontology term target * @param source : the cv term source to copy from * @param target : the cv term target to copy to */ public static void copyAndOverrideOntologyTermProperties(OntologyTerm source, OntologyTerm target){ if (source != null && target != null){ copyAndOverrideCvTermProperties(source, target); target.getParents().clear(); target.getParents().addAll(source.getParents()); target.getChildren().clear(); target.getChildren().addAll(source.getChildren()); target.setDefinition(source.getDefinition()); } }
if (term.getMIIdentifier() != null && mi != null){ if (term.getMIIdentifier().equals(mi)){ return true; else if (!term.getParents().isEmpty()){ for (OntologyTerm parent : term.getParents()){ if (isCvTermChildOf(parent, mi, name)){ return true; if (term.getShortName().equalsIgnoreCase(name) || (term.getFullName() != null && term.getFullName().equalsIgnoreCase(name))){ return true; else if (!term.getParents().isEmpty()){ for (OntologyTerm parent : term.getParents()){ if (isCvTermChildOf(parent, mi, name)){ return true;
@Override protected void createDefinitionFor(String def, OntologyTerm term) { if (term.getDefinition() != null){ term.setDefinition(term.getDefinition() + LINE_BREAK + def); } else{ term.setDefinition(def); } }
protected void processShortLabel(Term term, OntologyTerm ontologyTerm) { if (ontologyTerm.getShortName().length() == 0){ ontologyTerm.setShortName(term.getName()); } }
ontologyTerm.getAnnotations().add(AnnotationUtils.createAnnotation(Annotation.URL, Annotation.URL_MI, otherInfoString)); ontologyTerm.getAnnotations().add(AnnotationUtils.createAnnotation(Annotation.URL, Annotation.URL_MI, HTTP_DEF + defArray[1])); } else if ( defArray.length > 2 ) { def = defArray[0]; ontologyTerm.getAnnotations().add(AnnotationUtils.createAnnotation(Annotation.URL, Annotation.URL_MI, otherInfoString.substring(def.length()))); if (ontologyTerm.getDefinition() == null){ ontologyTerm.setDefinition(otherInfoString); ontologyTerm.setDefinition(ontologyTerm.getDefinition() + LINE_BREAK + def); ontologyTerm.setDefinition(otherInfoString); ontologyTerm.setDefinition(ontologyTerm.getDefinition() + LINE_BREAK + otherInfoString);
protected void addLinkToTerm(String parentId, String childId, Map<String, OntologyTerm> id2Terms){ OntologyTerm child = id2Terms.get( childId ); OntologyTerm parent = id2Terms.get( parentId ); if ( child == null ) { throw new NullPointerException( "You must give a non null child" ); } if ( parent == null ) { throw new NullPointerException( "You must give a non null parent" ); } if ( !child.getParents().contains(parent) ) { child.getParents().add(parent); } if ( !parent.getChildren().contains(child) ) { parent.getChildren().add(child); } } }
public Set<OntologyTerm> fetchRootTerms(CvTerm database) throws BridgeFailedException{ if (database != null && !DefaultCvTermComparator.areEquals(getOntologyDatabase(), database)){ return Collections.EMPTY_SET; } Set<OntologyTerm> terms = new HashSet<OntologyTerm>(); for ( Iterator<OntologyTerm> iterator = getId2Term().values().iterator(); iterator.hasNext(); ) { OntologyTerm ontologyTerm = iterator.next(); if ( ontologyTerm.getParents().isEmpty() ) { terms.add( ontologyTerm ); } } if ( terms.isEmpty() ) { return Collections.EMPTY_SET; } return terms; } }
public void onDefinitionUpdate(OntologyTerm cv, String oldDef) { if (oldDef == null){ ontologyTermChangeLogger.log(Level.INFO, "The definition " + cv.getDefinition() + " has been added to the ontology term " + cv.toString()); } else if (cv.getDefinition() == null){ ontologyTermChangeLogger.log(Level.INFO, "The definition "+ oldDef+ " has been removed from the ontology term " + cv.toString()); } else { ontologyTermChangeLogger.log(Level.INFO, "The definition "+oldDef+" has been updated with " + cv.getDefinition() + " in the ontology term " + cv.toString()); } } }
/** * Process the definition String * @param definition * @return */ protected void processDefinition(String definition, OntologyTerm ontologyTerm) { if ( definition.contains( LINE_BREAK ) ) { String[] defArray = definition.split( LINE_BREAK ); String otherInfoString = null; if ( defArray.length == 2 ) { ontologyTerm.setDefinition(defArray[0]); otherInfoString = defArray[1]; processInfoInDescription(definition, otherInfoString, ontologyTerm); } else if ( defArray.length > 2 ) { ontologyTerm.setDefinition(defArray[0]); for (int i = 1; i < defArray.length; i++){ otherInfoString = defArray[i]; processInfoInDescription(definition, otherInfoString, ontologyTerm); } } } else { processInfoInDescription(definition, definition, ontologyTerm); } }
ontologyTerm.getXrefs().add(primaryPubmedRef); ontologyTerm.getXrefs().add(pubmedRef); ontologyTerm.getXrefs().add(pubmedRef); // MI not MOD } else if ( GO.equalsIgnoreCase(database) ) { Xref goRef = XrefUtils.createXrefWithQualifier(GO, GO_MI_REF, database + ":" + accession, Xref.SEE_ALSO, Xref.SEE_ALSO_MI); ontologyTerm.getXrefs().add(goRef); // MI not MOD } else if ( RESID.equalsIgnoreCase(database) ) { Xref resXref = XrefUtils.createXrefWithQualifier(RESID, RESID_MI_REF, accession, Xref.SEE_ALSO, Xref.SEE_ALSO_MI); ontologyTerm.getXrefs().add(resXref); } else if ( SO.equalsIgnoreCase(database) ) { Xref soRef = XrefUtils.createXrefWithQualifier(SO, SO_MI_REF, database + ":" + accession, Xref.SEE_ALSO, Xref.SEE_ALSO_MI); ontologyTerm.getXrefs().add(soRef); // MI not MOD }else if ( Xref.PUBMED.equalsIgnoreCase(database) ) { if (pubmedPrimary == null){ ontologyTerm.getXrefs().add(primaryPubmedRef); ontologyTerm.getXrefs().add(pubmedRef); ontologyTerm.getXrefs().add(resXref); }else if ( Xref.CHEBI.equalsIgnoreCase(database) ) { Xref chebiRef = XrefUtils.createXrefWithQualifier(Xref.CHEBI, Xref.CHEBI_MI, accession, Xref.SEE_ALSO, Xref.SEE_ALSO_MI); ontologyTerm.getXrefs().add(chebiRef); // MOD xref } else if ( Annotation.URL.equalsIgnoreCase(database) ) { ontologyTerm.getAnnotations().add(AnnotationUtils.createAnnotation(Annotation.URL, Annotation.URL_MI, accession));
protected void processSynonyms(Term term, OntologyTerm ontologyTerm) { Collection<TermSynonym> synonyms = term.getSynonyms(); if (synonyms != null){ for (TermSynonym synonym : synonyms){ Term synonymType = synonym.getSynonymType(); //PSI-MOD-label for MOD if (synonymType != null){ if (SHORTLABEL_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || MOD_SHORTLABEL_IDENTIFIER.equalsIgnoreCase(synonymType.getName())){ ontologyTerm.setShortName(synonym.getSynonym()); } else if (ALIAS_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || MOD_ALIAS_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || RESID_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || RESID_MISNOMER_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || RESID_NAME_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || RESID_SYSTEMATIC_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || UNIPROT_FEATURE_IDENTIFIER.equalsIgnoreCase(synonymType.getName()) || EXACT_KEY.equalsIgnoreCase(synonymType.getName())){ ontologyTerm.getSynonyms().add(AliasUtils.createAlias(Alias.SYNONYM, Alias.SYNONYM_MI, synonym.getSynonym())); } } } } }
ontologyTerm.getAnnotations().add(validation); ontologyTerm.getAnnotations().add(validation); ontologyTerm.getAnnotations().add(validation); ontologyTerm.getAnnotations().add(validation);
return "otherFeatures"; else if (term.getMODIdentifier() != null){ return "ptms";
public Set<OntologyTerm> fetchRootTerms(String database) throws BridgeFailedException { if (database != null && !getOntologyDatabase().getShortName().equalsIgnoreCase(database)){ return Collections.EMPTY_SET; } Set<OntologyTerm> terms = new HashSet<OntologyTerm>(); for ( Iterator<OntologyTerm> iterator = getId2Term().values().iterator(); iterator.hasNext(); ) { OntologyTerm ontologyTerm = iterator.next(); if ( ontologyTerm.getParents().isEmpty() ) { terms.add( ontologyTerm ); } } if ( terms.isEmpty() ) { return Collections.EMPTY_SET; } return terms; }
/** * Process the annotations of a term * @param term */ protected void processAnnotations(Term term, OntologyTerm ontologyTerm) { Collection<uk.ac.ebi.ols.model.interfaces.Annotation> annotations = term.getAnnotations(); if (annotations != null){ for (uk.ac.ebi.ols.model.interfaces.Annotation annot : annotations){ // only one comment with type null if (annot.getAnnotationType() != null && COMMENT_KEY.equals(annot.getAnnotationType())){ ontologyTerm.getAnnotations().add(AnnotationUtils.createComment(annot.getAnnotationStringValue())); } } } }