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

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

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

XrefUtils.isXrefFromDatabase介绍

[英]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
 */
public static void removeAllXrefsWithDatabase(Collection<? extends Xref> refs, String dbId, String dbName){
  if (refs != null){
    Iterator<? extends Xref> refIterator = refs.iterator();
    while (refIterator.hasNext()){
      if (isXrefFromDatabase(refIterator.next(), dbId, dbName)){
        refIterator.remove();
      }
    }
  }
}

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

protected void processAddedXrefEvent(Xref added) {
  // the added identifier is imex and the current imex is not set
  if (imexId == null && XrefUtils.isXrefFromDatabase(added, Xref.IMEX_MI, Xref.IMEX)){
    // the added xref is imex-primary
    if (XrefUtils.doesXrefHaveQualifier(added, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
      imexId = added;
    }
  }
}

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

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

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

protected void processAddedXrefEvent(Xref added) {
  // the added identifier is imex and the current imex is not set
  if (imexId == null && XrefUtils.isXrefFromDatabase(added, Xref.IMEX_MI, Xref.IMEX)){
    // the added xref is imex-primary
    if (XrefUtils.doesXrefHaveQualifier(added, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
      imexId = added;
    }
  }
}

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

protected void processAddedXrefEvent(Xref added) {
  // the added identifier is imex and the current imex is not set
  if (imexId == null && XrefUtils.isXrefFromDatabase(added, Xref.IMEX_MI, Xref.IMEX)){
    // the added xref is imex-primary
    if (XrefUtils.doesXrefHaveQualifier(added, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
      imexId = added;
    }
  }
}

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

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

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

protected void initialiseInteractionIdentifiers(Collection<MitabXref> interactionIds, T interaction){
  Iterator<MitabXref> refsIterator = interactionIds.iterator();
  while (refsIterator.hasNext()){
    MitabXref ref = refsIterator.next();
    if (XrefUtils.isXrefFromDatabase(ref, Xref.IMEX_MI, Xref.IMEX) && XrefUtils.doesXrefHaveQualifier(ref, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
      interaction.getXrefs().add(ref);
    }
    else if (XrefUtils.isXrefFromDatabase(ref, Checksum.RIGID_MI, Checksum.RIGID) || XrefUtils.isXrefFromDatabase(ref, null, Checksum.IRIGID)){
      createChecksumFromId(interaction, ref);
    }
    else{
      interaction.getIdentifiers().add(ref);
    }
  }
}

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

/**
 * Collect all cross references having a specific database and qualifier
 * @param refs
 * @param dbId
 * @param dbName
 * @param qualifierId
 * @param qualifierName
 * @return
 */
public static Collection<Xref> collectAllXrefsHavingDatabaseAndQualifier(Collection<? extends Xref> refs, String dbId, String dbName, String qualifierId, String qualifierName){
  if (refs == null || refs.isEmpty()){
    return Collections.EMPTY_LIST;
  }
  Collection<Xref> identifiers = new ArrayList<Xref>(refs.size());
  for (Xref ref : refs){
    if (isXrefFromDatabase(ref, dbId, dbName) && doesXrefHaveQualifier(ref, qualifierId, qualifierName)){
      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
 * @return the first identifier having this database name/id, null if no Xrefs with this database name/id
 */
public static Xref collectFirstIdentifierWithDatabase(Collection<? extends Xref> refs, String dbId, String dbName){
  if (refs == null || (dbName == null && dbId == null)){
    return null;
  }
  for (Xref xref : refs){
    if (isXrefAnIdentifier(xref) && isXrefFromDatabase(xref, dbId, dbName)){
      return xref;
    }
  }
  return null;
}

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

protected boolean initialisePublicationIdentifiers(Collection<MitabXref> pubId, MitabPublication publication, boolean hasInitialisedLocator){
  Iterator<MitabXref> refsIterator = pubId.iterator();
  while (refsIterator.hasNext()){
    MitabXref ref = refsIterator.next();
    if (!hasInitialisedLocator){
      publication.setSourceLocator(ref.getSourceLocator());
      hasInitialisedLocator = true;
    }
    if (XrefUtils.isXrefFromDatabase(ref, Xref.IMEX_MI, Xref.IMEX) && XrefUtils.doesXrefHaveQualifier(ref, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)){
      publication.getXrefs().add(ref);
    }
    else{
      publication.getIdentifiers().add(ref);
    }
  }
  return hasInitialisedLocator;
}

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

next = interactionXrefIterator.next();
while (interactionXrefIterator.hasNext() && (XrefUtils.doesXrefHaveQualifier(next, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  next = interactionXrefIterator.next();
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  if (!isFirst){
    getWriter().write(MitabUtils.FIELD_SEPARATOR);

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

next = interactionXrefIterator.next();
while (interactionXrefIterator.hasNext() && (XrefUtils.doesXrefHaveQualifier(next, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  next = interactionXrefIterator.next();
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  if (!isFirst){
    getWriter().write(MitabUtils.FIELD_SEPARATOR);

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

next = interactionXrefIterator.next();
while (interactionXrefIterator.hasNext() && (XrefUtils.doesXrefHaveQualifier(next, Xref.IMEX_PRIMARY_MI, Xref.IMEX_PRIMARY)
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  next = interactionXrefIterator.next();
    && XrefUtils.isXrefFromDatabase(next, Xref.IMEX_MI, Xref.IMEX))){
  if (!isFirst){
    getWriter().write(MitabUtils.FIELD_SEPARATOR);

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

protected void processAddedIdentifierEvent(Xref added) {
  if (uniprotkb != added && (XrefUtils.isXrefFromDatabase(added, Xref.UNIPROTKB_MI, Xref.UNIPROTKB)
  || XrefUtils.isXrefFromDatabase(added, Xref.UNIPROTKB_SWISSPROT_MI, Xref.UNIPROTKB_SWISSPROT)
  || XrefUtils.isXrefFromDatabase(added, Xref.UNIPROTKB_TREMBL_MI, Xref.UNIPROTKB_TREMBL))){
  else if (refseq != added && XrefUtils.isXrefFromDatabase(added, Xref.REFSEQ_MI, Xref.REFSEQ)){

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

protected void processAddedIdentifierEvent(Xref added) {
  // the added identifier is interpro and it is not the current interpro identifier
  if (interpro != added && XrefUtils.isXrefFromDatabase(added, Xref.INTERPRO_MI, Xref.INTERPRO)){
    // the current interpro identifier is not identity, we may want to set interpro Identifier
    if (!XrefUtils.doesXrefHaveQualifier(interpro, Xref.IDENTITY_MI, Xref.IDENTITY)){
      // the interpro identifier is not set, we can set the interpro identifier
      if (interpro == null){
        interpro = added;
      }
      else if (XrefUtils.doesXrefHaveQualifier(added, Xref.IDENTITY_MI, Xref.IDENTITY)){
        interpro = added;
      }
      // the added xref is secondary object and the current interpro identifier is not a secondary object, we reset interpro identifier
      else if (!XrefUtils.doesXrefHaveQualifier(interpro, Xref.SECONDARY_MI, Xref.SECONDARY)
          && XrefUtils.doesXrefHaveQualifier(added, Xref.SECONDARY_MI, Xref.SECONDARY)){
        interpro = added;
      }
    }
  }
}

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

protected void processAddedIdentifierEvent(Xref added) {
  // the added identifier is chebi and it is not the current chebi identifier
  if (chebi != added && XrefUtils.isXrefFromDatabase(added, Xref.CHEBI_MI, Xref.CHEBI)){
    // the current chebi identifier is not identity, we may want to set chebiIdentifier
    if (!XrefUtils.doesXrefHaveQualifier(chebi, Xref.IDENTITY_MI, Xref.IDENTITY)){
      // the chebi identifier is not set, we can set the chebi identifier
      if (chebi == null){
        chebi = added;
      }
      else if (XrefUtils.doesXrefHaveQualifier(added, Xref.IDENTITY_MI, Xref.IDENTITY)){
        chebi = added;
      }
      // the added xref is secondary object and the current chebi is not a secondary object, we reset chebi identifier
      else if (!XrefUtils.doesXrefHaveQualifier(chebi, Xref.SECONDARY_MI, Xref.SECONDARY)
          && XrefUtils.doesXrefHaveQualifier(added, Xref.SECONDARY_MI, Xref.SECONDARY)){
        chebi = added;
      }
    }
  }
}

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

protected void processAddedIdentifiersEvent(Xref added) {
  if (ddbjEmblGenbank != added && XrefUtils.isXrefFromDatabase(added, Xref.DDBJ_EMBL_GENBANK_MI, Xref.DDBJ_EMBL_GENBANK)){
  else if (refseq != added && XrefUtils.isXrefFromDatabase(added, Xref.REFSEQ_MI, Xref.REFSEQ)){

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

else if (XrefUtils.isXrefFromDatabase(ref, Checksum.ROGID_MI, Checksum.ROGID)){
  createChecksumFromAltId(interactor, ref);
else if (XrefUtils.isXrefFromDatabase(ref, null, Checksum.IROGID)){
  createChecksumFromAltId(interactor, ref);

代码示例来源:origin: uk.ac.ebi.intact.dataexchange/structured-abstract

if (XrefUtils.isXrefFromDatabase(xref, Xref.UNIPROTKB_MI, Xref.UNIPROTKB)
    && XrefUtils.doesXrefHaveQualifier(xref, Xref.IDENTITY_MI, Xref.IDENTITY)){
  uniprot = xref;
else if (XrefUtils.isXrefFromDatabase(xref, Xref.REFSEQ_MI, Xref.REFSEQ)
    && XrefUtils.doesXrefHaveQualifier(xref, Xref.IDENTITY_MI, Xref.IDENTITY)){
  refseq = xref;

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

protected void processAddedIdentifierEvent(Xref added) {
  if (pubmedId != added && XrefUtils.isXrefFromDatabase(added, Xref.PUBMED_MI, Xref.PUBMED)){
  else if (doi != added && XrefUtils.isXrefFromDatabase(added, Xref.DOI_MI, Xref.DOI)){

相关文章