Skip to main content

Python frontend to ontologies - a library to parse, create, browse and export ontologies.

Project description

Version Py versions Build Status Dev repo Codacy Grade License

Overview

Pronto is a python module to parse, create, browse and export ontologies from some popular formats. For now, obo and owl/xml were added, but more formats are to be added in the future (you can even add your own to work with the current API).

Installation

Installing with pip is the easiest:

pip install pronto          # if you have the admin rights
pip install pronto --user   # if you want to install it for only one user

If for some reason you do not like pip, you can also clone the repository and install it with the setup script (still requires setuptools):

git clone https://github.com/althonos/pronto
cd pronto
python3 setup.py install    # may also require admin rights

Usage

Currently there are 2 classes which both inherit from Ontology: Obo and OwlXML. To parse the right kind of file you have to use the right class, although that will probably change to the future to provide an unique Ontology class. Right now though you can still use the Ontology class as a base to merge other ontologies into.

Instantiate an obo ontology and getting a term by accession number:

import pronto
ont = pronto.Obo('path/to/file.obo')
term = ont['REF:ACCESSION']

Display an ontology in obo format and in json format:

import pronto
ont = pronto.OwlXML('https://net.path.should/work/too.owl')
print(ont.obo)
print(ont.json)

Merge two ontologies:

import pronto
nmr = pronto.OwlXML('https://raw.githubusercontent.com/nmrML/nmrML/'
                    'master/ontologies/nmrCV.owl')
ms  =    pronto.Obo('http://psidev.cvs.sourceforge.net/viewvc/psidev/psi'
                    '/psi-ms/mzML/controlledVocabulary/psi-ms.obo')

ms.merge(nmr) # MS ontology keeps its metadata but now contains NMR terms
              # as well.

assert('NMR:1000004' in ms)

Explore every term of an ontology and print those with children:

import pronto
ont = pronto.Obo('path/to/file.obo')
for term in ont:
    if term.children:
        print(term)

Get grandchildrens of an ontology term:

import pronto
ont = pronto.Obo('path/to/file.obo')
print(ont['RF:XXXXXXX'].children.children)

TODO

  • redefine OwlXML and Obo as Parsers in pronto.parser, and always use Ontology to open an ontology file.

  • properly define Import Warnings whenever an import fails.

  • write a proper documentation

  • create a proper relationship class

  • test with many different ontologies

  • extract data from OwlXML where attributes are ontologic terms

  • extract metadatas from OwlXML

  • add other owl serialized formats

  • (maybe) add serialization to owl

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pronto-0.1.12.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pronto-0.1.12-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file pronto-0.1.12.tar.gz.

File metadata

  • Download URL: pronto-0.1.12.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pronto-0.1.12.tar.gz
Algorithm Hash digest
SHA256 f361bfcfe9d089bb6250c541b50ff9d088ca9aaf87f593cb843fb114b2402f9e
MD5 237c2fc553f622f77fa9a19b586edb06
BLAKE2b-256 ad04393b20881aa40a2aeca38ab3ea71c30b5756f13c50b0e729ea793c4c89ac

See more details on using hashes here.

File details

Details for the file pronto-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for pronto-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 388b1d2935f3591d0f1c70d2d679cc26b3b930195b3cef0583cb7b26e9d3ab01
MD5 6f1921f226d266baa3a189c3c1ac2ef6
BLAKE2b-256 362118141ca17a5b2e64dc4efce219470b7ca9db1fc9a2d630f3d4c100491454

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page