python utilities for working with ontologies
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
protobuf installed on your system.
Building the documentation for the ontology requires
with orgstrap. See .travis.yml
for an example of how to bootstrap a working dev environment.
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.
- In your preferred folder
git clone https://github.com/tgbugs/pyontutils.git
pipenv install --skip-lock. If you want to use pypy3 run
pipenv --python pypy3 install --skip-lock
pipenv shellto enter the virtual environment where everything should work.
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
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
export PYTHONPATH=PYTHONPATH:"$(pwd)" from the location of this readme.
If you use a development setup you will need to create symlinks described below.
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.
- ttlfmt Reserialize ontology files using deterministic turtle (spec).
- ontutils Various useful and frequently needed commands for ontology processes as well as less frequent refactorings.
- ontload Load an ontology managed by git into SciGraph for easy deployment of services.
- qnamefix Set qnames based on the curies defined for a given ontology.
- necromancy Find dead ids in an ontology and raise them to be owl:Classes again.
- scigraph-codegen Generate a rest client against a SciGraph services endpoint.
- scig Run queries against a SciGraph endpoint from the command line.
- ilxcli Given an ontlogy file with temporary identifiers, get persistent, resolvable identifers for them from InterLex.
- graphml_to_ttl Convert yEd graphml files to ttl.
- ontree Run a webserver to query and view hierarchies from the ontology.
Many of these scripts are written for working on the NIF standard ontology found here.
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.
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.