/** * 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(); } }
/** * 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(); } }
public static Collection<CvObjectXref> extractIdentityXrefFrom(CvDagObject cv, String databaseId){ Collection<CvObjectXref> existingIdentities = XrefUtils.getIdentityXrefs(cv); Collection<CvObjectXref> identities = new ArrayList<CvObjectXref>(existingIdentities.size()); for (CvObjectXref ref : existingIdentities){ if (ref.getCvDatabase() != null && ref.getCvDatabase().getIdentifier().equalsIgnoreCase(databaseId)){ identities.add(ref); } } return identities; }
protected Key keyForInteractor(Interactor interactor) { final Collection<InteractorXref> interactorXrefs = XrefUtils.getIdentityXrefs(interactor); Key key; if (interactorXrefs.isEmpty()) { key = keyForAnnotatedObject(interactor); } else { Class normalizedClass = CgLibUtil.removeCglibEnhanced(interactor.getClass()); key = new Key(normalizedClass.getSimpleName() + ":" + concatPrimaryIds(interactorXrefs)); } return key; }
protected Key keyForInteractor(Interactor interactor) { final Collection<InteractorXref> interactorXrefs = XrefUtils.getIdentityXrefs(interactor); Key key; if (interactorXrefs.isEmpty()) { key = keyForAnnotatedObject(interactor); } else { Class normalizedClass = CgLibUtil.removeCglibEnhanced(interactor.getClass()); key = new Key(normalizedClass.getSimpleName() + ":" + concatPrimaryIds(interactorXrefs)); } return key; }
protected Key keyForInstitution(Institution institution) { final Collection<InstitutionXref> institutionXrefs = XrefUtils.getIdentityXrefs(institution); Key key; if (institutionXrefs.isEmpty()) { key = keyForAnnotatedObject(institution); } else { key = new Key("Institution:" + concatPrimaryIds(institutionXrefs)); } return key; }
protected Key keyForCvObject(CvObject cvObject) { String key = cvObject.getIdentifier(); if (key == null) { // search for identity final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs(cvObject); if (!xrefs.isEmpty()) { key = concatPrimaryIds(xrefs); } else { key = cvObject.getShortLabel(); } } key = cvObject.getClass().getSimpleName() + "__" + key; return new Key(key); }
protected Key keyForInstitution(Institution institution) { final Collection<InstitutionXref> institutionXrefs = XrefUtils.getIdentityXrefs(institution); Key key; if (institutionXrefs.isEmpty()) { key = keyForAnnotatedObject(institution); } else { key = new Key("Institution:" + concatPrimaryIds(institutionXrefs)); } return key; }
protected Key keyForCvObject(CvObject cvObject) { String key = cvObject.getIdentifier(); if (key == null) { // search for identity final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs(cvObject); if (!xrefs.isEmpty()) { key = concatPrimaryIds(xrefs); } else { key = cvObject.getShortLabel(); } } key = cvObject.getClass().getSimpleName() + "__" + key; return new Key(key); }
public Collection<GeneralMessage> check( SmallMolecule smallMolecule ) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); final Collection<InteractorXref> identities = XrefUtils.getIdentityXrefs( smallMolecule ); switch( identities.size() ) { case 0: messages.add( new GeneralMessage( MessageDefinition.SMALL_MOLECULE_IDENTITY_MISSING, smallMolecule ) ); break; case 1: final InteractorXref xref = identities.iterator().next(); if ( ! CvObjectUtils.hasIdentity( xref.getCvDatabase(), CvDatabase.CHEBI_MI_REF ) ) { messages.add( new GeneralMessage(MessageDefinition.SMALL_MOLECULE_IDENTITY_INVALID_DB, smallMolecule ) ); } break; default: // more than 1 messages.add( new GeneralMessage( MessageDefinition.SMALL_MOLECULE_IDENTITY_MULTIPLE, smallMolecule ) ); } return messages; } }
for (InteractorXref idXref : XrefUtils.getIdentityXrefs(component.getInteractor())) { for (int i=0; i<primIdsToFind.length; i++) { if (idXref.getPrimaryId().equals(primIdsToFind[i])) {
/** * Gets the Interactor Identifiers for that interaction * * @since 1.7.2 */ public static List<String> getInteractorPrimaryIDs(Interaction interaction) { final Collection<Component> components = interaction.getComponents(); List<String> ids = new ArrayList<String>(components.size()); for (Component component : components) { Interactor interactor = component.getInteractor(); final Collection<InteractorXref> idXrefs = XrefUtils.getIdentityXrefs(interactor); if (idXrefs.size() > 0) { final Iterator<InteractorXref> iterator = idXrefs.iterator(); ids.add(iterator.next().getPrimaryId()); if (log.isDebugEnabled()) { if (iterator.hasNext()) { log.debug("Interaction contains interactor with more than one identities. Interaction: " + interaction.getShortLabel() + "(" + interaction.getAc() + ") " + " - Xrefs: " + idXrefs); } } } } return ids; }
/** * Gets the Interactor Identifiers for that interaction * * @since 1.7.2 */ public static List<String> getInteractorPrimaryIDs(Interaction interaction) { final Collection<Component> components = interaction.getComponents(); List<String> ids = new ArrayList<String>(components.size()); for (Component component : components) { Interactor interactor = component.getInteractor(); final Collection<InteractorXref> idXrefs = XrefUtils.getIdentityXrefs(interactor); if (idXrefs.size() > 0) { final Iterator<InteractorXref> iterator = idXrefs.iterator(); ids.add(iterator.next().getPrimaryId()); if (log.isDebugEnabled()) { if (iterator.hasNext()) { log.debug("Interaction contains interactor with more than one identities. Interaction: " + interaction.getShortLabel() + "(" + interaction.getAc() + ") " + " - Xrefs: " + idXrefs); } } } } return ids; }
for (InteractorXref idXref : XrefUtils.getIdentityXrefs(component.getInteractor())) { for (int i=0; i<primIdsToFind.length; i++) { if (idXref.getPrimaryId().equals(primIdsToFind[i])) {
/** * 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; }
final Collection<CvObjectXref> xrefs2 = XrefUtils.getIdentityXrefs(cvToFind); final Collection<CvObjectXref> xrefs1 = XrefUtils.getIdentityXrefs(cv1);
final Collection<CvObjectXref> xrefs2 = XrefUtils.getIdentityXrefs(cvToFind); final Collection<CvObjectXref> xrefs1 = XrefUtils.getIdentityXrefs(cv1);
List<InteractorXref> idXrefs = new ArrayList<InteractorXref>(XrefUtils.getIdentityXrefs(interactor));
List<InteractorXref> idXrefs = new ArrayList<InteractorXref>(XrefUtils.getIdentityXrefs(interactor));