Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional documentation to why-predicates notebook #332

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 79 additions & 52 deletions notebooks/Lessons/Why-predicates-are-important.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
"\n",
"This notebook is intended as an explanatory guide to the importance of edge types (predicates) in ontologies.\n",
"\n",
"Lessons:\n",
"\n",
"- using OAK and the sqlite backend\n",
"- understand the structure of key acids in CHEBI\n",
"- learn how paramaterizing by predicates makes a difference to measures like semantic similarity\n",
"- learm how to \"debug\" using OAK viz\n",
"- understand what Relation Graph is and why it's important\n",
"\n",
"## Citric acid and its ion forms\n",
"\n",
"For this guide, we are going to look at citric acid and it's conjugate forms such as citrate(3-). These\n",
Expand Down Expand Up @@ -76,7 +84,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "f6468023",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -105,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"id": "a54bf0e2",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -195,51 +203,51 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 4,
"id": "ebf64216",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"IAO:0000115: A tricarboxylic acid trianion, obtained by deprotonation of the three\r\n",
" carboxy groups of citric acid.\r\n",
"id: CHEBI:16947\r\n",
"obo:chebi/charge: '-3'\r\n",
"obo:chebi/formula: C6H5O7\r\n",
"obo:chebi/inchi: InChI=1S/C6H8O7/c7-3(8)1-6(13,5(11)12)2-4(9)10/h13H,1-2H2,(H,7,8)(H,9,10)(H,11,12)/p-3\r\n",
"obo:chebi/inchikey: KRKNYBCHXYNGOX-UHFFFAOYSA-K\r\n",
"obo:chebi/mass: '189.09970'\r\n",
"obo:chebi/monoisotopicmass: '189.00517'\r\n",
"obo:chebi/smiles: OC(CC([O-])=O)(CC([O-])=O)C([O-])=O\r\n",
"oio:hasAlternativeId:\r\n",
"- CHEBI:13999\r\n",
"- CHEBI:23321\r\n",
"- CHEBI:42563\r\n",
"oio:hasDbXref:\r\n",
"- Beilstein:1884707\r\n",
"- CAS:126-44-3\r\n",
"- Gmelin:4239\r\n",
"- KEGG:C00158\r\n",
"- PDBeChem:FLC\r\n",
"- Reaxys:1884707\r\n",
"oio:hasExactSynonym: 2-hydroxypropane-1,2,3-tricarboxylate\r\n",
"oio:hasOBONamespace: chebi_ontology\r\n",
"oio:hasRelatedSynonym:\r\n",
"- 2-hydroxy-1,2,3-propanetricarboxylate\r\n",
"- 2-hydroxy-1,2,3-propanetricarboxylate(3-)\r\n",
"- 2-hydroxy-1,2,3-propanetricarboxylic acid, ion(3-)\r\n",
"- 2-hydroxytricarballylate\r\n",
"- CITRATE ANION\r\n",
"- cit\r\n",
"- cit(3-)\r\n",
"- citrate\r\n",
"oio:id: CHEBI:16947\r\n",
"oio:inSubset: obo:chebi#3_STAR\r\n",
"rdfs:label: citrate(3-)\r\n",
"\r\n",
"---\r\n"
"IAO:0000115: A tricarboxylic acid trianion, obtained by deprotonation of the three\n",
" carboxy groups of citric acid.\n",
"id: CHEBI:16947\n",
"obo:chebi/charge: '-3'\n",
"obo:chebi/formula: C6H5O7\n",
"obo:chebi/inchi: InChI=1S/C6H8O7/c7-3(8)1-6(13,5(11)12)2-4(9)10/h13H,1-2H2,(H,7,8)(H,9,10)(H,11,12)/p-3\n",
"obo:chebi/inchikey: KRKNYBCHXYNGOX-UHFFFAOYSA-K\n",
"obo:chebi/mass: '189.09970'\n",
"obo:chebi/monoisotopicmass: '189.00517'\n",
"obo:chebi/smiles: OC(CC([O-])=O)(CC([O-])=O)C([O-])=O\n",
"oio:hasAlternativeId:\n",
"- CHEBI:13999\n",
"- CHEBI:23321\n",
"- CHEBI:42563\n",
"oio:hasDbXref:\n",
"- Beilstein:1884707\n",
"- CAS:126-44-3\n",
"- Gmelin:4239\n",
"- KEGG:C00158\n",
"- PDBeChem:FLC\n",
"- Reaxys:1884707\n",
"oio:hasExactSynonym: 2-hydroxypropane-1,2,3-tricarboxylate\n",
"oio:hasOBONamespace: chebi_ontology\n",
"oio:hasRelatedSynonym:\n",
"- 2-hydroxy-1,2,3-propanetricarboxylate\n",
"- 2-hydroxy-1,2,3-propanetricarboxylate(3-)\n",
"- 2-hydroxy-1,2,3-propanetricarboxylic acid, ion(3-)\n",
"- 2-hydroxytricarballylate\n",
"- CITRATE ANION\n",
"- cit\n",
"- cit(3-)\n",
"- citrate\n",
"oio:id: CHEBI:16947\n",
"oio:inSubset: obo:chebi#3_STAR\n",
"rdfs:label: citrate(3-)\n",
"\n",
"---\n"
]
}
],
Expand Down Expand Up @@ -593,7 +601,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 5,
"id": "c253b1eb",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -654,7 +662,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 6,
"id": "b25f97fe",
"metadata": {},
"outputs": [],
Expand All @@ -675,7 +683,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 7,
"id": "c6394e2d",
"metadata": {},
"outputs": [],
Expand All @@ -693,7 +701,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 8,
"id": "b8a665d6",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -861,7 +869,7 @@
"[304 rows x 6 columns]"
]
},
"execution_count": 26,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -897,24 +905,43 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 10,
"id": "7f9ce93f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"UBERON:0001612|BFO:0000050|UBERON:0000477\r\n",
"UBERON:0001612|BFO:0000050|UBERON:0010000\r\n",
"UBERON:0001612|BFO:0000050|UBERON:0000055\r\n",
"UBERON:0001612|BFO:0000050|UBERON:0003509\r\n",
"UBERON:0001612|BFO:0000050|UBERON:0001637\r\n"
"CL:0000127|BFO:0000050|UBERON:0000061\r\n",
"CL:0000127|BFO:0000050|UBERON:0000465\r\n",
"CL:0000127|BFO:0000050|UBERON:0000467\r\n",
"CL:0000127|BFO:0000050|UBERON:0000468\r\n",
"CL:0000127|BFO:0000050|UBERON:0001016\r\n"
]
}
],
"source": [
"!echo \"SELECT * FROM entailed_edge WHERE subject='CL:0000127' AND predicate='BFO:0000050' AND object LIKE 'UBERON:%' LIMIT 5\" | sqlite3 $HOME/.data/oaklib/cl.db"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "51bac57f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"UBERON:0000061 ! anatomical structure\r\n",
"UBERON:0001016 ! nervous system\r\n"
]
}
],
"source": [
"!echo \"SELECT * FROM entailed_edge WHERE predicate='BFO:0000050' AND object LIKE 'UBERON:%' LIMIT 5\" | sqlite3 $HOME/.data/oaklib/cl.db"
"cl info UBERON:0000061 UBERON:0001016"
]
},
{
Expand Down