public <X extends Xref> X createIdentityXref(AnnotatedObject<X,?> parent, String primaryId, CvDatabase cvDatabase) { return XrefUtils.createIdentityXref(parent, primaryId, getIdentityQualifier(), cvDatabase); }
protected CvObjectXref createIdentityXref( CvObject parent, String id ) { CvObjectXref idXref = null; if (id != null) { if (id.startsWith("MI")) { idXref = XrefUtils.createIdentityXrefPsiMi(parent, id); idXref.prepareParentMi(); } else if (id.startsWith("IA")) { idXref = XrefUtils.createIdentityXref(parent, id, nonMiCvDatabase); } else if (id.startsWith("MOD")) { idXref = XrefUtils.createIdentityXref(parent, id, psimod); } else { if (log.isWarnEnabled()) log.warn("Uknown prefix for id: "+id+". Will store as a cross reference to database: "+nonMiCvDatabase.getShortLabel()); idXref = XrefUtils.createIdentityXref(parent, id, nonMiCvDatabase); } } return idXref; }
/** * Returns the Xref with MI number for given CV object * * @param cvobj the CV to search for MI * * @return xref with MI or null if no xref found whose primaryid starts with 'MI:'. */ private static Xref getMIXref( CvInteractorType cvobj ) { final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs( cvobj ); if( xrefs.size() != 1 ) { throw new IllegalStateException( "Only a single MI identity expected here, found " + xrefs.size() ); } return xrefs.iterator().next(); } }
/** * 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 CvObjectXref getPsiMiIdentityXref(CvObject cvObject) { return XrefUtils.getPsiMiIdentityXref(cvObject); }
public static <T extends CvObject> T createCvObject(Institution institution, Class<T> cvClass, String primaryId, String shortLabel) { T cv = ClassUtils.newInstance(cvClass); cv.setOwner(institution); cv.setShortLabel(shortLabel); CvObjectXref idXref = XrefUtils.createIdentityXrefPsiMi(cv, primaryId); cv.addXref(idXref); return cv; } }
public static boolean hasIdentity(CvObject cvObject, String psiMi) { return XrefUtils.hasIdentity(cvObject, psiMi); }
public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) { String dbMi = cvDatabase.getIdentifier(); return getIdentityXref(annotatedObject, dbMi); }
public <X extends Xref> X createXref(AnnotatedObject<X,?> parent, String primaryId, CvXrefQualifier cvXrefQualifer, CvDatabase cvDatabase) { X xref = (X) XrefUtils.newXrefInstanceFor(parent.getClass()); xref.setOwner(parent.getOwner()); xref.setParent(parent); xref.setPrimaryId(primaryId); xref.setCvXrefQualifier(cvXrefQualifer); xref.setCvDatabase(cvDatabase); return xref; }
public <X extends Xref> X createIdentityXrefUniprot(AnnotatedObject<X,?> parent, String primaryId) { return XrefUtils.createIdentityXrefUniprot(parent, primaryId); }
public <X extends Xref> X createIdentityXrefChebi(AnnotatedObject<X,?> parent, String chebiId) { return XrefUtils.createIdentityXrefChebi(parent, chebiId); }
/** * @deprecated To get the PSI-MI identifier, just invoke CvObject.getMiIdentifier() */ @Deprecated public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) { return XrefUtils.getPsiMiIdentityXref(cvObject); }
/** * 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 <T extends CvObject> T createCvObject(Institution institution, Class<T> cvClass, String miIdentifier, String shortLabel) { T cv = ClassUtils.newInstance(cvClass); cv.setOwner(institution); cv.setShortLabel(shortLabel); cv.setIdentifier(miIdentifier); if (miIdentifier != null) { CvObjectXref idXref = XrefUtils.createIdentityXrefPsiMi(cv, miIdentifier); cv.addXref(idXref); idXref.prepareParentMi(); } return cv; }
public static boolean hasIdentity(CvObject cvObject, String psiMi) { if (cvObject.getIdentifier() != null && cvObject.getIdentifier().equals(psiMi)) { return true; } return XrefUtils.hasIdentity(cvObject, psiMi); }
public static <X extends Xref> X getIdentityXref(AnnotatedObject<X, ?> annotatedObject, CvDatabase cvDatabase) { String dbMi = cvDatabase.getIdentifier(); return getIdentityXref(annotatedObject, dbMi); }
public <X extends Xref> X createXref(AnnotatedObject<X,?> parent, String primaryId, CvXrefQualifier cvXrefQualifer, CvDatabase cvDatabase) { X xref = (X) XrefUtils.newXrefInstanceFor(parent.getClass()); xref.setOwner(parent.getOwner()); xref.setParent(parent); xref.setPrimaryId(primaryId); xref.setCvXrefQualifier(cvXrefQualifer); xref.setCvDatabase(cvDatabase); return xref; }
public <X extends Xref> X createIdentityXrefUniprot(AnnotatedObject<X,?> parent, String primaryId) { return XrefUtils.createIdentityXrefUniprot(parent, primaryId); }
public <X extends Xref> X createIdentityXrefChebi(AnnotatedObject<X,?> parent, String chebiId) { return XrefUtils.createIdentityXrefChebi(parent, chebiId); }
public <X extends Xref> X createIdentityXref(AnnotatedObject<X,?> parent, String primaryId, CvDatabase cvDatabase) { return XrefUtils.createIdentityXref(parent, primaryId, getIdentityQualifier(), cvDatabase); }