Pronto / OBO Files Adapter

About

Initialization

Pronto will automatically be used for obo format files and obo json files. Currently it will also be used for RDF/XML files but this is not guaranteed in future.

To ensure use of pronto when specifying a selector, use the pronto schema:

runoak -i pronto:path/to/file.obo COMMAND [COMMAND-OPTIONS]

Code

class oaklib.implementations.pronto.pronto_implementation.ProntoImplementation(resource: ~oaklib.resource.OntologyResource = None, strict: bool = False, _multilingual: bool = None, autosave: bool = <factory>, exclude_owl_top_and_bottom: bool = <factory>, ontology_metamodel_mapper: ~oaklib.mappers.ontology_metadata_mapper.OntologyMetadataMapper | None = None, _converter: ~curies.api.Converter | None = None, auto_relax_axioms: bool = None, cache_lookups: bool = False, property_cache: ~oaklib.utilities.keyval_cache.KeyValCache = <factory>, _edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None, _entailed_edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None, functional_writer: <module 'funowl.writers.FunctionalWriter' from '/home/runner/.cache/pypoetry/virtualenvs/oaklib-5bvmowLS-py3.9/lib/python3.9/site-packages/funowl/writers/FunctionalWriter.py'> = None, _association_index: ~oaklib.utilities.associations.association_index.AssociationIndex = None, normalizers: ~typing.List[~oaklib.interfaces.association_provider_interface.EntityNormalizer] = <factory>, wrapped_ontology: ~pronto.ontology.Ontology = None, _relationship_index_cache: ~typing.Dict[str, ~typing.List[~typing.Tuple[str, str, str]]] = None, _alt_id_to_replacement_map: ~typing.Dict[str, ~typing.List[str]] = None, **_kwargs)[source]

An adapter that standardizes access to OBO Format files by wrapping the Pronto library.

Pronto is a high-performance parsing library for parsing obo format 1.4 and other formats.

Input Selector

This adapter uses the pronto: Input Selector; e.g.

  • pronto:path/to/my/file

  • pronto:https://example.com/my/file

  • ``prontolib:go`

Examples

>>> from oaklib.implementations import ProntoImplementation
>>> resource = OntologyResource(slug='go-nucleus.obo', directory='tests/input', local=True)
>>> adapter = ProntoImplementation(resource)

Or use a selector:

>>> from oaklib import get_adapter
>>> adapter = get_adapter("pronto:tests/input/go-nucleus.obo")

Then you can use any of the methods implemented by pronto

>>> rels = adapter.relationships(['GO:0005773'])
>>> for _s, p, o in rels:
...    print(f'  {p} {o} ! {adapter.label(o)}')
rdfs:subClassOf GO:0043231 ! intracellular membrane-bounded organelle
BFO:0000050 GO:0005737 ! cytoplasm

Warning

pronto uses the fastobo library for loading ontologies. This follows a strict interpretation of obo format, and some ontologies may fail to load. In these cases, consider an alternative implementation

Alternatives:

  • use the Simple OBO Adapter

  • convert to an OWL representation using ROBOT

  • convert to a JSON representation using ROBOT and use obograph_implementation