String mi1 = cvTerm1.getMIIdentifier(); String mi2 = cvTerm2.getMIIdentifier(); String mod1 = cvTerm1.getMODIdentifier(); String mod2 = cvTerm2.getMODIdentifier(); String par1 = cvTerm1.getPARIdentifier(); String par2 = cvTerm2.getPARIdentifier(); return par1.equals(par2); else if (!cvTerm1.getIdentifiers().isEmpty() && !cvTerm2.getIdentifiers().isEmpty()){ Iterator<Xref> iterator1 = cvTerm1.getIdentifiers().iterator(); Xref altid1 = iterator1.next(); for (Xref altid2 : cvTerm2.getIdentifiers()){ if (DefaultExternalIdentifierComparator.areEquals(altid1, altid2)){ return true; String label1 = cvTerm1.getShortName(); String label2 = cvTerm2.getShortName();
protected void configure(String filePath) { /** * ensure we get the right logger */ logger = Logger.getLogger(AbstractOboLoader.class); try { parser = new OBO2FormatParser(filePath); } catch (Exception e) { logger.fatal("Parse failed: " + e.getMessage(), e); } ONTOLOGY_DEFINITION = ontologyDatabase.getShortName(); FULL_NAME = ontologyDatabase.getFullName(); SHORT_NAME = ontologyDatabase.getShortName(); }
/*** * This method will copy properties of cv term source in cv term target and will override all the other properties of Target cv term. * @param source : the cv term source to copy from * @param target : the cv term target to copy to */ public static void copyAndOverrideCvTermProperties(CvTerm source, CvTerm target){ if (source != null && target != null){ target.setShortName(source.getShortName()); target.setFullName(source.getFullName()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getSynonyms().clear(); target.getSynonyms().addAll(source.getSynonyms()); } }
public static Xref getPsiModReference(CvTerm term){ if (term == null){ return null; } else if (term.getMODIdentifier() == null){ return null; } else{ return XrefUtils.collectFirstIdentifierWithDatabaseAndId(term.getIdentifiers(), CvTerm.PSI_MOD_MI, CvTerm.PSI_MOD, term.getMODIdentifier()); } }
public static Xref getPsiMiReference(CvTerm term){ if (term == null){ return null; } else if (term.getMIIdentifier() == null){ return null; } else{ return XrefUtils.collectFirstIdentifierWithDatabaseAndId(term.getIdentifiers(), CvTerm.PSI_MI_MI, CvTerm.PSI_MI, term.getMIIdentifier()); } }
public static Xref getPsiParReference(CvTerm term){ if (term == null){ return null; } else if (term.getPARIdentifier() == null){ return null; } else{ return XrefUtils.collectFirstIdentifierWithDatabaseAndId(term.getIdentifiers(), null, CvTerm.PSI_PAR, term.getPARIdentifier()); } }
public static Term buildTerm( CvTerm cv ) { if (cv == null){ return null; } final String id = cv.getMIIdentifier(); if( id == null ) { return null; } return new Term( id, cv.getShortName() ); }
public T fetchByIdentifier(String termIdentifier, String ontologyDatabaseName) throws BridgeFailedException { if (ontologyDatabaseName != null && !this.ontologyDatabase.getShortName().equalsIgnoreCase(ontologyDatabaseName)){ return null; } return id2Term.get(termIdentifier); }
/** * Check if the CvTerm natches the MI term and/or the name if no MI term exist * @param term : the term to check * @param mi : the mi id to compare * @param name : the name to compare * @return true if the CvTerm natches the MI term and/or the name */ public static boolean isCvTerm(CvTerm term, String mi, String name){ if (term.getMIIdentifier() != null && mi != null){ return term.getMIIdentifier().equals(mi); } else{ if (term.getShortName().equalsIgnoreCase(name) || (term.getFullName() != null && term.getFullName().equalsIgnoreCase(name))){ return true; } else { return false; } } }
CvTerm type = feature.getType(); if (type.getMODIdentifier() != null){ return "ptms"; else if (type.getMIIdentifier() != null){ OntologyTerm term = null; try { term = fetcher.fetchByIdentifier(type.getMIIdentifier(), CvTerm.PSI_MI); } catch (BridgeFailedException e) { logger.log(Level.SEVERE, "Cannot fetch the ontology information for the term " + type.getMIIdentifier(), e); String name = type.getFullName() != null ? type.getFullName() : type.getShortName(); try { term = fetcher.fetchByName(name, CvTerm.PSI_MI); logger.log(Level.SEVERE, "Cannot fetch the ontology information for the term " + (type.getFullName() != null ? type.getFullName() : type.getShortName()), e);
CvTerm cellType = organism.getCellType(); if (!cellType.getIdentifiers().isEmpty() || !cellType.getXrefs().isEmpty()){ Collection<psidev.psi.mi.jami.model.Xref> cabriReferences = XrefUtils.collectAllXrefsHavingDatabase(cellType.getIdentifiers(), RuleUtils.CABRI_MI_REF, RuleUtils.CABRI); Collection<psidev.psi.mi.jami.model.Xref> cellReferences = XrefUtils.collectAllXrefsHavingDatabase(cellType.getIdentifiers(), RuleUtils.CELL_ONTOLOGY_MI_REF, RuleUtils.CELL_ONTOLOGY); Collection<psidev.psi.mi.jami.model.Xref> allPubmeds = XrefUtils.collectAllXrefsHavingDatabaseAndQualifier(cellType.getXrefs(), psidev.psi.mi.jami.model.Xref.PUBMED_MI, psidev.psi.mi.jami.model.Xref.PUBMED, psidev.psi.mi.jami.model.Xref.PRIMARY_MI, psidev.psi.mi.jami.model.Xref.PRIMARY); messages=Collections.singleton( new ValidatorMessage( "The cellType " + cellType.getShortName() + " does not have a CABRI or Cell Ontology cross reference with a qualifier 'identity' and it is strongly recommended. " + "If the cell line cannot be identified but one of these databases, at least one pubmed primary reference is necessary.'", MessageLevel.WARN, MiContext context = RuleUtils.buildContext(cellType, "cell type"); context.addAssociatedContext(RuleUtils.buildContext(organism, "organism")); messages=Collections.singleton( new ValidatorMessage( "The cellType " + cellType.getShortName() + " does not have any cross references and at least one cross reference to CABRI or Cell Ontology with " + "qualifier 'identity' is strongly recommended. If the cell line cannot be identified but one of these databases, at least one pubmed primary reference is necessary.'", MessageLevel.WARN,
public void onMIIdentifierUpdate(CvTerm cv, String oldMI) { if (oldMI == null){ cvChangeLogger.log(Level.INFO, "The MI identifier " + cv.getMIIdentifier() + " has been added to the cv term " + cv.toString()); } else if (cv.getMIIdentifier() == null){ cvChangeLogger.log(Level.INFO, "The MI identifier "+ oldMI+ " has been removed from the cv term " + cv.toString()); } else { cvChangeLogger.log(Level.INFO, "The MI identifier "+oldMI+" has been updated with " + cv.getMIIdentifier() + " in the cv term " + cv.toString()); } }
protected void processShortLabel(Term term, T ontologyTerm) { if (ontologyTerm.getShortName().length() == 0){ ontologyTerm.setShortName(term.getName()); } }
if (!tissue.getIdentifiers().isEmpty()){ Collection<psidev.psi.mi.jami.model.Xref> brendaRef = XrefUtils.collectAllXrefsHavingDatabase(tissue.getIdentifiers(), RuleUtils.BRENDA_MI_REF, RuleUtils.BRENDA); Collection<psidev.psi.mi.jami.model.Xref> tissueRef = XrefUtils.collectAllXrefsHavingDatabase(tissue.getIdentifiers(), RuleUtils.TISSUE_LIST_MI_REF, RuleUtils.TISSUE_LIST); return Collections.singletonList( new ValidatorMessage( "The tissue " + tissue.getShortName() + " has "+tissue.getIdentifiers().size()+" identifier(s) but none of them is a BRENDA or Tissue List cross reference with a qualifier 'identity' and it is strongly recommended.'", MessageLevel.WARN, context, MiContext context = RuleUtils.buildContext(tissue, "tissue"); context.addAssociatedContext(RuleUtils.buildContext(organism, "organism")); return Collections.singletonList( new ValidatorMessage( "The tissue " + tissue.getShortName() + " doesn't have any cross references and at least one cross reference to BRENDA or Tissue List " + "qualifier 'identity' is strongly recommended.'", MessageLevel.WARN,
public void onMODIdentifierUpdate(CvTerm cv, String oldMOD) { if (oldMOD == null){ cvChangeLogger.log(Level.INFO, "The MOD identifier " + cv.getMODIdentifier() + " has been added to the cv term " + cv.toString()); } else if (cv.getMIIdentifier() == null){ cvChangeLogger.log(Level.INFO, "The MOD identifier "+ oldMOD+ " has been removed from the cv term " + cv.toString()); } else { cvChangeLogger.log(Level.INFO, "The MOD identifier "+oldMOD+" has been updated with " + cv.getMODIdentifier() + " in the cv term " + cv.toString()); } }
String dbname = xref.getDatabase().getShortName(); getDatabase().getAnnotations(), Annotation.SEARCH_URL_MI, Annotation.SEARCH_URL); if (searchUrlAnnot != null){ searchUrl = searchUrlAnnot.getValue();
public void onPARIdentifierUpdate(CvTerm cv, String oldPAR) { if (oldPAR == null){ cvChangeLogger.log(Level.INFO, "The PAR identifier " + cv.getPARIdentifier() + " has been added to the cv term " + cv.toString()); } else if (cv.getMIIdentifier() == null){ cvChangeLogger.log(Level.INFO, "The PAR identifier "+ oldPAR+ " has been removed from the cv term " + cv.toString()); } else { cvChangeLogger.log(Level.INFO, "The PAR identifier "+oldPAR+" has been updated with " + cv.getPARIdentifier() + " in the cv term " + cv.toString()); } }
public static CvTerm createIdentityQualifier(CvTerm psiMi){ CvTerm identity = new DefaultCvTerm(Xref.IDENTITY); Xref psiMiXref = new DefaultXref(psiMi, Xref.IDENTITY_MI, identity); identity.getIdentifiers().add(psiMiXref); return identity; } }
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));
public void onFullNameUpdate(CvTerm cv, String oldFullName) { if (oldFullName == null){ cvChangeLogger.log(Level.INFO, "The full name has been initialised for the cv term " + cv.toString()); } else if (cv.getFullName() == null){ cvChangeLogger.log(Level.INFO, "The full name has been reset for the cv term " + cv.toString()); } else { cvChangeLogger.log(Level.INFO, "The full name "+oldFullName+" has been updated with " + cv.getFullName() + " in the cv term " + cv.toString()); } }