# pyontutils
[![PyPI version](https://badge.fury.io/py/pyontutils.svg)](https://pypi.org/project/pyontutils/)
[![Build Status](https://travis-ci.org/tgbugs/pyontutils.svg?branch=master)](https://travis-ci.org/tgbugs/pyontutils)
[![Coverage Status](https://coveralls.io/repos/github/tgbugs/pyontutils/badge.svg?branch=master)](https://coveralls.io/github/tgbugs/pyontutils?branch=master)
python utilities for working with ontologies
## Installation
`pyontutils` is slowly approaching stability. You can obtain it and other related
packages from pypi and install them as you see fit (e.g. `pip install --user pyontutils`).
If you need a bleeding edge version I reccomend installing it into your environment
(virtual or otherwise) using `pip install --user --editable .[dev,test]` run from
from your local copy of this repo.
## Configuration
`pyontutils` makes use of 3 configuration files:
1. [~/.config/pyontutils/config.yaml](${HOME}/.config/pyontutils/config.yaml).
This file can be used to augment the varibles defined in [auth-config.py](./pyontutils/auth-config.py).
For more details about the config see the [orthauth guide](https://github.com/tgbugs/orthauth/blob/master/docs/guide.org).
2. [secrets.yaml](${HOME}/.config/orthauth/secrets.yaml) that you can put wherever
you want by editing the `auth-stores: secrets: path:` entry in [config.yaml](${HOME}/.config/pyontutils/config.yaml).
The file mode needs to be set to `0600` so that only you can read and write it.
It is also advisable to place it inside a folder with a mode set to `0700` since
some editors do not preserve file modes. `orthauth` will fail loudly if this happens.
3. [./nifstd/scigraph/curie_map.yaml](./nifstd/scigraph/curie_map.yaml) or
[~/.config/pyontutils/curie_map.yaml](${HOME}/.config/pyontutils/curie_map.yaml)
if a `pyontutils` git repository is not found. `pyontutils` will retrieve the
latest version of this file from github on first run if it cannot find a local copy.
The full list of locations that are searched for `curie_map.yaml` are specified in
[auth-config.py](./pyontutils/auth-config.py).
If you are going to use the SciCrunch SciGraph production instance follow the
[instructions](https://github.com/SciCrunch/sparc-curation/blob/master/docs/setup.org#scigraph)
in the sparc curation setup guide to obtain an API key and put it in the right place.
In short you can set the key in your secrets file and specify the path to it in
[config.yaml](${HOME}/.config/pyontutils/config.yaml) under the =scigraph-api-key= variable.
Alternately you can set the key using the `SCICRUNCH_API_KEY` environment variable
(e.g., by running `export SCICRUNCH_API_KEY=$(cat path/to/my/apikey)`) or by whatever
means you prefer for managing your keys.
## Development Installation
From the directory that contains this readme run the following.
Refer to [.travis.yml](./.travis.yml) for full details.
```bash
for f in {librdflib,htmlfn,ttlser,.,neurondm,nifstd}; do pushd $f; pip install --user --pre --editable . ; popd; done
```
If you need even more information there is fairly exhaustive doccumentation
located in the sparc curation [setup doc](https://github.com/SciCrunch/sparc-curation/blob/master/docs/setup.org).
## 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](./nifstd/nifstd_tools/parcellation/__init__.py) requires [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/)
to be installed or you need to obtain the [atlases](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/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](https://github.com/tgbugs/orgstrap). See [.travis.yml](./.travis.yml)
for an example of how to bootstrap a working dev environment. Alternately see
[pyontutils-9999.ebuild](https://github.com/tgbugs/tgbugs-overlay/blob/master/dev-python/pyontutils/pyontutils-9999.ebuild) and
[nifstd-tools-9999.ebuild](https://github.com/tgbugs/tgbugs-overlay/blob/master/dev-python/nifstd-tools/nifstd-tools-9999.ebuild) in [tgbugs-overlay](https://github.com/tgbugs/tgbugs-overlay).
## 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](http://ontology.neuinfo.org/docs/docstrings.html).
1. [ttlfmt](./ttlser/ttlser/ttlfmt.py)
Reserialize ontology files using deterministic turtle ([spec](./ttlser/docs/ttlser.md)).
2. [ontutils](./pyontutils/ontutils.py)
Various useful and frequently needed commands for ontology processes as well as less frequent refactorings.
3. [ontload](./pyontutils/ontload.py)
Load an ontology managed by git into SciGraph for easy deployment of services.
4. [qnamefix](./pyontutils/qnamefix.py)
Set qnames based on the curies defined for a given ontology.
5. [necromancy](./pyontutils/necromancy.py)
Find dead ids in an ontology and raise them to be owl:Classes again.
6. [scigraph-codegen](./pyontutils/scigraph_codegen.py)
Generate a rest client against a SciGraph services endpoint.
7. [scig](./pyontutils/scig.py)
Run queries against a SciGraph endpoint from the command line.
9. [graphml_to_ttl](./pyontutils/graphml_to_ttl.py)
Convert yEd graphml files to ttl.
10. [ontree](./nifstd/nifstd_tools/ontree.py)
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](https://github.com/SciCrunch/NIF-Ontology/).
## SciGraph
[scigraph_codegen.py](./pyontutils/scigraph_codegen.py) is code geneator for creating a python client library against a
[SciGraph](https://github.com/SciGraph/SciGraph) REST endpoint.
[scigraph_client.py](./pyontutils/scigraph_client.py) is the client library generated against the nif development scigraph instance.
[ontload](./pyontutils/ontload.py) can be used to load your ontology into SciGraph for local use.
## Building releases
See [release.org](./docs/release.org).
Raw data
{
"_id": null,
"home_page": "https://github.com/tgbugs/pyontutils",
"name": "pyontutils",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "ontology scigraph rdflib turtle ttl OWL",
"author": "Tom Gillespie",
"author_email": "tgbugs@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/da/84/a1d64bb7b42fbfe03a9c5213f8c3f55defe6d7324e8c20745ed614a5720a/pyontutils-0.1.34.tar.gz",
"platform": null,
"description": "# pyontutils\n[![PyPI version](https://badge.fury.io/py/pyontutils.svg)](https://pypi.org/project/pyontutils/)\n[![Build Status](https://travis-ci.org/tgbugs/pyontutils.svg?branch=master)](https://travis-ci.org/tgbugs/pyontutils)\n[![Coverage Status](https://coveralls.io/repos/github/tgbugs/pyontutils/badge.svg?branch=master)](https://coveralls.io/github/tgbugs/pyontutils?branch=master)\n\npython utilities for working with ontologies\n\n## Installation\n`pyontutils` is slowly approaching stability. You can obtain it and other related\npackages from pypi and install them as you see fit (e.g. `pip install --user pyontutils`).\nIf you need a bleeding edge version I reccomend installing it into your environment\n(virtual or otherwise) using `pip install --user --editable .[dev,test]` run from\nfrom your local copy of this repo.\n\n## Configuration\n`pyontutils` makes use of 3 configuration files:\n1. [~/.config/pyontutils/config.yaml](${HOME}/.config/pyontutils/config.yaml).\nThis file can be used to augment the varibles defined in [auth-config.py](./pyontutils/auth-config.py).\nFor more details about the config see the [orthauth guide](https://github.com/tgbugs/orthauth/blob/master/docs/guide.org).\n2. [secrets.yaml](${HOME}/.config/orthauth/secrets.yaml) that you can put wherever\nyou want by editing the `auth-stores: secrets: path:` entry in [config.yaml](${HOME}/.config/pyontutils/config.yaml).\nThe file mode needs to be set to `0600` so that only you can read and write it.\nIt is also advisable to place it inside a folder with a mode set to `0700` since\nsome editors do not preserve file modes. `orthauth` will fail loudly if this happens.\n3. [./nifstd/scigraph/curie_map.yaml](./nifstd/scigraph/curie_map.yaml) or\n[~/.config/pyontutils/curie_map.yaml](${HOME}/.config/pyontutils/curie_map.yaml)\nif a `pyontutils` git repository is not found. `pyontutils` will retrieve the\nlatest version of this file from github on first run if it cannot find a local copy.\nThe full list of locations that are searched for `curie_map.yaml` are specified in\n[auth-config.py](./pyontutils/auth-config.py). \n\nIf you are going to use the SciCrunch SciGraph production instance follow the\n[instructions](https://github.com/SciCrunch/sparc-curation/blob/master/docs/setup.org#scigraph)\nin the sparc curation setup guide to obtain an API key and put it in the right place.\nIn short you can set the key in your secrets file and specify the path to it in\n[config.yaml](${HOME}/.config/pyontutils/config.yaml) under the =scigraph-api-key= variable.\nAlternately you can set the key using the `SCICRUNCH_API_KEY` environment variable\n(e.g., by running `export SCICRUNCH_API_KEY=$(cat path/to/my/apikey)`) or by whatever\nmeans you prefer for managing your keys.\n\n## Development Installation\nFrom the directory that contains this readme run the following.\nRefer to [.travis.yml](./.travis.yml) for full details.\n```bash\nfor f in {librdflib,htmlfn,ttlser,.,neurondm,nifstd}; do pushd $f; pip install --user --pre --editable . ; popd; done\n```\nIf you need even more information there is fairly exhaustive doccumentation\nlocated in the sparc curation [setup doc](https://github.com/SciCrunch/sparc-curation/blob/master/docs/setup.org).\n\n## Requirements\nThis repo requires PyPy3 or >=Python3.6.\nSee and setup.py and Pipfile for additional requirements.\n`ontload` requires Java8 and >=maven3.3 in order to build SciGraph.\n[parcellation](./nifstd/nifstd_tools/parcellation/__init__.py) requires [FSL](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/)\nto be installed or you need to obtain the [atlases](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Atlases) in\nsome other way. In order to build the packages required by this repo you will need\ngcc (and toolchain) installed and will need to have the development packages for\n`libxml` installed. To build the development dependencies you will also need the\ndevelopment packages for `postgresql`, and `protobuf` installed on your system.\nBuilding the documentation for the ontology requires `pandoc` and `emacs` along\nwith [orgstrap](https://github.com/tgbugs/orgstrap). See [.travis.yml](./.travis.yml)\nfor an example of how to bootstrap a working dev environment. Alternately see\n[pyontutils-9999.ebuild](https://github.com/tgbugs/tgbugs-overlay/blob/master/dev-python/pyontutils/pyontutils-9999.ebuild) and\n[nifstd-tools-9999.ebuild](https://github.com/tgbugs/tgbugs-overlay/blob/master/dev-python/nifstd-tools/nifstd-tools-9999.ebuild) in [tgbugs-overlay](https://github.com/tgbugs/tgbugs-overlay).\n\n## Utility Scripts\npyontutils provides a set of scripts that are useful for maintaining and managing ontologies\nusing git, and making them available via SciGraph. Note that if you choose the development\ninstallation option you will need to `ln -sT` the scripts to your preferred bin folder.\nFor the full list please see the [documentation](http://ontology.neuinfo.org/docs/docstrings.html).\n1. [ttlfmt](./ttlser/ttlser/ttlfmt.py)\n\tReserialize ontology files using deterministic turtle ([spec](./ttlser/docs/ttlser.md)).\n2. [ontutils](./pyontutils/ontutils.py)\n Various useful and frequently needed commands for ontology processes as well as less frequent refactorings.\n3. [ontload](./pyontutils/ontload.py)\n\tLoad an ontology managed by git into SciGraph for easy deployment of services.\n4. [qnamefix](./pyontutils/qnamefix.py)\n Set qnames based on the curies defined for a given ontology.\n5. [necromancy](./pyontutils/necromancy.py)\n Find dead ids in an ontology and raise them to be owl:Classes again.\n6. [scigraph-codegen](./pyontutils/scigraph_codegen.py)\n\tGenerate a rest client against a SciGraph services endpoint.\n7. [scig](./pyontutils/scig.py)\n\tRun queries against a SciGraph endpoint from the command line.\n9. [graphml_to_ttl](./pyontutils/graphml_to_ttl.py)\n\tConvert yEd graphml files to ttl.\n10. [ontree](./nifstd/nifstd_tools/ontree.py)\n\tRun a webserver to query and view hierarchies from the ontology.\n\n## NIF-Ontology\nMany of these scripts are written for working on the NIF standard ontology\nfound [here](https://github.com/SciCrunch/NIF-Ontology/).\n\n## SciGraph\n[scigraph_codegen.py](./pyontutils/scigraph_codegen.py) is code geneator for creating a python client library against a\n[SciGraph](https://github.com/SciGraph/SciGraph) REST endpoint.\n[scigraph_client.py](./pyontutils/scigraph_client.py) is the client library generated against the nif development scigraph instance.\n[ontload](./pyontutils/ontload.py) can be used to load your ontology into SciGraph for local use.\n\n## Building releases\nSee [release.org](./docs/release.org).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "utilities for working with the NIF ontology, SciGraph, and turtle",
"version": "0.1.34",
"project_urls": {
"Homepage": "https://github.com/tgbugs/pyontutils"
},
"split_keywords": [
"ontology",
"scigraph",
"rdflib",
"turtle",
"ttl",
"owl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6e518d11f6fa6617ec0cc484ffed01b8d7717437215362702f969791c195dee5",
"md5": "cbbf5f7ccd2f9e605b98143cbef9fb2a",
"sha256": "1d63a8c1fe3307283a31635831070300efddff46755d4f0648269a9c53e2b958"
},
"downloads": -1,
"filename": "pyontutils-0.1.34-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "cbbf5f7ccd2f9e605b98143cbef9fb2a",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 203839,
"upload_time": "2023-07-27T22:18:39",
"upload_time_iso_8601": "2023-07-27T22:18:39.452102Z",
"url": "https://files.pythonhosted.org/packages/6e/51/8d11f6fa6617ec0cc484ffed01b8d7717437215362702f969791c195dee5/pyontutils-0.1.34-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "da84a1d64bb7b42fbfe03a9c5213f8c3f55defe6d7324e8c20745ed614a5720a",
"md5": "56b8be543e6e725df5c1940548acc49e",
"sha256": "d1a6f8625eef7e5eced8762734d049e35184c93c0b941c2856ed223172e7556b"
},
"downloads": -1,
"filename": "pyontutils-0.1.34.tar.gz",
"has_sig": false,
"md5_digest": "56b8be543e6e725df5c1940548acc49e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 287647,
"upload_time": "2023-07-27T22:18:42",
"upload_time_iso_8601": "2023-07-27T22:18:42.719580Z",
"url": "https://files.pythonhosted.org/packages/da/84/a1d64bb7b42fbfe03a9c5213f8c3f55defe6d7324e8c20745ed614a5720a/pyontutils-0.1.34.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-27 22:18:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tgbugs",
"github_project": "pyontutils",
"travis_ci": true,
"coveralls": true,
"github_actions": false,
"lcname": "pyontutils"
}