API Reference

A Python frontend to ontologies.

pronto is a Python agnostic library designed to work with ontologies. At the moment, it can parse ontologies in the OBO, OBO Graphs or OWL in RDF/XML format, on either the local host or from an network location, and export ontologies to OBO or OBO Graphs (in JSON format).

Caution

Only classes and modules reachable from the top-level package pronto are considered public and are guaranteed stable over Semantic Versioning. Use submodules (other than warnings) at your own risk!

Note

pronto implements proper type checking for most of the methods and properties exposed in the public classes. This reproduces the behaviour of the Python standard library, to avoid common errors. This feature does however increase overhead, but can be disabled by executing Python in optimized mode (with the -O flag). Parsing performances are not affected.

See also

Online documentation for this version of the library on Read The Docs

Ontology

An abstraction over a \(\mathcal{SHOIN}^\mathcal{(D)}\) ontology.

pronto.Ontology

An ontology storing terms and the relationships between them.

View Layer

The following classes are part of the view layer, and store references to the ontology/entity they were declared in for verification purposes. For instance, this let pronto check that a Synonym type can only be changed for a type declared in the Ontology header.

Because of this reason, none of these classes should be created manually, but obtained from methods of existing Ontology or Entity instances, such as Ontology.get_term to get a new Term.

pronto.Entity

An entity in the ontology graph.

pronto.Relationship

A relationship, constitute the edges of the ontology graph.

pronto.Synonym

A synonym for an entity, with respect to the OBO terminology.

pronto.Term

A term, corresponding to a node in the ontology graph.

pronto.TermSet

A specialized mutable set to store Term instances.

View Collections

The following classes are dedicated collections that are implemented to view a specific field of entities, such as relationships. These types cannot be instantiated directly, but are reachable through the right property on Entity instances.

pronto.entity.attributes.Relationships

A dedicated mutable mapping to manage the relationships of an entity.

Model Layer

The following classes are technically part of the data layer, but because they can be lightweight enough to be instantiated directly, they can also be passed to certain functions or properties of the view layer. Basically, these classes are not worth to implement following the view-model pattern so they can be accessed and mutated directly.

pronto.Metadata

A mapping containing metadata about the current ontology.

pronto.Definition

A human-readable text definition of an entity.

pronto.Subset

A definition of a subset in an ontology.

pronto.SynonymType

A user-defined synonym type.

pronto.LiteralPropertyValue

A property-value which adds a literal annotation to an entity.

pronto.ResourcePropertyValue

A property-value which adds a resource annotation to an entity.

pronto.Xref

A cross-reference to another document or resource.

Data Layer

The following classes are from the data layer, and store the data extracted from ontology files. There is probably no point in using them directly, with the exception of custom parser implementations.

pronto.RelationshipData

Internal data storage of Relationship information.

pronto.SynonymData

Internal data storage of Synonym information.

pronto.TermData

Internal data storage of Term information.

Warnings

pronto.warnings.ProntoWarning

The class for all warnings raised by pronto.

pronto.warnings.NotImplementedWarning

Some part of the code is yet to be implemented.

pronto.warnings.SyntaxWarning

The parsed document contains incomplete or unsound constructs.

pronto.warnings.UnstableWarning

The behaviour of the executed code might change in the future.