{"id":25843108,"url":"https://github.com/incatools/ontology-access-kit","last_synced_at":"2026-04-12T20:14:43.958Z","repository":{"id":37055031,"uuid":"475072415","full_name":"INCATools/ontology-access-kit","owner":"INCATools","description":"Ontology Access Kit: A python library and command line application for working with ontologies","archived":false,"fork":false,"pushed_at":"2025-04-10T19:06:40.000Z","size":86564,"stargazers_count":139,"open_issues_count":174,"forks_count":30,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-05-08T11:08:50.346Z","etag":null,"topics":["apis","geneontology","monarchinitiative","oaklib","obofoundry","ontology","ontology-api","owl","python","rdf","semantic-web"],"latest_commit_sha":null,"homepage":"https://incatools.github.io/ontology-access-kit/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/INCATools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-28T15:50:45.000Z","updated_at":"2025-05-02T05:15:42.000Z","dependencies_parsed_at":"2023-02-18T01:16:27.038Z","dependency_job_id":"3b56fc67-9430-4b1e-96f6-3ac25f793ee1","html_url":"https://github.com/INCATools/ontology-access-kit","commit_stats":{"total_commits":539,"total_committers":33,"mean_commits":"16.333333333333332","dds":"0.43599257884972176","last_synced_commit":"8746e90e1372c3bd611f7300af3e9877340df78f"},"previous_names":[],"tags_count":156,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/INCATools%2Fontology-access-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/INCATools%2Fontology-access-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/INCATools%2Fontology-access-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/INCATools%2Fontology-access-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/INCATools","download_url":"https://codeload.github.com/INCATools/ontology-access-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414457,"owners_count":22067263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apis","geneontology","monarchinitiative","oaklib","obofoundry","ontology","ontology-api","owl","python","rdf","semantic-web"],"created_at":"2025-03-01T06:39:46.645Z","updated_at":"2026-04-06T02:03:27.937Z","avatar_url":"https://github.com/INCATools.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ontology Access Kit (OAK)\n\nPython lib for common ontology operations over a variety of backends.\n\n\u003cimg src=\"docs/logos/oak-logo_black-icon.png\" width=\"20%\"\u003e\n\n[![PyPI version](https://badge.fury.io/py/oaklib.svg)](https://badge.fury.io/py/oaklib)\n![](https://github.com/incatools/ontology-access-kit/workflows/Build/badge.svg)\n[![badge](https://img.shields.io/badge/launch-binder-579ACA.svg)](https://mybinder.org/v2/gh/incatools/ontology-access-kit/main?filepath=notebooks)\n[![Downloads](https://pepy.tech/badge/oaklib/week)](https://pepy.tech/project/oaklib)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6456239.svg)](https://doi.org/10.5281/zenodo.6456239)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](.github/CODE_OF_CONDUCT.md) \n\nOAK provides a collection of [interfaces](https://incatools.github.io/ontology-access-kit/packages/interfaces/index.html#interfaces) for various ontology operations, including:\n\n - [look up basic features](https://incatools.github.io/ontology-access-kit/guide/basics.html) of an ontology element, such as its label, definition, relationships, or aliases\n - search an ontology for a term\n - validate an ontology\n - modify or delete terms\n - generate and visualize subgraphs\n - identify lexical matches and export as SSSOM mapping tables\n - perform more advanced operations, such as graph traversal, OWL axiom processing, or text annotation\n\nThese interfaces are *separated* from any particular backend, for which there a number of different [adapters](https://incatools.github.io/ontology-access-kit/implementations/index.html).\nThis means the same Python API and command line can be used regardless of whether the ontology:\n\n - is served by a remote API such as OLS or BioPortal\n - is present locally on the filesystem in owl, obo, obojson, or sqlite formats\n - is to be downloaded from a remote repository such as the OBO library\n - is queried from a remote database, including SPARQL endpoints (Ontobee/Ubergraph), A SQL database, a Solr/ES endpoint\n\n## Documentation:\n\n- [incatools.github.io/ontology-access-kit](https://incatools.github.io/ontology-access-kit)\n- Presentations:\n   - [Using the OAK command line](https://doi.org/10.5281/zenodo.7708962) *OBO Academy 2023*\n   - [Introduction to OAK](https://doi.org/10.5281/zenodo.7765088) *OAK workshop 2022*\n\n## Contributing\n\nSee the contribution guidelines at [CONTRIBUTING.md](.github/CONTRIBUTING.md).\nAll contributors are expected to uphold our [Code of Conduct](.github/CODE_OF_CONDUCT.md).\n\n## Usage\n\n```python\nfrom oaklib import get_adapter\n\n# connect to the CL sqlite database adapter\n# (will first download if not already downloaded)\nadapter = get_adapter(\"sqlite:obo:cl\")\n\nNEURON = \"CL:0000540\"\n\nprint('## Basic info')\nprint(f'ID: {NEURON}')\nprint(f'Label: {adapter.label(NEURON)}')\n\nfor alias in adapter.entity_aliases(NEURON):\n    print(f'Alias: {alias}')\n\nprint('## Relationships (direct)')\nfor relationship in adapter.relationships([NEURON]):\n    print(f' * {relationship.predicate} -\u003e {relationship.object} \"{adapter.label(relationship.object)}\"')\n    \nprint('## Ancestors (over IS_A and PART_OF)')\nfrom oaklib.datamodels.vocabulary import IS_A, PART_OF\nfrom oaklib.interfaces import OboGraphInterface\n\nif not isinstance(adapter, OboGraphInterface):\n    raise ValueError('This adapter does not support graph operations')\n\nfor ancestor in adapter.ancestors(NEURON, predicates=[IS_A, PART_OF]):\n    print(f' * ANCESTOR: \"{adapter.label(ancestor)}\"')\n```\n\nFor more examples, see\n\n- [demo notebook](https://github.com/incatools/ontology-access-kit/blob/main/notebooks/basic-demo.ipynb)\n- [tutorial part 2](https://incatools.github.io/ontology-access-kit/intro/tutorial02.html)\n\n## Command Line\n\nSee:\n\n - [CLI docs](https://incatools.github.io/ontology-access-kit/cli.html)\n - [Example notebooks](https://github.com/INCATools/ontology-access-kit/tree/main/docs/examples/Commands)\n\n## Search\n\nUse the pronto backend to fetch and parse an ontology from the OBO library, then use the `search` command\n\n```bash\nrunoak -i obolibrary:pato.obo search osmol \n```\n\nReturns:\n\n```\nPATO:0001655 ! osmolarity\nPATO:0001656 ! decreased osmolarity\nPATO:0001657 ! increased osmolarity\nPATO:0002027 ! osmolality\nPATO:0002028 ! decreased osmolality\nPATO:0002029 ! increased osmolality\nPATO:0045034 ! normal osmolality\nPATO:0045035 ! normal osmolarity\n```\n\n### QC and Validation\n\nPerform validation on PR using sqlite/rdftab instance:\n\n```bash\nrunoak -i sqlite:../semantic-sql/db/pr.db validate\n```\n\n### List all terms\n\nList all terms obolibrary has for mondo\n\n```bash\nrunoak -i obolibrary:mondo.obo terms \n```\n\n### Lexical index\n\nMake a lexical index of all terms in Mondo:\n\n```bash\nrunoak  -i obolibrary:mondo.obo lexmatch -L mondo.index.yaml\n```\n\n### Search\n\nSearching over OBO using ontobee:\n\n```bash\nrunoak  -i ontobee: search tentacle\n```\n\nyields:\n\n```\nhttp://purl.obolibrary.org/obo/CEPH_0000256 ! tentacle\nhttp://purl.obolibrary.org/obo/CEPH_0000257 ! tentacle absence\nhttp://purl.obolibrary.org/obo/CEPH_0000258 ! tentacle pad\n...\n```\n\nSearching over a broader set of ontologies in bioportal (requires API KEY)\n(https://www.bioontology.org/wiki/BioPortal_Help#Getting_an_API_key)\n\n```bash\nrunoak set-apikey bioportal YOUR-KEY-HERE\nrunoak  -i bioportal: search tentacle\n```\n\nyields:\n\n```\nBTO:0001357 ! tentacle\nhttp://purl.jp/bio/4/id/200906071014668510 ! tentacle\nCEPH:0000256 ! tentacle\nhttp://www.projecthalo.com/aura#Tentacle ! Tentacle\nCEPH:0000256 ! tentacle\n...\n```\nAlternatively, you can add \"BIOPORTAL_API_KEY\" to your environment variables.\n\nSearching over more limited set of ontologies in Ubergraph:\n\n```bash\nrunoak -v -i ubergraph: search tentacle\n```\n\nyields\n```\nUBERON:0013206 ! nasal tentacle\n```\n\n### Annotating Texts\n\n```bash\nrunoak  -i bioportal: annotate neuron from CA4 region of hippocampus of mouse\n```\n\nyields:\n\n```yaml\nobject_id: CL:0000540\nobject_label: neuron\nobject_source: https://data.bioontology.org/ontologies/NIFDYS\nmatch_type: PREF\nsubject_start: 1\nsubject_end: 6\nsubject_label: NEURON\n\nobject_id: http://www.co-ode.org/ontologies/galen#Neuron\nobject_label: Neuron\nobject_source: https://data.bioontology.org/ontologies/GALEN\nmatch_type: PREF\nsubject_start: 1\nsubject_end: 6\nsubject_label: NEURON\n\n...\n```\n\n### Mapping\n\nCreate a SSSOM mapping file for a set of ontologies:\n\n```bash\nrobot merge -I http://purl.obolibrary.org/obo/hp.owl -I http://purl.obolibrary.org/obo/mp.owl convert --check false -o hp-mp.obo\nrunoak lexmatch -i hp-mp.obo -o hp-mp.sssom.tsv\n```\n\n\n\n\n### Visualization of ancestor graphs\n\nUse the sqlite backend to visualize graph up from 'vacuole' using test ontology sqlite:\n\n```bash\nrunoak -i sqlite:tests/input/go-nucleus.db  viz GO:0005773\n```\n\n![img](notebooks/output/vacuole.png)\n\nSame using ubergraph, restricting to is-a and part-of\n\n```bash\nrunoak -i ubergraph:  viz GO:0005773 -p i,BFO:0000050\n```\n\nSame using pronto, fetching ontology from obolibrary\n\n```bash\nrunoak -i obolibrary:go.obo  viz GO:0005773\n```\n\n## Configuration\n\nOAK uses [`pystow`](https://github.com/cthoyt/pystow) for caching. By default,\nthis goes inside `~/.data/`, but can be configured following\n[these instructions](https://github.com/cthoyt/pystow#%EF%B8%8F%EF%B8%8F-configuration).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincatools%2Fontology-access-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincatools%2Fontology-access-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincatools%2Fontology-access-kit/lists"}