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 introduction to the general approach. 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.4.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pyontutils-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 cc8142f86890e092a1f9a047302fcf8640e1e2cc194083f80aa0de9c1a99ddfd
MD5 9be348b9c20253ceeb4fd47f3b35ab2b
BLAKE2b-256 1558f8411e1f570b981ef916af698e83cfa409fa3f818eaee25094e3e92ed19f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: pyontutils-0.0.4-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.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b290e5884b5ec7e10e2efc788681d00dea67a726380f826a31e73b694192443
MD5 ed4e18d27c9bc69a90da13bb5e1323be
BLAKE2b-256 49d613e43ffdc4f283175d41a998e69f5aa216df7273f3500bd8ad707ab2a1c8

See more details on using hashes here.

Provenance

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