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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2Python 3

File details

Details for the file ontquery-0.0.5.tar.gz.

File metadata

  • Download URL: ontquery-0.0.5.tar.gz
  • Upload date:
  • Size: 29.5 kB
  • 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 ontquery-0.0.5.tar.gz
Algorithm Hash digest
SHA256 0ebfd9717aad1808797043b43c35331ddcb0c395180cc1db084d7a7ec7d289de
MD5 99601369ea3be47797c4dfa7de5d25a5
BLAKE2b-256 65972ae7e86f9c120073a682d9b8a9a4ea3cfb3a171149cfe7841b6b0ccc6442

See more details on using hashes here.

File details

Details for the file ontquery-0.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: ontquery-0.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 29.2 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 ontquery-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a6302ff426f504667167c44610e22d7fde0352b809fbd0a02de12e87cb0c8126
MD5 a27633ec04b223929cfb0bd3ca1e7438
BLAKE2b-256 0e33d5a1c2500a52c848f381cfc862b9d87e2fc6c916ebbf037a0fd88c062ae8

See more details on using hashes here.

Supported by

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