public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) { String dbMi = cvDatabase.getIdentifier(); return getIdentityXref(annotatedObject, dbMi); }
/** * Gets the unique identifier of a CvObject. If it has PSI MI Identifier (miIdentifier) return it, * if not, return the 'CvDatabase.intact' identifier; otherwise return the primaryId of the first identity xref found. * * @param cvObject The object to get the identifier from. * @return The identifier. Will be null if no miIdentifier or identity xref is found. * @since 1.8.0 */ public static String getIdentity(CvObject cvObject) { if (cvObject == null) return null; // try the PSI MI first if (cvObject.getIdentifier() != null) { return cvObject.getIdentifier(); } // try to get the identity with CvDatabase 'intact' CvObjectXref idXref = XrefUtils.getIdentityXref(cvObject, CvDatabase.INTACT); // get the first identity, if any if (idXref == null) { Collection<CvObjectXref> idXrefs = XrefUtils.getIdentityXrefs(cvObject); if (!idXrefs.isEmpty()) { idXref = idXrefs.iterator().next(); } } return (idXref != null) ? idXref.getPrimaryId() : null; }
/** * Gets the unique identifier of a CvObject. If it has PSI MI Identifier (miIdentifier) return it, * if not, return the 'CvDatabase.intact' identifier; otherwise return the primaryId of the first identity xref found. * * @param cvObject The object to get the identifier from. * @return The identifier. Will be null if no miIdentifier or identity xref is found. * @since 1.8.0 */ public static String getIdentity(CvObject cvObject) { if (cvObject == null) return null; // try the PSI MI first if (cvObject.getIdentifier() != null) { return cvObject.getIdentifier(); } // try to get the identity with CvDatabase 'intact' CvObjectXref idXref = XrefUtils.getIdentityXref(cvObject, CvDatabase.INTACT); // get the first identity, if any if (idXref == null) { Collection<CvObjectXref> idXrefs = XrefUtils.getIdentityXrefs(cvObject); if (!idXrefs.isEmpty()) { idXref = idXrefs.iterator().next(); } } return (idXref != null) ? idXref.getPrimaryId() : null; }
public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) { String dbMi = cvDatabase.getIdentifier(); return getIdentityXref(annotatedObject, dbMi); }
private void initializeIdentityValue(IntactOntologyAccess ontologyAccess){ CvObjectXref currentIdentityXref = XrefUtils.getIdentityXref(currentIntactParent, ontologyAccess.getDatabaseIdentifier()); // this parent cannot be updated because is not from the same ontology if (currentIdentityXref == null && ontologyAccess.getDatabaseRegexp() != null){ Matcher matcher = ontologyAccess.getDatabaseRegexp().matcher(currentIntactParent.getIdentifier()); if (matcher.find() && matcher.group().equalsIgnoreCase(currentIntactParent.getIdentifier())){ currentIdentity = currentIntactParent.getIdentifier(); } else { currentIdentity = null; } } else { currentIdentity = currentIdentityXref.getPrimaryId(); } }
private void initializeIdentityValue(IntactOntologyAccess ontologyAccess){ CvObjectXref currentIdentityXref = XrefUtils.getIdentityXref(currentIntactParent, ontologyAccess.getDatabaseIdentifier()); // this parent cannot be updated because is not from the same ontology if (currentIdentityXref == null && ontologyAccess.getDatabaseRegexp() != null){ Matcher matcher = ontologyAccess.getDatabaseRegexp().matcher(currentIntactParent.getIdentifier()); if (matcher.find() && matcher.group().equalsIgnoreCase(currentIntactParent.getIdentifier())){ currentIdentity = currentIntactParent.getIdentifier(); } else { currentIdentity = null; } } else { currentIdentity = currentIdentityXref.getPrimaryId(); } }
CvObjectXref identity1 = XrefUtils.getIdentityXref(o1, dbIdentifier); CvObjectXref identity2 = XrefUtils.getIdentityXref(o2, dbIdentifier);
InteractorXref idPdbXref = XrefUtils.getIdentityXref(interaction, CvDatabase.RCSB_PDB_MI_REF); InteractorXref idMsdXref = XrefUtils.getIdentityXref(interaction, CvDatabase.MSD_PDB_MI_REF); InteractorXref idWwXref = XrefUtils.getIdentityXref(interaction, CvDatabase.WWPDB_MI_REF); if (idPdbXref != null) sb.append(idPdbXref.getPrimaryId()); if (idMsdXref != null) sb.append(idMsdXref.getPrimaryId());
InteractorXref idPdbXref = XrefUtils.getIdentityXref(interaction, CvDatabase.RCSB_PDB_MI_REF); InteractorXref idMsdXref = XrefUtils.getIdentityXref(interaction, CvDatabase.MSD_PDB_MI_REF); InteractorXref idWwXref = XrefUtils.getIdentityXref(interaction, CvDatabase.WWPDB_MI_REF); if (idPdbXref != null) sb.append(idPdbXref.getPrimaryId()); if (idMsdXref != null) sb.append(idMsdXref.getPrimaryId());