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 DOI coverage

Overview

Pronto is a python module to parse, create, browse and export ontologies from some popular formats. For now, obo and owl/xml are available, 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

The class Ontology is likely the one you’ll use the most if all you want is to browse ontologies. It can be used to import ontologies in .owl (sometimes seen as .ont) and .obo formats, merge, and export ontologies to a rudimentary obo file.

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

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

Display an ontology in obo format and in json format:

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

Merge two ontologies:

import pronto
nmr = pronto.Ontology('https://raw.githubusercontent.com/nmrML/nmrML/'
                      'master/ontologies/nmrCV.owl')
ms  = pronto.Ontology('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.Ontology('path/to/file.obo')
for term in ont:
    if term.children:
        print(term)

Get grandchildrens of an ontology term:

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

TODO

  • 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

Reference

If you wish to use this library in a scientific publication, please cite it (see the Zenodo record).

Author: Martin Larralde

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 Distributions

pronto-0.3.2.zip (39.4 kB view details)

Uploaded Source

pronto-0.3.2.tar.gz (33.8 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.3.2-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file pronto-0.3.2.zip.

File metadata

  • Download URL: pronto-0.3.2.zip
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pronto-0.3.2.zip
Algorithm Hash digest
SHA256 524c4a376a9a679b29c93d3a9bb32295d4884010838154bbbf7d59b13e8bb884
MD5 ce5ab9f1e7fb6f2a7059fb1b0630d848
BLAKE2b-256 60b9b3ee3b2b617084abf5202296854864d5d865bd414b7c9af58b68a13cc00f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pronto-0.3.2.tar.gz
Algorithm Hash digest
SHA256 9acb92936ebec90568db9bb189570b286a74a196219cf81916b67ae711e8f6dd
MD5 11c254bdfbfd46189f95033fe7e8d3eb
BLAKE2b-256 0e50cde81a9545ff06d14b6414726b04aa9ad10fd487f1491f06f4ea8c812f8f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pronto-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 153043df84deb4569feacca83108fa927f6d0812eab4779097ffb31520ac0050
MD5 da54dfa1227dc06f4598b3d1e189ae8a
BLAKE2b-256 d76a33f2902c13b535c8a536fde0b3aeae69b6b855458f45c701f59ecb30326c

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