# Xref¶

class pronto.Xref[source]

A cross-reference to another document or resource.

Cross-references (xrefs for short) can be used to back-up definitions of entities, synonyms, or to link ontological entities to other resources they may have been derived from. Although originally intended to provide links to databases, cross-references in OBO ontologies gained additional purposes, such as helping for header macros expansion, or being used to alias external relationships with local unprefixed IDs.

The OBO format version 1.4 expects references to be proper OBO identifiers that can be translated to actual IRIs, which is a breaking change from the previous format. Therefore, cross-references are encouraged to be given as plain IRIs or as prefixed IDs using an ID from the IDspace mapping defined in the header.

Example

A cross-reference in the Mammalian Phenotype ontology linking a term to some related Web resource:

>>> mp = pronto.Ontology.from_obo_library("mp.obo")
>>> mp["MP:0030151"].name
'abnormal buccinator muscle morphology'
>>> mp["MP:0030151"].xrefs
frozenset({Xref('https://en.wikipedia.org/wiki/Buccinator_muscle')})


Caution

Xref instances compare only using their identifiers; this means it is not possible to have several cross-references with the same identifier and different descriptions in the same set.

Todo

Make sure to resolve header macros for xrefs expansion (such as treat-xrefs-as-is_a) when creating an ontology, or provide a method on Ontology doing so when called.

__eq__(other: object) → bool[source]

Return self==value.

__gt__(other: object) → bool[source]

Return self>value.

__ge__(other: object) → bool[source]

Return self>=value.

__lt__(other: object) → bool[source]

Return self<value.

__le__(other: object) → bool[source]

Return self<=value.

__repr__()

A roundtripping implementation for repr. Computed by @roundrepr.

__hash__()[source]

Return hash(self).