Skip to content

Commit

Permalink
update basic notebook to remove deprecated or updated methods, add se…
Browse files Browse the repository at this point in the history
…msim example fixes #244 (#243)

* add semsim notebook

* replace deprecated methods
  • Loading branch information
sierra-moxon authored Aug 30, 2022
1 parent 312bae6 commit 1ac1ac4
Show file tree
Hide file tree
Showing 2 changed files with 208 additions and 119 deletions.
123 changes: 123 additions & 0 deletions notebooks/basic-demo-semsim.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "667f0480",
"metadata": {},
"source": [
"## Loading from obo files using Pronto"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "d0255749",
"metadata": {},
"outputs": [],
"source": [
"from oaklib.implementations.ubergraph.ubergraph_implementation import UbergraphImplementation\n",
"from oaklib.resource import OntologyResource"
]
},
{
"cell_type": "markdown",
"id": "74879ed0",
"metadata": {},
"source": [
"### Remote (downloading from OBO)\n",
"\n",
"Next we use pronto's load from obo library feature"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "33fd0318",
"metadata": {},
"outputs": [],
"source": [
"oi = UbergraphImplementation()\n"
]
},
{
"cell_type": "markdown",
"id": "82b8e42a",
"metadata": {},
"source": [
"note this slight lag in executing the command above - while this method relieves\n",
"the need to manage and synchronize files locally there is an initial network startup\n",
"penalty"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "6bb78662",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"BFO:0000050 = ['GO:0005737']\n",
"COB:0000072 = ['GO:0005737']\n",
"rdfs:subClassOf = ['GO:0043231']\n"
]
}
],
"source": [
"rels = oi.outgoing_relationship_map(\"GO:0005773\")\n",
"for k, v in rels.items():\n",
" print(f\"{k} = {v}\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "81adbff6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"70.18670393071754\n"
]
}
],
"source": [
"ic = oi.get_information_content(\"GO:0005773\")\n",
"print(ic)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "26221506",
"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.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 1ac1ac4

Please sign in to comment.