Skip to main content

a framework querying ontology terms

Project description

ontquery

PyPI version Build Status

a framework querying ontology terms

SciCrunch api key

If you don't have your own SciGraph instance you will need a SciCunch API key in order to run the demos (e.g. python __init__.py).

To do this go to SciCrunch and register for an account and then get an api key.

You can then set the SCICRUNCH_API_KEY environment variable. For example in bash export SCICRUNCH_API_KEY=my-api-key.

See https://github.com/tgbugs/ontquery/blob/db8cad7463704bce9010651c3744452aa5370114/ontquery/__init__.py#L557-L558 for how to pass the key in.

Usage

from ontquery import OntQuery, SciGraphRemote, OntTerm, OntCuries

import os
from pyontutils.core import PREFIXES as uPREFIXES
curies = OntCuries(uPREFIXES)
api_key = os.environ['SCICRUNCH_API_KEY']
query = OntQuery(SciGraphRemote(api_key=api_key))
OntTerm.query = query
query('mouse')

3 potential matches are shown:

Query {'term': 'mouse', 'limit': 10} returned more than one result. Please review.

OntTerm('NCBITaxon:10090', label='Mus musculus', synonyms=['mouse', 'house mouse', 'mice C57BL/6xCBA/CaJ hybrid', 'Mus muscaris'])

OntTerm('NCBITaxon:10088', label='Mus <mouse, genus>', synonyms=['mouse', 'Mus', 'mice'])

OntTerm('BIRNLEX:167', label='Mouse', synonyms=['mouse', 'Mus musculus', 'house mouse'])

The one we are looking for is Mus musculus, and we can select that with OntTerm(label='Mus musculus') or with OntTerm(curie='NCBITaxon:10090').

This workflow works for a variety of categories:

  • species (e.g. 'mouse', 'rat', 'rhesus macaque')
  • brain area (e.g. 'hippocampus', 'CA1', 'S1')
  • cell type (e.g. 'mossy cell', 'pyramidal cell')
  • institution (e.g. 'UC San Francisco', 'Brown University')
  • disease (e.g. "Parkinson's Disease", 'ALS')

Building for release

python setup.py sdist --release && python setup.py bdist_wheel --universal --release Building a release requires a working install of pyontutils in order to build the scigraph client library. The --release tells setup to build the scigraph client.

Related issues

https://github.com/NeurodataWithoutBorders/nwb-schema/issues/1#issuecomment-368741867

https://github.com/NeurodataWithoutBorders/nwb-schema/issues/1#issuecomment-369215854

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

ontquery-0.0.5.tar.gz (29.5 kB view hashes)

Uploaded Source

Built Distribution

ontquery-0.0.5-py2.py3-none-any.whl (29.2 kB view hashes)

Uploaded Python 2 Python 3

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