Term

class Term(reference, definition=None, relationships=<factory>, _axioms=<factory>, properties=<factory>, parents=<factory>, intersection_of=<factory>, union_of=<factory>, equivalent_to=<factory>, disjoint_from=<factory>, synonyms=<factory>, xrefs=<factory>, namespace=None, is_obsolete=None, type='Term', builtin=None, is_anonymous=None, subsets=<factory>)[source]

Bases: Stanza

A term in OBO.

Attributes Summary

builtin

definition

A description of the entity

disjoint_from

equivalent_to

intersection_of

is_anonymous

is_obsolete

An annotation for obsolescence.

namespace

The sub-namespace within the ontology

parents

Relationships with the default "is_a"

properties

reference

The primary reference for the entity

relationships

Object properties

subsets

synonyms

Synonyms of this term

type

union_of

xrefs

Database cross-references, see get_mappings() for access to all mappings in an SSSOM-like interface

Methods Summary

append_broad_match(reference, *[, ...])

Append a broad match, also adding an xref.

append_exact_match(reference, *[, ...])

Append an exact match, also adding a cross-reference.

append_narrow_match(reference, *[, ...])

Append a narrow match, also adding an xref.

append_related_match(reference, *[, ...])

Append a related match, also adding an xref.

append_see_also_uri(uri)

Add a see also property.

default(prefix, identifier[, name])

Create a default term.

extend_parents(references)

Add a collection of parents to this entity.

extend_relationship(typedef, references)

Append several relationships.

from_triple(prefix, identifier[, name, ...])

Create a term from a reference.

get_property(prop)

Get a single property of the given key.

get_property_literals(prop)

Get properties from the given key.

get_species()

Get the species if it exists.

iterate_obo_lines(*, ontology_prefix, typedefs)

Iterate over the lines to write in an OBO file.

set_species(identifier[, name])

Append the from_species relation.

Attributes Documentation

Parameters:
  • reference (Reference)

  • definition (str | None)

  • relationships (RelationsHint)

  • _axioms (AnnotationsDict)

  • properties (PropertiesHint)

  • parents (list[Reference])

  • intersection_of (IntersectionOfHint)

  • union_of (UnionOfHint)

  • equivalent_to (list[Reference])

  • disjoint_from (list[Reference])

  • synonyms (list[Synonym])

  • xrefs (list[Reference])

  • namespace (str | None)

  • is_obsolete (bool | None)

  • type (StanzaType)

  • builtin (bool | None)

  • is_anonymous (bool | None)

  • subsets (list[Reference])

builtin: bool | None = None
definition: str | None = None

A description of the entity

disjoint_from: list[Reference] = <dataclasses._MISSING_TYPE object>
equivalent_to: list[Reference] = <dataclasses._MISSING_TYPE object>
intersection_of: IntersectionOfHint = <dataclasses._MISSING_TYPE object>
is_anonymous: bool | None = None
is_obsolete: bool | None = None

An annotation for obsolescence. By default, is None, but this means that it is not obsolete.

namespace: str | None = None

The sub-namespace within the ontology

parents: list[Reference] = <dataclasses._MISSING_TYPE object>

Relationships with the default “is_a”

properties: PropertiesHint = <dataclasses._MISSING_TYPE object>
reference: Reference = <dataclasses._MISSING_TYPE object>

The primary reference for the entity

relationships: RelationsHint = <dataclasses._MISSING_TYPE object>

Object properties

subsets: list[Reference] = <dataclasses._MISSING_TYPE object>
synonyms: list[Synonym] = <dataclasses._MISSING_TYPE object>

Synonyms of this term

type: StanzaType = 'Term'
union_of: UnionOfHint = <dataclasses._MISSING_TYPE object>
xrefs: list[Reference] = <dataclasses._MISSING_TYPE object>

Database cross-references, see get_mappings() for access to all mappings in an SSSOM-like interface

Methods Documentation

append_broad_match(reference, *, mapping_justification=None, confidence=None, contributor=None)[source]

Append a broad match, also adding an xref.

Parameters:
  • reference (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

  • mapping_justification (NormalizedNamableReference | None)

  • confidence (float | None)

  • contributor (NormalizedNamableReference | None)

Return type:

Self

append_exact_match(reference, *, mapping_justification=None, confidence=None, contributor=None)[source]

Append an exact match, also adding a cross-reference.

Parameters:
  • reference (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

  • mapping_justification (NormalizedNamableReference | None)

  • confidence (float | None)

  • contributor (NormalizedNamableReference | None)

Return type:

Self

append_narrow_match(reference, *, mapping_justification=None, confidence=None, contributor=None)[source]

Append a narrow match, also adding an xref.

Parameters:
  • reference (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

  • mapping_justification (NormalizedNamableReference | None)

  • confidence (float | None)

  • contributor (NormalizedNamableReference | None)

Return type:

Self

Append a related match, also adding an xref.

Parameters:
  • reference (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

  • mapping_justification (NormalizedNamableReference | None)

  • confidence (float | None)

  • contributor (NormalizedNamableReference | None)

Return type:

Self

append_see_also_uri(uri)[source]

Add a see also property.

Parameters:

uri (str)

Return type:

Self

classmethod default(prefix, identifier, name=None)[source]

Create a default term.

Parameters:
  • prefix (str)

  • identifier (str)

  • name (str | None)

Return type:

Self

extend_parents(references)[source]

Add a collection of parents to this entity.

Parameters:

references (Collection[NormalizedNamableReference])

Return type:

None

extend_relationship(typedef, references)[source]

Append several relationships.

Parameters:
  • typedef (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

  • references (Iterable[NormalizedNamableReference])

Return type:

None

classmethod from_triple(prefix, identifier, name=None, definition=None, **kwargs)[source]

Create a term from a reference.

Parameters:
  • prefix (str)

  • identifier (str)

  • name (str | None)

  • definition (str | None)

  • kwargs (Any)

Return type:

Term

get_property(prop)[source]

Get a single property of the given key.

Parameters:

prop (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

Return type:

str | None

get_property_literals(prop)[source]

Get properties from the given key.

Parameters:

prop (NormalizedNamableReference | Referenced | Reference | NamedReference | tuple[str, str] | str)

Return type:

list[str]

get_species(prefix: str = 'ncbitaxon', *, strict: Literal[True] = False) NormalizedNamableReference[source]
get_species(prefix: str = 'ncbitaxon', *, strict: Literal[False] = False) NormalizedNamableReference | None

Get the species if it exists.

Parameters:
  • prefix – The prefix to use in case the term has several species annotations.

  • strict – If true, raises when no species reference is available

Returns:

A species reference, if available

iterate_obo_lines(*, ontology_prefix, typedefs, synonym_typedefs=None, emit_object_properties=True, emit_annotation_properties=True)[source]

Iterate over the lines to write in an OBO file.

Parameters:
Return type:

Iterable[str]

set_species(identifier, name=None)[source]

Append the from_species relation.

Parameters:
  • identifier (str)

  • name (str | None)

Return type:

Self