tyto

Subpackages

Submodules

Package Contents

Classes

Ontology

The Ontology class provides an abstraction layer for accessing ontologies, and a

URI

The URI class wraps the Python string primitive type, enabling the use of inference methods on the represented uniform resource identifier

Functions

configure_cache_size(maxsize=1000)

Set the size of the in-memory cache in order to optimize performance and frequency of queries over the network

Attributes

Ontobee

Endpoint instance representing Ontobee. Ontobee is the default linked data server for most OBO Foundry library ontologies, but is also been used for many non-OBO ontologies.

EBIOntologyLookupService

The Ontology Lookup Service (OLS) is a repository for biomedical ontologies that aims to provide a single point of access to the latest ontology versions. Hosted by the European Bioinformatics Institute

PubChemAPI

SBO

Ontology instance for Systems Biology Ontology

SO

Ontology instance for Sequence Ontology

NCIT

Ontology instance for National Cancer Institute Thesaurus

OM

Ontology instance for Ontology of Units of Measure

NCBITaxon

Ontology instance for NCBI Taxonomy

SBOL2

SBOL3

EDAM

EDAM (EMBRACE Data and Methods) is an ontology of common bioinformatics operations, topics, types of data including identifiers, and formats. EDAM comprises common concepts (shared within the bioinformatics community) that apply to semantic annotation of resources.

PubChem

class tyto.Ontology(path=None, endpoints=None, uri=None)

The Ontology class provides an abstraction layer for accessing ontologies, and a back-end query dispatcher for interfacing with RESTful services, SPARQL endpoints, or local triple stores.

Parameters
  • path (str, optional) – A path to a local ontology file, defaults to None

  • endpoints (list, optional) – A list of zero or more Endpoint objects that provide a query interface to an ontology resource, defaults to None

  • uri – The URI of the ontology

:type str

__getattr__(self, name)

Enables use of ontology terms as dynamic attributes, e.g., SO.promoter

_handler(self, method_name, exception, *args)

Dispatches queries through Endpoints

get_term_by_uri(self, uri)

Provides the ontology term (rdfs:label) associated with the given URI.

Parameters

uri (str) – A uniform resource identifier corresponding to an ontology term

Returns

A human-readable term or label that corresponds to the given identifier

Return type

string

get_uri_by_term(self, term)

Provides the URI associated with the given ontology term (rdfs:label). The __getattr__ and __getitem__ methods delegate to this method.

Parameters

term (str) – an ontology term

Returns

A human-readable term or label that corresponds to the given identifier

Return type

URI

_sanitize_uri(self, uri)

Some Ontology instances may override this method to translate a URI from purl to identifiers.org namespaces

_reverse_sanitize_uri(self, uri)

Some Ontology instances may override this method to reverse-translate a URI from identifiers.org back into purl namespace

_sanitize_term(self, term)

Some Ontology instances may override this method in order to convert a Pythonic representation of a label into a more human-readable representation, such as replacing underscores with spaces

_reverse_sanitize_term(self, term)

Some Ontology instances may override this method to undo the conversion done by _sanitize_term and return a Pythonic label from free text label

__getitem__(self, key)

Enables use of an ontology term as a subscript. This method is a useful alternative to dynamic attributes in case a term contains special characters

Returns

A uniform resource identifier associated with the provided term

Return type

URI

class tyto.URI

Bases: str

The URI class wraps the Python string primitive type, enabling the use of inference methods on the represented uniform resource identifier

Parameters
  • value (str) – A string value representing a uniform resource identifier

  • ontology (Ontology) – links a term to a particular Ontology instance

is_child_of(self, parent_uri: str)

Determine whether this URI is an immediate subclass or subtype of the argument URI

Parameters

parent_uri (str) – URI corresponding to the putative parent term

Return type

bool

is_parent_of(self, child_uri: str)

Determine whether this URI is an immediate superclass or supertype of the argument URI

Parameters

parent_uri (str) – URI corresponding to the putative parent term

Return type

bool

is_descendant_of(self, ancestor_uri: str)

Determine whether this URI is a taxonomic subcategory of the argument URI

Parameters

ancestor_uri (str) – URI corresponding to the putative ancestor

Return type

bool

is_ancestor_of(self, descendant_uri: str)

Determine whether this URI is a taxonomic superclass or supertype of the argument URI

Parameters

descendant_uri (str) – URI corresponding to the putative descendant

Return type

bool

is_subtype_of(self, supertype: str)

Alias of is_descendant_of. Determines whether this URI is a derivative subclass or subtype of the argument URI

Parameters

supertype (str) – URI corresponding to the putative supertype

Return type

bool

is_supertype_of(self, subtype: str)

Alias of is_ancestor_of. Determines whether this URI is a superclass or supertype of the argument URI

Parameters

subtype (str) – URI corresponding to the putative subtype

Return type

bool

is_a(self, term: URI)
get_parents(self)
get_children(self)
get_ancestors(self)
get_descendants(self)
tyto.configure_cache_size(maxsize=1000)

Set the size of the in-memory cache in order to optimize performance and frequency of queries over the network

Parameters

maxsize (int) – The maximum number of cached query results

tyto.Ontobee

Endpoint instance representing Ontobee. Ontobee is the default linked data server for most OBO Foundry library ontologies, but is also been used for many non-OBO ontologies.

tyto.EBIOntologyLookupService

The Ontology Lookup Service (OLS) is a repository for biomedical ontologies that aims to provide a single point of access to the latest ontology versions. Hosted by the European Bioinformatics Institute

tyto.PubChemAPI
tyto.SBO

Ontology instance for Systems Biology Ontology

tyto.SO

Ontology instance for Sequence Ontology

tyto.NCIT

Ontology instance for National Cancer Institute Thesaurus

tyto.OM

Ontology instance for Ontology of Units of Measure

tyto.NCBITaxon

Ontology instance for NCBI Taxonomy

tyto.SBOL2
tyto.SBOL3
tyto.EDAM

EDAM (EMBRACE Data and Methods) is an ontology of common bioinformatics operations, topics, types of data including identifiers, and formats. EDAM comprises common concepts (shared within the bioinformatics community) that apply to semantic annotation of resources.

tyto.PubChem