Package org.bridgedb
Class Xref
- java.lang.Object
-
- org.bridgedb.Xref
-
- All Implemented Interfaces:
Comparable<Xref>
public class Xref extends Object implements Comparable<Xref>
Stores an id +DataSourcecombination, which represents an unique gene product.Immutable class, thread safe
-
-
Constructor Summary
Constructors Constructor Description Xref(String id, DataSource ds)Xref(String id, DataSource ds, boolean isPrimary)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Xref idc)Compares two Xrefs, asciibetically using string representation.booleanequals(Object o)static XreffromCompactIdentifier(String compact)This method will convert a compact identifier to an Xrefstatic XreffromMiriamUrn(String urn)This method will convert a known Miriam Urn to an XrefStringgetCompactidentifier()Uses DataSource.getCompactidentifier() to create a compact identifier, such as uniprot:P12345.DataSourcegetDataSource()StringgetId()StringgetKnownUrl()Uses DataSource.getKnownUrl to create a valid URL for an online webpage describing this entity.StringgetMiriamURN()Uses DataSource.getMiriamURN() to create a global identifier, such as urn:miriam:uniprot:P12345.inthashCode()hashCode calculated from id and datasource combined.booleanisPrimary()StringtoString()
-
-
-
Constructor Detail
-
Xref
public Xref(String id, DataSource ds)
- Parameters:
id- the Id part of this Xrefds- the DataSource part of this Xref.
-
Xref
public Xref(String id, DataSource ds, boolean isPrimary)
- Parameters:
id- the Id part of this Xrefds- 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()
-
hashCode
public int hashCode()
hashCode calculated from id and datasource combined.
-
equals
public boolean equals(Object o)
-
compareTo
public int compareTo(Xref idc)
Compares two Xrefs, asciibetically using string representation.- Specified by:
compareToin interfaceComparable<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
-
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
-
-