{ "cells": [ { "cell_type": "markdown", "id": "59f9fa58", "metadata": {}, "source": [ "# OBA tutorial\n", "\n", "* author: Harshad Hegde\n", "* created: 2023-01-25\n", "\n", "This tutorial walks through OBA." ] }, { "cell_type": "markdown", "id": "6e93ee26", "metadata": {}, "source": [ "## Create an alias\n", "\n", "For convenience we will set a bash alias.\n", "\n", "This assumes you have built the sqlite version of oba in the `../../db` folder\n", "\n", "__NOTE__ an alternative is:\n", "\n", "`%alias oba runoak -i sqlite:obo:oba`" ] }, { "cell_type": "code", "execution_count": 1, "id": "43637cd0", "metadata": {}, "outputs": [], "source": [ "%alias oba runoak -i ../../db/oba.db" ] }, { "cell_type": "markdown", "id": "e0925b63", "metadata": {}, "source": [ "### Basic lookup queries\n", "\n", "Let's check it's working:" ] }, { "cell_type": "code", "execution_count": 2, "id": "98923f51", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OBA:1000076 ! attribute of cell\r\n" ] } ], "source": [ "oba info OBA:1000076" ] }, { "cell_type": "markdown", "id": "c12ee95d", "metadata": {}, "source": [ "## Exploring the structure of OBA" ] }, { "cell_type": "code", "execution_count": 3, "id": "20f0ed74", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "subject\tsubject_label\tpredicate\tpredicate_label\tobject\tobject_label\n", "UBERON:0004535\tcardiovascular system\tBFO:0000050\tpart of\tUBERON:0001009\tcirculatory system\n", "UBERON:0004535\tcardiovascular system\tBFO:0000051\thas part\tUBERON:0000948\theart\n", "UBERON:0004535\tcardiovascular system\tBFO:0000051\thas part\tUBERON:0001981\tblood vessel\n", "UBERON:0004535\tcardiovascular system\trdfs:subClassOf\tNone\tUBERON:0000467\tanatomical system\n", "UBERON:0004535\tcardiovascular system\towl:equivalentClass\tNone\t_:riog00287837\tNone\n" ] } ], "source": [ "oba relationships UBERON:0004535" ] }, { "cell_type": "markdown", "id": "29edb128", "metadata": {}, "source": [ "Here we can see linkages to external ontologies using two relations\n", "\n", "### Querying ancestors\n", "\n", "We will try finding all ancestors of OBA:VT0010191 (immune system cell quantity)\n", "\n", "__IMPORTANT__ in OAK, all graph commands are parameterized by predicate lists. Consult the OAK docs if you\n", "don't understand what this means!\n", "\n", "To find all is-a ancestors (i.e. ancestors following SubClassOf between named classes) we use `-p i`:" ] }, { "cell_type": "code", "execution_count": 4, "id": "7d67c8dc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "id\tlabel\r", "\r\n", "BFO:0000001\tentity\r", "\r\n", "BFO:0000002\tcontinuant\r", "\r\n", "BFO:0000019\tquality\r", "\r\n", "BFO:0000019\tquality\r", "\r\n", "BFO:0000020\tspecifically dependent continuant\r", "\r\n", "OBA:0000001\tbiological attribute\r", "\r\n", "OBA:0100003\tanatomical entity attribute\r", "\r\n", "OBA:1000076\tattribute of cell\r", "\r\n", "OBA:VT0000237\tblood cell quantity\r", "\r\n", "OBA:VT0010191\timmune system cell quantity\r", "\r\n", "PATO:0000001\tquality\r", "\r\n", "PATO:0001241\tphysical object quality\r", "\r\n", "PATO:0001555\thas number of\r", "\r\n" ] } ], "source": [ "oba ancestors -p i OBA:VT0010191" ] }, { "cell_type": "code", "execution_count": null, "id": "165efc59", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }