hpotk.annotations package

The hpotk.annotations module provides classes for working with HPO annotation data that is available for download from HPO release data.

The module contains data classes to model the annotation data. Most notable classes include HpoDiseases, a container of diseases, and HpoDisease a representation of the disease data.

The hpotk.annotations.load module contains code for loading the annotations into from HPO annotations format.

class hpotk.annotations.HpoDiseases[source]

Bases: AnnotatedItemContainer[HpoDiseaseAnnotation]

A container for HPO diseases that allows iteration over all diseases, knows about the number of diseases in the container, and supports retrieval of the disease by its identifier.

class hpotk.annotations.HpoDisease[source]

Bases: AnnotatedItem[HpoDiseaseAnnotation], Identified, Named

HpoDisease represents a computational model of a rare disease.

The model includes attributes:

  • identifier - disease ID, e.g. OMIM:256000

  • name - human-readable disease name, e.g. LEIGH SYNDROME; LS

  • annotations - the phenotype annotations of the disease. See AnnotatedItem for more details on all annotation-related methods

  • modes_of_inheritance - a collection of the modes of inheritance associated with the disease

abstract property modes_of_inheritance: Collection[TermId]

a collection of modes of inheritance associated with the disease.

Type:

return

class hpotk.annotations.HpoDiseaseAnnotation[source]

Bases: Identified, FrequencyAwareFeature

HpoDiseaseAnnotation models data of a single disease annotation.

The annotation has the following attributes:

  • identifier - annotation ID, e.g. HP:0001250

  • frequency-related attributes of the annotation, such as frequency (see FrequencyAwareFeature for more info)

  • references - a sequence of cross-references that support presence/absence of the annotation

  • modifiers - a sequence of clinical modifiers of the annotation, such as age of onset, severity, laterality, …

abstract property references: Sequence[AnnotationReference]

a list of annotation references that support presence/absence of the disease annotation

Type:

return

abstract property modifiers: Sequence[TermId]

a list of disease annotation modifiers

Type:

return

class hpotk.annotations.AnnotatedItem[source]

Bases: Generic[ANNOTATION]

An item that can be annotated with ontology terms. For instance, a disease can be annotated with phenotypic features, items from HPO ontology.

abstract property annotations: Collection[ANNOTATION]

a collection of ANNOTATION objects for the annotated item.

Type:

return

present_annotations() Iterable[ANNOTATION][source]
Returns:

an iterable over present annotations.

absent_annotations() Iterable[ANNOTATION][source]
Returns:

an iterable over absent annotations.

class hpotk.annotations.AnnotatedItemContainer[source]

Bases: Generic[ANNOTATED_ITEM], Iterable[ANNOTATED_ITEM], Sized, Versioned

Container for items that can be annotated with ontology terms.

For instance, if OMIM disease is an item type and phenotypic feature is the annotation type, then a corpus of OMIM diseases corresponds to a container of annotated items.

property items: Collection[ANNOTATED_ITEM]

an iterable over container items.

Type:

return

item_ids() Iterable[TermId][source]
Returns:

an iterable over all item identifiers.

class hpotk.annotations.EvidenceCode(value)[source]

Bases: Enum

An enumeration with evidence codes.

IEA = 1

Inferred from electronic evidence.

TAS = 2

Traceable author statement.

PCS = 3

Published clinical study.

static parse(value: str)[source]

Parse evidence code from str value.

Parameters:

value – a str with the evidence code.

Returns:

the parsed enum member or None if value is not valid EvidenceCode value.

class hpotk.annotations.Sex(value)[source]

Bases: Enum

An enum representing values of apparent biological sex.

Note

We do not attempt to model all contemporary complexities of the sex.

UNKNOWN = 1
MALE = 2
FEMALE = 3
static parse(value: str)[source]

Parse Sex from a str value.

Parameters:

value – a str with the sex code.

Returns:

the parsed enum member or None if value is not valid Sex value.

class hpotk.annotations.AnnotationReference(identifier: TermId, evidence_code: EvidenceCode)[source]

Bases: Identified

property identifier: TermId

Get the identifier.

property evidence_code: EvidenceCode
class hpotk.annotations.SimpleHpoDiseaseAnnotation(identifier: TermId, numerator: int, denominator: int, references: Sequence[AnnotationReference], modifiers: Sequence[TermId])[source]

Bases: HpoDiseaseAnnotation

property identifier: TermId

Get the identifier.

property numerator: int

Get the numerator, a non-negative int representing the count of annotated items where the annotation was present.

property denominator: int

Get the denominator, a positive int representing the total count of annotated items investigated for presence/absence of an annotation.

property references: Sequence[AnnotationReference]

a list of annotation references that support presence/absence of the disease annotation

Type:

return

property modifiers: Sequence[TermId]

a list of disease annotation modifiers

Type:

return

class hpotk.annotations.SimpleHpoDisease(identifier: TermId, name: str, annotations: Collection[HpoDiseaseAnnotation], modes_of_inheritance: Collection[TermId])[source]

Bases: HpoDisease

property identifier: TermId

Get the identifier.

property name: str

Get the label.

property annotations: Collection[HpoDiseaseAnnotation]

a collection of ANNOTATION objects for the annotated item.

Type:

return

property modes_of_inheritance: Collection[TermId]

a collection of modes of inheritance associated with the disease.

Type:

return

class hpotk.annotations.SimpleHpoDiseases(diseases: Iterable[HpoDisease], version: str | None = None)[source]

Bases: HpoDiseases

property items: Collection[ANNOTATED_ITEM]

an iterable over container items.

Type:

return

property diseases: Collection[HpoDisease]
property disease_ids
property version: str | None

Get a version str or None if the version is not available.

Subpackages