psidev.psi.mi.jami.utils.XrefUtils.doesXrefHaveDatabaseAndId()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(85)

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

XrefUtils.doesXrefHaveDatabaseAndId介绍

[英]Method to know if a Xref is from the same database (dbId is the MI identifier and dbName is the database shortname)
[中]方法以了解外部参照是否来自同一数据库(dbId是MI标识符,dbName是数据库短名称)

代码示例

代码示例来源:origin: psidev.psi.mi.jami/jami-core

/**
 * Remove all Xrefs having this database name/database id from the collection of xrefs
 * @param refs : the collection of Xrefs
 * @param dbId : the database id to look for
 * @param dbName : the database name to look for
 * @param id
 */
public static void removeAllXrefsWithDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
  if (refs != null){
    Iterator<? extends Xref> refIterator = refs.iterator();
    while (refIterator.hasNext()){
      if (doesXrefHaveDatabaseAndId(refIterator.next(), dbId, dbName, id)){
        refIterator.remove();
      }
    }
  }
}

代码示例来源:origin: psidev.psi.mi.jami/jami-core

/**
 * Collect all cross references having a specific database
 * @param refs
 * @param dbId
 * @param dbName
 * @param id
 * @return
 */
public static Collection<Xref> collectAllXrefsHavingDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
  if (refs == null || refs.isEmpty()){
    return Collections.EMPTY_LIST;
  }
  Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
  for (Xref ref : refs){
    if (doesXrefHaveDatabaseAndId(ref, dbId, dbName, id)){
      identifiers.add(ref);
    }
  }
  return identifiers;
}

代码示例来源:origin: psidev.psi.mi.jami/jami-core

/**
 * This method will return the first Xref from this database having :
 * - identity qualifier
 * - secondary identifier if no identity qualifier
 * - first Xref from this database if no identity or secondary qualifier
 * It will return null if there are no Xrefs with this database id/name
 * @param refs : the collection of Xrefs
 * @param dbId : the database id to look for
 * @param dbName : the database name to look for
 * @param id
 * @return the first identifier having this database name/id, null if no Xrefs with this database name/id
 */
public static Xref collectFirstIdentifierWithDatabaseAndId(Collection<? extends Xref> refs, String dbId, String dbName, String id){
  if (refs == null || (dbName == null && dbId == null) || id == null){
    return null;
  }
  for (Xref xref : refs){
    if (isXrefAnIdentifier(xref) && doesXrefHaveDatabaseAndId(xref, dbId, dbName, id)){
      return xref;
    }
  }
  return null;
}

代码示例来源:origin: psidev.psi.mi.jami.bridges/jami-imexcentral

public psidev.psi.mi.jami.model.Publication fetchByIdentifier( String identifier, String source ) throws BridgeFailedException {
  for ( psidev.psi.mi.jami.model.Publication p : allPublications ) {
    for (Xref i : p.getIdentifiers()){
      if( XrefUtils.doesXrefHaveDatabaseAndId(i, null, source, identifier) ) {
        return p;
      }
    }
    if (p.getImexId() != null && p.getImexId().equalsIgnoreCase(identifier)){
      return p;
    }
  }
  return null;
}

相关文章