Class XrefUtils


  • public class XrefUtils
    extends Object
    Utility class for Xrefs
    Since:
    24/01/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • XrefUtils

        public XrefUtils()
    • Method Detail

      • isXrefAnIdentifier

        public static boolean isXrefAnIdentifier​(Xref ref)
        Method to know if a Xref is a potential identifier. It can be an identity xref or a secondary xref.
        Parameters:
        ref - : the Xref
        Returns:
        true if the Xref has a qualifier identity or secondary-ac
      • isXrefFromDatabase

        public static boolean isXrefFromDatabase​(Xref ref,
                                                 String dbId,
                                                 String dbName)
        Method to know if a Xref is from the same database (dbId is the MI identifier and dbName is the database shortname)
        Parameters:
        ref - : the Xref
        dbId - : the database MI identifier
        dbName - : the database shortname
        Returns:
        true if the Xref has a database MI which is dbId or database shortname which is dbName
      • doesXrefHaveQualifier

        public static boolean doesXrefHaveQualifier​(Xref ref,
                                                    String qualifierId,
                                                    String qualifierName)
        Method to know if a Xref has the same qualifier (qualifierId is the MI identifier and qualifierName is the qualifier shortname)
        Parameters:
        ref - : the Xref
        qualifierId - : the qualifier MI identifier
        qualifierName - : the qualifier shortname
        Returns:
        true if the Xref has a qualifier MI which is qualifierId or qualifier shortname which is qualifierName
      • doesXrefHaveDatabaseAndId

        public static boolean doesXrefHaveDatabaseAndId​(Xref ref,
                                                        String dbId,
                                                        String dbName,
                                                        String id)
        Method to know if a Xref is from the same database (dbId is the MI identifier and dbName is the database shortname)
        Parameters:
        ref - : the Xref
        dbId - : the database MI identifier
        dbName - : the database shortname
        id - : database id
        Returns:
        true if the Xref has a database MI which is dbId or database shortname which is dbName
      • doesXrefHaveQualifierAndId

        public static boolean doesXrefHaveQualifierAndId​(Xref ref,
                                                         String qualifierId,
                                                         String qualifierName,
                                                         String id)
        Method to know if a Xref has the same qualifier (qualifierId is the MI identifier and qualifierName is the qualifier shortname)
        Parameters:
        ref - : the Xref
        qualifierId - : the qualifier MI identifier
        qualifierName - : the qualifier shortname
        id - : database id
        Returns:
        true if the Xref has a qualifier MI which is qualifierId or qualifier shortname which is qualifierName
      • collectAllIdentifiersFrom

        public static Collection<Xref> collectAllIdentifiersFrom​(Collection<? extends Xref> refs)
        Method to return a sub collection of identifiers (qualifier identity or secondary) in a list of Xrefs
        Parameters:
        refs - a Collection object.
        Returns:
        the sublist of identifiers (qualifier identity or secondary) from the list of Xrefs
      • collectAllXrefsHavingQualifier

        public static Collection<Xref> collectAllXrefsHavingQualifier​(Collection<? extends Xref> refs,
                                                                      String qualifierId,
                                                                      String qualifierName)
        Collect all cross references having a specific qualifier
        Parameters:
        refs - a Collection object.
        qualifierId - a String object.
        qualifierName - a String object.
        Returns:
        a Collection object.
      • collectAllXrefsHavingDatabaseAndQualifier

        public static Collection<Xref> collectAllXrefsHavingDatabaseAndQualifier​(Collection<? extends Xref> refs,
                                                                                 String dbId,
                                                                                 String dbName,
                                                                                 String qualifierId,
                                                                                 String qualifierName)
        Collect all cross references having a specific database and qualifier
        Parameters:
        refs - a Collection object.
        dbId - a String object.
        dbName - a String object.
        qualifierId - a String object.
        qualifierName - a String object.
        Returns:
        a Collection object.
      • collectFirstIdentifierWithDatabase

        public static Xref collectFirstIdentifierWithDatabase​(Collection<? extends Xref> refs,
                                                              String dbId,
                                                              String dbName)
        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
        Parameters:
        refs - : the collection of Xrefs
        dbId - : the database id to look for
        dbName - : the database name to look for
        Returns:
        the first identifier having this database name/id, null if no Xrefs with this database name/id
      • removeAllXrefsWithDatabase

        public static void removeAllXrefsWithDatabase​(Collection<? extends Xref> refs,
                                                      String dbId,
                                                      String dbName)
        Remove all Xrefs having this database name/database id from the collection of xrefs
        Parameters:
        refs - : the collection of Xrefs
        dbId - : the database id to look for
        dbName - : the database name to look for
      • collectFirstIdentifierWithDatabaseAndId

        public static Xref collectFirstIdentifierWithDatabaseAndId​(Collection<? extends Xref> refs,
                                                                   String dbId,
                                                                   String dbName,
                                                                   String id)
        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
        Parameters:
        refs - : the collection of Xrefs
        dbId - : the database id to look for
        dbName - : the database name to look for
        id - a String object.
        Returns:
        the first identifier having this database name/id, null if no Xrefs with this database name/id
      • removeAllXrefsWithDatabaseAndId

        public static void removeAllXrefsWithDatabaseAndId​(Collection<? extends Xref> refs,
                                                           String dbId,
                                                           String dbName,
                                                           String id)
        Remove all Xrefs having this database name/database id from the collection of xrefs
        Parameters:
        refs - : the collection of Xrefs
        dbId - : the database id to look for
        dbName - : the database name to look for
        id - a String object.
      • createXref

        public static Xref createXref​(String databaseName,
                                      String databaseMi,
                                      String id)

        createXref

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createXref

        public static Xref createXref​(String databaseName,
                                      String id)

        createXref

        Parameters:
        databaseName - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createXrefWithQualifier

        public static Xref createXrefWithQualifier​(String databaseName,
                                                   String databaseMi,
                                                   String id,
                                                   String version,
                                                   String qualifierName,
                                                   String qualifierMi)

        createXrefWithQualifierAndVersion

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        version - a String object.
        qualifierName - a String object.
        qualifierMi - a String object.
        Returns:
        a Xref object.
      • createXrefWithQualifier

        public static Xref createXrefWithQualifier​(String databaseName,
                                                   String databaseMi,
                                                   String id,
                                                   String qualifierName,
                                                   String qualifierMi)

        createXrefWithQualifier

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        qualifierName - a String object.
        qualifierMi - a String object.
        Returns:
        a Xref object.
      • createXrefWithQualifier

        public static Xref createXrefWithQualifier​(String databaseName,
                                                   String id,
                                                   String qualifierName)

        createXrefWithQualifier

        Parameters:
        databaseName - a String object.
        id - a String object.
        qualifierName - a String object.
        Returns:
        a Xref object.
      • createIdentityXref

        public static Xref createIdentityXref​(String databaseName,
                                              String databaseMi,
                                              String id)

        createIdentityXref

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createIdentityXref

        public static Xref createIdentityXref​(String databaseName,
                                              String id)

        createIdentityXref

        Parameters:
        databaseName - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createSecondaryXref

        public static Xref createSecondaryXref​(String databaseName,
                                               String databaseMi,
                                               String id)

        createSecondaryXref

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createSecondaryXref

        public static Xref createSecondaryXref​(String databaseName,
                                               String id)

        createSecondaryXref

        Parameters:
        databaseName - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createPrimaryXref

        public static Xref createPrimaryXref​(String databaseName,
                                             String databaseMi,
                                             String id)

        createPrimaryXref

        Parameters:
        databaseName - a String object.
        databaseMi - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createPrimaryXref

        public static Xref createPrimaryXref​(String databaseName,
                                             String id)

        createPrimaryXref

        Parameters:
        databaseName - a String object.
        id - a String object.
        Returns:
        a Xref object.
      • createUniprotIdentity

        public static Xref createUniprotIdentity​(String uniprot)

        createUniprotIdentity

        Parameters:
        uniprot - a String object.
        Returns:
        a Xref object.
      • createRefseqIdentity

        public static Xref createRefseqIdentity​(String refseq)

        createRefseqIdentity

        Parameters:
        refseq - a String object.
        Returns:
        a Xref object.
      • createEnsemblIdentity

        public static Xref createEnsemblIdentity​(String ensembl)

        createEnsemblIdentity

        Parameters:
        ensembl - a String object.
        Returns:
        a Xref object.
      • createEnsemblGenomesIdentity

        public static Xref createEnsemblGenomesIdentity​(String ensembl)

        createEnsemblGenomesIdentity

        Parameters:
        ensembl - a String object.
        Returns:
        a Xref object.
      • createEntrezGeneIdIdentity

        public static Xref createEntrezGeneIdIdentity​(String geneId)

        createEntrezGeneIdIdentity

        Parameters:
        geneId - a String object.
        Returns:
        a Xref object.
      • createDdbjEmblGenbankIdentity

        public static Xref createDdbjEmblGenbankIdentity​(String id)

        createDdbjEmblGenbankIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createChebiIdentity

        public static Xref createChebiIdentity​(String id)

        createChebiIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createPubmedIdentity

        public static Xref createPubmedIdentity​(String id)

        createPubmedIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createDoiIdentity

        public static Xref createDoiIdentity​(String id)

        createDoiIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createPsiMiIdentity

        public static Xref createPsiMiIdentity​(String id)

        createPsiMiIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createPsiModIdentity

        public static Xref createPsiModIdentity​(String id)

        createPsiModIdentity

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createUniprotSecondary

        public static Xref createUniprotSecondary​(String uniprot)

        createUniprotSecondary

        Parameters:
        uniprot - a String object.
        Returns:
        a Xref object.
      • createRefseqSecondary

        public static Xref createRefseqSecondary​(String refseq)

        createRefseqSecondary

        Parameters:
        refseq - a String object.
        Returns:
        a Xref object.
      • createEnsemblSecondary

        public static Xref createEnsemblSecondary​(String ensembl)

        createEnsemblSecondary

        Parameters:
        ensembl - a String object.
        Returns:
        a Xref object.
      • createEnsemblGenomesSecondary

        public static Xref createEnsemblGenomesSecondary​(String ensembl)

        createEnsemblGenomesSecondary

        Parameters:
        ensembl - a String object.
        Returns:
        a Xref object.
      • createEntrezGeneIdSecondary

        public static Xref createEntrezGeneIdSecondary​(String geneId)

        createEntrezGeneIdSecondary

        Parameters:
        geneId - a String object.
        Returns:
        a Xref object.
      • createDdbjEmblGenbankSecondary

        public static Xref createDdbjEmblGenbankSecondary​(String id)

        createDdbjEmblGenbankSecondary

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createChebiSecondary

        public static Xref createChebiSecondary​(String id)

        createChebiSecondary

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createPsiMiSecondary

        public static Xref createPsiMiSecondary​(String id)

        createPsiMiSecondary

        Parameters:
        id - a String object.
        Returns:
        a Xref object.
      • createPsiModSecondary

        public static Xref createPsiModSecondary​(String id)

        createPsiModSecondary

        Parameters:
        id - a String object.
        Returns:
        a Xref object.