Package org.bridgedb

Class Xref

    • Constructor Detail

      • Xref

        public Xref​(String id,
                    DataSource ds)
        Parameters:
        id - the Id part of this Xref
        ds - the DataSource part of this Xref.
      • Xref

        public Xref​(String id,
                    DataSource ds,
                    boolean isPrimary)
        Parameters:
        id - the Id part of this Xref
        ds - the DataSource part of this Xref.
        isPrimary - represents whether the id is primary or not
    • Method Detail

      • getDataSource

        public DataSource getDataSource()
        Returns:
        the DataSource part of this Xref
      • getId

        public String getId()
        Returns:
        the id part of this Xref
      • isPrimary

        public boolean isPrimary()
        Returns:
        whether is id is primary or not
      • toString

        public String toString()
        This string representation is not meant to be stored or parsed, it is there mostly for debugging purposes.
        Overrides:
        toString in class Object
        Returns:
        short string representation for this Xref, for example En:ENSG000001:T or X:1004_at:F
      • hashCode

        public int hashCode()
        hashCode calculated from id and datasource combined.
        Overrides:
        hashCode in class Object
        Returns:
        the hashCode
      • equals

        public boolean equals​(Object o)
        Overrides:
        equals in class Object
        Parameters:
        o - Object to compare to
        Returns:
        true if both the id and the datasource are equal.
      • compareTo

        public int compareTo​(Xref idc)
        Compares two Xrefs, asciibetically using string representation.
        Specified by:
        compareTo in interface Comparable<Xref>
        Parameters:
        idc - Xref to compare to
        Returns:
        0 if equal, positive number if higher, negative number if lower.
      • getKnownUrl

        public String getKnownUrl()
        Uses DataSource.getKnownUrl to create a valid URL for an online webpage describing this entity.
        Returns:
        url as a String, or null if no UriPattern is known.
        Since:
        Version 2.0.0
      • getMiriamURN

        public String getMiriamURN()
        Uses DataSource.getMiriamURN() to create a global identifier, such as urn:miriam:uniprot:P12345.
        Returns:
        the URN as string or null if no valid Miriam urn is known
        Since:
        Version 2.0.0
      • getBioregistryIdentifier

        public String getBioregistryIdentifier()
        Uses DataSource.getCompactidentifier() to create a compact identifier, such as uniprot:P12345.
        Returns:
        the compact identifier as string or null if no valid Bioregistry.io prefix is known
        Since:
        Version 3.0.0
      • getCompactidentifier

        public String getCompactidentifier()
        Uses DataSource.getCompactidentifier() to create a compact identifier, such as uniprot:P12345.
        Returns:
        the compact identifier as string or null if no valid Miriam namespace is known
        Since:
        Version 3.0.0
      • fromMiriamUrn

        public static Xref fromMiriamUrn​(String urn)
        This method will convert a known Miriam Urn to an Xref
        Parameters:
        urn -
        Returns:
        A Xref or null if the urn is not in Miriam Format or
        Since:
        Version 2.0.0
      • fromCompactIdentifier

        public static Xref fromCompactIdentifier​(String compact)
        This method will convert a compact identifier to an Xref.
        Parameters:
        compact - a compact identifier
        Returns:
        A Xref or null if the urn is not in a compact identifier
        Since:
        Version 3.0.0
      • fromBioregistryIdentifier

        public static Xref fromBioregistryIdentifier​(String compact)
        This method will convert a Bioregistry.io identifier to an Xref.
        Parameters:
        compact - a Bioregistry.io compact identifier
        Returns:
        A Xref or null if the urn is not in a compact identifier
        Since:
        Version 3.0.14