Skip to main content

utilities for working with the NIF ontology, SciGraph, and turtle

Project description

pyontutils

PyPI version Build Status Coverage Status

python utilities for working with ontologies

Requirements

This repo requires PyPy3 or >=Python3.6. See and setup.py and Pipfile for additional requirements. ontload requires Java8 and >=maven3.3 in order to build SciGraph. parcellation.py requires FSL to be installed or you need to obtain the atlases in some other way. In order to build the packages required by this repo you will need gcc (and toolchain) installed and will need to have the development packages for libxml installed. To build the development dependencies you will also need the development packages for postgresql, and protobuf installed on your system. Building the documentation for the ontology requires pandoc and emacs along with orgstrap. See .travis.yml for an example of how to bootstrap a working dev environment.

Installation

The easiest way to install pyontutils is to use pipenv. It makes it easy to manage specific version of packages needed by pyontutils. For example in order to get good (deterministic) ttl serialization from these tools you need to use my modified version of rdflib (see https://github.com/RDFLib/rdflib/pull/649). Pipenv makes it easier to accomplish this.

  1. In your preferred folder git clone https://github.com/tgbugs/pyontutils.git
  2. cd pyontutils
  3. pipenv install --skip-lock. If you want to use pypy3 run pipenv --python pypy3 install --skip-lock
  4. pipenv shell to enter the virtual environment where everything should work.

Development Installation

Note that the optional development packages are not actually required and if you have installation issues development can proceed normally without them, some database queries will just be slower because they use a pure python mysql connector.

If you are installing a development setup note that mysql-connector (aka mysql-connector-python) often cannot find the files it needs to build. When installing pass them in as environment variables (you may need to adjust exact paths for your system). MYSQLXPB_PROTOBUF_INCLUDE_DIR=/usr/include/google/protobuf MYSQLXPB_PROTOBUF_LIB_DIR=/usr/lib64 MYSQLXPB_PROTOC=/usr/bin/protoc pipenv install --skip-lock. There are some systems on which even this is not sufficient. If you encounter this situation add mysql-connector = "==2.1.6" to [dev-packages] in the Pipfile. And then run the command without environment variables.

Alternately, if you manage your packages via another system you can create a development setup by adding this folder to your PYTHONPATH environment variable using export PYTHONPATH=PYTHONPATH:"$(pwd)" from the location of this readme. If you use a development setup you will need to create symlinks described below.

Utility Scripts

pyontutils provides a set of scripts that are useful for maintaining and managing ontologies using git, and making them available via SciGraph. Note that if you choose the development installation option you will need to ln -sT the scripts to your preferred bin folder. For the full list please see the documentation.

  1. ttlfmt Reserialize ontology files using deterministic turtle (spec).
  2. ontutils Various useful and frequently needed commands for ontology processes as well as less frequent refactorings.
  3. ontload Load an ontology managed by git into SciGraph for easy deployment of services.
  4. qnamefix Set qnames based on the curies defined for a given ontology.
  5. necromancy Find dead ids in an ontology and raise them to be owl:Classes again.
  6. scigraph-codegen Generate a rest client against a SciGraph services endpoint.
  7. scig Run queries against a SciGraph endpoint from the command line.
  8. ilxcli Given an ontlogy file with temporary identifiers, get persistent, resolvable identifers for them from InterLex.
  9. graphml_to_ttl Convert yEd graphml files to ttl.
  10. ontree Run a webserver to query and view hierarchies from the ontology.

NIF-Ontology

Many of these scripts are written for working on the NIF standard ontology found here.

SciGraph

scigraph.py is code geneator for creating a python client library against a SciGraph REST endpoint. scigraph_client.py is the client library generated against the nif development scigraph instance. ontload can be used to load your ontology into SciGraph for local use.

Neuron Types

If you have found your way to this repository because you are interested in using neuron-lang for describing neuron types please see this wiki page. To get started all you need to do is follow the installation instructions above and then include from pyontutils.neuron_lang import * in your import statements. Please see the documentation for how to set up neuron-lang for jupyter notebooks and take a look at some examples of how to use neuron-lang to create new neurons.

Project details


Download files

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

Source Distribution

pyontutils-0.0.3.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

pyontutils-0.0.3-py2.py3-none-any.whl (144.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyontutils-0.0.3.tar.gz.

File metadata

  • Download URL: pyontutils-0.0.3.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.6

File hashes

Hashes for pyontutils-0.0.3.tar.gz
Algorithm Hash digest
SHA256 4e8b2501c2ef0472a96a802155fc194f17fd5d604a3b15a3706baaa83df05374
MD5 fbfc306f5999655f067423e82e1259d5
BLAKE2b-256 e39f32695a202f4a9a6a697ccefb6a59eafa515b675d8556bd8a57cddce12633

See more details on using hashes here.

File details

Details for the file pyontutils-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: pyontutils-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 144.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.6

File hashes

Hashes for pyontutils-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 02c0aff3c789afe2063c815dccd5f0a3d09b98eb1215b294b0bbd590ceeb3eb7
MD5 369700642b864f54762ae3a2a81c3930
BLAKE2b-256 63c594583318a9fc09ad570be9c360674e03b50073df337b2d1cfe988113c8d6

See more details on using hashes here.

Supported by

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