gpt4 book ai didi

uk.ac.ebi.intact.model.util.XrefUtils.getIdentityXrefs()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 22:39:05 26 4
gpt4 key购买 nike

本文整理了Java中uk.ac.ebi.intact.model.util.XrefUtils.getIdentityXrefs()方法的一些代码示例,展示了XrefUtils.getIdentityXrefs()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XrefUtils.getIdentityXrefs()方法的具体详情如下:
包路径:uk.ac.ebi.intact.model.util.XrefUtils
类名称:XrefUtils
方法名:getIdentityXrefs

XrefUtils.getIdentityXrefs介绍

暂无

代码示例

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
   * 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();
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
   * 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();
  }
}

代码示例来源:origin: uk.ac.ebi.intact.dbupdate/intact-cv-update

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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

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);
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

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);
}

代码示例来源:origin: uk.ac.ebi.intact.sanity/intact-sanity-rules

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;
  }
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

for (InteractorXref idXref : XrefUtils.getIdentityXrefs(component.getInteractor())) {
  for (int i=0; i<primIdsToFind.length; i++) {
    if (idXref.getPrimaryId().equals(primIdsToFind[i])) {

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * 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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * 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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

for (InteractorXref idXref : XrefUtils.getIdentityXrefs(component.getInteractor())) {
  for (int i=0; i<primIdsToFind.length; i++) {
    if (idXref.getPrimaryId().equals(primIdsToFind[i])) {

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

/**
 * 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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

/**
 * 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;
}

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

final Collection<CvObjectXref> xrefs2 = XrefUtils.getIdentityXrefs(cvToFind);
final Collection<CvObjectXref> xrefs1 = XrefUtils.getIdentityXrefs(cv1);

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

final Collection<CvObjectXref> xrefs2 = XrefUtils.getIdentityXrefs(cvToFind);
final Collection<CvObjectXref> xrefs1 = XrefUtils.getIdentityXrefs(cv1);

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core-readonly

List<InteractorXref> idXrefs = new ArrayList<InteractorXref>(XrefUtils.getIdentityXrefs(interactor));

代码示例来源:origin: uk.ac.ebi.intact.core/intact-core

List<InteractorXref> idXrefs = new ArrayList<InteractorXref>(XrefUtils.getIdentityXrefs(interactor));

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com