{ "cells": [ { "cell_type": "markdown", "id": "1940578a", "metadata": { "collapsed": false }, "source": [ "# OMOP/N3C Examples\n", "\n", "See [https://github.com/jhu-bids/TermHub/issues/516](https://github.com/jhu-bids/TermHub/issues/516)\n" ] }, { "cell_type": "markdown", "id": "3b8c6747", "metadata": { "collapsed": false }, "source": [ "## Basic term lookup\n", "\n", "First we will create an adapter object for a previously created sqlite database containing the N3C version of OMOP." ] }, { "cell_type": "code", "execution_count": 88, "id": "4de67698", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:34:37.849023Z", "start_time": "2023-09-15T14:34:37.843989Z" } }, "outputs": [], "source": [ "from oaklib import get_adapter\n", "adapter = get_adapter('input/n3c.db')" ] }, { "cell_type": "markdown", "source": [ "Next we will do a lookup -- note in OAK all IDs are compact URIs (prefixed identifiers)" ], "metadata": { "collapsed": false }, "id": "eed28476b310828b" }, { "cell_type": "code", "execution_count": 89, "id": "c58acbfa", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:34:48.128627Z", "start_time": "2023-09-15T14:34:48.120532Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Angioplasty of posterior tibial artery\n" ] } ], "source": [ "TERM_ID = \"omop:4195673\"\n", "print(adapter.label(TERM_ID))" ] }, { "cell_type": "markdown", "source": [ "If you have a list of ids you can use the `labels` method:" ], "metadata": { "collapsed": false }, "id": "7f67d01d579dc1b4" }, { "cell_type": "code", "execution_count": 90, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:4195673 Angioplasty of posterior tibial artery\n", "omop:45933598 Postsurgical Percutaneous Transluminal Coronary Angioplasty Status\n" ] } ], "source": [ "for id, label in adapter.labels([TERM_ID, \"omop:45933598\"]):\n", " print(id, label)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:34:57.212788Z", "start_time": "2023-09-15T14:34:57.205303Z" } }, "id": "16d59cacac35ddbe" }, { "cell_type": "markdown", "id": "5752d298", "metadata": { "collapsed": false }, "source": [ "## Basic Search\n", "\n", "OAK has a number of different ways to search ontologies or to do boolean queries combining\n", "lexical search and graph constraints.\n", "\n", "We will start with a simple lookup-by-label, which considered the most basic search:" ] }, { "cell_type": "code", "execution_count": 91, "id": "77c6eb24", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:35:55.263063Z", "start_time": "2023-09-15T14:35:50.926077Z" } }, "outputs": [ { "data": { "text/plain": "['omop:1018433']" }, "execution_count": 91, "metadata": {}, "output_type": "execute_result" } ], "source": [ "list(adapter.basic_search(\"Angioplasty\"))" ] }, { "cell_type": "markdown", "source": [ "Next we will do a partial string match search -- for this we will need a SearchConfiguration object:" ], "metadata": { "collapsed": false }, "id": "cb98e0bcc0a6956d" }, { "cell_type": "code", "execution_count": 93, "id": "0e1054d0", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:37:31.532018Z", "start_time": "2023-09-15T14:37:26.980092Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:45933598 Postsurgical Percutaneous Transluminal Coronary Angioplasty Status\n", "omop:1389714 Percutaneous transluminal angioplasty of native or recurrent coarctation of the aorta\n", "omop:2101787 Anesthesia for angioplasty (Deprecated)\n", "omop:2107779 Transluminal balloon angioplasty, open; renal or other visceral artery\n", "omop:2107780 Transluminal balloon angioplasty, open; aortic\n" ] } ], "source": [ "from oaklib.datamodels.search import SearchConfiguration\n", "for t in list(adapter.basic_search(\"Angioplasty\", SearchConfiguration(is_partial=True)))[0:5]:\n", " print(t, adapter.label(t))" ] }, { "cell_type": "markdown", "source": [ "Note we truncated the results to 5 for brevity.\n", "\n", "Lexical search is currently quite slow for the sqlite backend. In future it will be possible\n", "to use a hybrid approach with lucene-backed search using Solr.\n", "\n", "## Command Line Simple Search\n", "\n", "We can do the same thing on the command line:" ], "metadata": { "collapsed": false }, "id": "308da9d982fd580f" }, { "cell_type": "code", "execution_count": 94, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:45933598 ! Postsurgical Percutaneous Transluminal Coronary Angioplasty Status\r\n", "omop:1389714 ! Percutaneous transluminal angioplasty of native or recurrent coarctation of the aorta\r\n", "omop:2101787 ! Anesthesia for angioplasty (Deprecated)\r\n", "omop:2107779 ! Transluminal balloon angioplasty, open; renal or other visceral artery\r\n", "omop:2107780 ! Transluminal balloon angioplasty, open; aortic\r\n" ] } ], "source": [ "!runoak -i $db/omop.db info l~Angioplasty | head -5" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:37:46.346753Z", "start_time": "2023-09-15T14:37:31.528786Z" } }, "id": "a1d351f131246dae" }, { "cell_type": "markdown", "id": "76f14f50", "metadata": { "collapsed": false }, "source": [ "## Graph Queries\n", "\n", "Ontologies and ontology-like structures can be projected onto graphs, and OAK provides a number of\n", "graph-oriented queries. For now we only consider IS_A graphs." ] }, { "cell_type": "code", "execution_count": 95, "id": "0de6da3d", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:38:16.462998Z", "start_time": "2023-09-15T14:38:16.438933Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:4195673 Angioplasty of posterior tibial artery\n", "omop:4000756 Leg repair\n", "omop:4002031 Cardiovascular system repair\n", "omop:4012185 Cardiovascular surgical procedure\n", "omop:4030028 Surgical procedure on lower extremity\n", "omop:4050128 Angioplasty of artery\n", "omop:4050134 Angioplasty of crural artery\n", "omop:4054559 Repair of blood vessel\n", "omop:4062347 Surgical repair of artery of extremity\n", "omop:4091623 Surgical repair of lower extremity\n", "omop:4148948 Vascular surgery procedure\n", "omop:4159949 Surgical procedure on soft tissue\n", "omop:4160912 Vascular surgical procedure on lower limb\n", "omop:4177089 Surgical repair procedure by device\n", "omop:4181193 Limb operation\n", "omop:4181322 Surgical repair procedure by body site\n", "omop:4184453 Operative procedure on lower leg\n", "omop:4185115 Surgical repair\n", "omop:4190070 Angioplasty of artery of lower extremity\n", "omop:4195673 Angioplasty of posterior tibial artery\n", "omop:4301351 Surgical procedure\n", "omop:4302652 Angioplasty of blood vessel\n", "omop:4311041 Repair of artery\n", "omop:4324523 Dilation procedure\n", "omop:4331725 Operative procedure on artery of extremity\n", "omop:46271049 Angioplasty of peripheral blood vessel\n" ] } ], "source": [ "from oaklib.datamodels.vocabulary import IS_A\n", "ancs = list(adapter.ancestors([TERM_ID], predicates=[IS_A]))\n", "for a in ancs:\n", " print(a, adapter.label(a))" ] }, { "cell_type": "code", "execution_count": 96, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "rdfs:subClassOf omop:4000756 Leg repair\n", "rdfs:subClassOf omop:4050134 Angioplasty of crural artery\n", "rdfs:subClassOf omop:4091623 Surgical repair of lower extremity\n", "rdfs:subClassOf omop:4184453 Operative procedure on lower leg\n", "rdfs:subClassOf omop:4012185 Cardiovascular surgical procedure\n", "rdfs:subClassOf omop:4181322 Surgical repair procedure by body site\n", "rdfs:subClassOf omop:4301351 Surgical procedure\n", "rdfs:subClassOf omop:4181193 Limb operation\n", "rdfs:subClassOf omop:4302652 Angioplasty of blood vessel\n", "rdfs:subClassOf omop:4311041 Repair of artery\n", "rdfs:subClassOf omop:4190070 Angioplasty of artery of lower extremity\n", "rdfs:subClassOf omop:4002031 Cardiovascular system repair\n", "rdfs:subClassOf omop:4148948 Vascular surgery procedure\n", "rdfs:subClassOf omop:4311041 Repair of artery\n", "rdfs:subClassOf omop:4331725 Operative procedure on artery of extremity\n", "rdfs:subClassOf omop:4030028 Surgical procedure on lower extremity\n", "rdfs:subClassOf omop:4181322 Surgical repair procedure by body site\n", "rdfs:subClassOf omop:4012185 Cardiovascular surgical procedure\n", "rdfs:subClassOf omop:4159949 Surgical procedure on soft tissue\n", "rdfs:subClassOf omop:4301351 Surgical procedure\n", "rdfs:subClassOf omop:4030028 Surgical procedure on lower extremity\n", "rdfs:subClassOf omop:4148948 Vascular surgery procedure\n", "rdfs:subClassOf omop:4185115 Surgical repair\n", "rdfs:subClassOf omop:4301351 Surgical procedure\n", "rdfs:subClassOf omop:4185115 Surgical repair\n", "rdfs:subClassOf omop:4030028 Surgical procedure on lower extremity\n", "rdfs:subClassOf omop:4301351 Surgical procedure\n", "rdfs:subClassOf omop:4050128 Angioplasty of artery\n", "rdfs:subClassOf omop:4062347 Surgical repair of artery of extremity\n", "rdfs:subClassOf omop:4091623 Surgical repair of lower extremity\n", "rdfs:subClassOf omop:4160912 Vascular surgical procedure on lower limb\n", "rdfs:subClassOf omop:4177089 Surgical repair procedure by device\n", "rdfs:subClassOf omop:46271049 Angioplasty of peripheral blood vessel\n", "rdfs:subClassOf omop:4000756 Leg repair\n", "rdfs:subClassOf omop:4050134 Angioplasty of crural artery\n", "rdfs:subClassOf omop:4054559 Repair of blood vessel\n", "rdfs:subClassOf omop:4324523 Dilation procedure\n", "rdfs:subClassOf omop:4054559 Repair of blood vessel\n", "rdfs:subClassOf omop:4301351 Surgical procedure\n", "rdfs:subClassOf omop:4148948 Vascular surgery procedure\n", "rdfs:subClassOf omop:4181193 Limb operation\n", "rdfs:subClassOf omop:4002031 Cardiovascular system repair\n", "rdfs:subClassOf omop:4324523 Dilation procedure\n" ] } ], "source": [ "ancs = list(adapter.ancestors([TERM_ID], predicates=[IS_A]))\n", "for a in ancs:\n", " for _, p, o in adapter.relationships([a], predicates=[IS_A]):\n", " print(p, o, adapter.label(o))" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:39:42.226228Z", "start_time": "2023-09-15T14:39:42.054005Z" } }, "id": "a9611ee1302a18ce" }, { "cell_type": "code", "execution_count": 97, "id": "23dceb5e", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:40:11.622299Z", "start_time": "2023-09-15T14:40:08.646936Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:3183297 Transvaginal urethral sling repair\n", "omop:2730516 Bypass Right Femoral Artery to Posterior Tibial Artery, Percutaneous Endoscopic Approach\n", "omop:4210771 Reconstruction of eyelid, full-thickness\n", "omop:2733612 Extraction of Left Brachial Vein, Percutaneous Approach\n", "omop:2725058 Bypass Right Ventricle to Right Pulmonary Artery with Synthetic Substitute, Percutaneous Endoscopic Approach\n" ] } ], "source": [ "descs = list(adapter.descendants([\"omop:4181322\"], predicates=[IS_A]))\n", "for d in descs[0:5]:\n", " print(d, adapter.label(d))" ] }, { "cell_type": "markdown", "id": "1230ac38", "metadata": { "collapsed": false }, "source": [ "## Simple Pairwise Semantic Similarity" ] }, { "cell_type": "code", "execution_count": 98, "id": "cda772fc", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:40:28.227977Z", "start_time": "2023-09-15T14:40:23.401277Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "subject_id: omop:4195673\n", "object_id: omop:2733612\n", "ancestor_id: omop:4302652\n", "ancestor_information_content: 10.432664389401875\n", "jaccard_similarity: 0.3793103448275862\n", "phenodigm_score: 1.9892756287187816\n" ] } ], "source": [ "from linkml_runtime.dumpers import yaml_dumper\n", "print(yaml_dumper.dumps(adapter.pairwise_similarity(TERM_ID, \"omop:2733612\")))" ] }, { "cell_type": "markdown", "id": "713ccfd2", "metadata": { "collapsed": false }, "source": [ "## Paths" ] }, { "cell_type": "code", "execution_count": 99, "id": "a4922766", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:40:53.629915Z", "start_time": "2023-09-15T14:40:53.494915Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4195673', 'Angioplasty of posterior tibial artery')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4000756', 'Leg repair')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4091623', 'Surgical repair of lower extremity')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4181322', 'Surgical repair procedure by body site')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4161058', 'Surgical repair of head and neck structure')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4161828', 'Repair of eyelid')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4330850', 'Reconstruction of eyelid')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4195673', 'Angioplasty of posterior tibial artery')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4000756', 'Leg repair')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4091623', 'Surgical repair of lower extremity')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4181322', 'Surgical repair procedure by body site')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4185115', 'Surgical repair')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4045162', 'Reconstruction procedure')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4330850', 'Reconstruction of eyelid')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4195673', 'Angioplasty of posterior tibial artery')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4050134', 'Angioplasty of crural artery')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4190070', 'Angioplasty of artery of lower extremity')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4177089', 'Surgical repair procedure by device')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4185115', 'Surgical repair')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4045162', 'Reconstruction procedure')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4330850', 'Reconstruction of eyelid')]\n", "[('omop:4195673', 'Angioplasty of posterior tibial artery'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness'), ('omop:4210771', 'Reconstruction of eyelid, full-thickness')]\n" ] } ], "source": [ "for path in adapter.paths([TERM_ID], [\"omop:4210771\"], predicates=[IS_A]):\n", " print([(elt, adapter.label(elt)) for elt in path])" ] }, { "cell_type": "markdown", "id": "7a43673f", "metadata": { "collapsed": false }, "source": [ "## Subgraphs" ] }, { "cell_type": "code", "execution_count": 100, "id": "7c9d31c3", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:41:46.530407Z", "start_time": "2023-09-15T14:41:46.438986Z" } }, "outputs": [], "source": [ "seeds = [TERM_ID, \"omop:4210771\", \"omop:2733612\"]\n", "g = adapter.ancestor_graph(seeds, predicates=[IS_A])" ] }, { "cell_type": "code", "execution_count": 101, "id": "c75e6964", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:42:08.985408Z", "start_time": "2023-09-15T14:42:07.753274Z" } }, "outputs": [], "source": [ "from oaklib.utilities.obograph_utils import graph_to_image\n", "graph_to_image(g, seeds=seeds, imgfile=\"output/angioplasty.png\", format=\"png\")" ] }, { "cell_type": "markdown", "id": "1d249bf2", "metadata": { "collapsed": false }, "source": [ "![img](output/angioplasty.png)" ] }, { "cell_type": "code", "execution_count": 102, "outputs": [], "source": [ "from oaklib.utilities.obograph_utils import default_stylemap_path\n", "\n", "stylemap = default_stylemap_path()\n", "graph_to_image(g, seeds=seeds, imgfile=\"output/angioplasty-styled.png\", format=\"png\", stylemap=stylemap)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:42:57.214723Z", "start_time": "2023-09-15T14:42:56.284130Z" } }, "id": "5ed46bd4f28c6f46" }, { "cell_type": "markdown", "source": [ "![img](output/angioplasty-styled.png)" ], "metadata": { "collapsed": false }, "id": "8f4be3bf83f6d11e" }, { "cell_type": "code", "execution_count": 36, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "omop:2733612 Extraction of Left Brachial Vein, Percutaneous Approach ==> omop:4054559 Repair of blood vessel\n", "omop:4054559 Repair of blood vessel ==> omop:4301351 Surgical procedure\n", "omop:4195673 Angioplasty of posterior tibial artery ==> omop:4054559 Repair of blood vessel\n", "omop:4210771 Reconstruction of eyelid, full-thickness ==> omop:4301351 Surgical procedure\n" ] } ], "source": [ "for s, p, o in adapter.gap_fill_relationships([\"omop:4195673\", \"omop:4210771\", \n", " \"omop:2733612\", \"omop:4054559\", \"omop:4301351\"],\n", " predicates=[IS_A]):\n", " print(s, adapter.label(s), \"==>\", o, adapter.label(o))" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:25:37.452226Z", "start_time": "2023-09-15T04:25:37.430138Z" } }, "id": "58f28aea969eea87" }, { "cell_type": "markdown", "id": "1a899a25", "metadata": { "collapsed": false }, "source": [ "## Export to networkx" ] }, { "cell_type": "code", "execution_count": 37, "id": "75adc8f8", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:25:48.291493Z", "start_time": "2023-09-15T04:25:48.276439Z" } }, "outputs": [], "source": [ "from oaklib.utilities.obograph_utils import as_multi_digraph\n", "nx_g = as_multi_digraph(g)" ] }, { "cell_type": "code", "execution_count": 38, "id": "bf22958c", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:25:48.812201Z", "start_time": "2023-09-15T04:25:48.793466Z" } }, "outputs": [ { "data": { "text/plain": "NodeView(('omop:4027561', 'omop:2733612', 'omop:40489873', 'omop:4177089', 'omop:4302652', 'omop:4054559', 'omop:4324523', 'omop:4301351', 'omop:4002031', 'omop:4148948', 'omop:4012185', 'omop:4159949', 'omop:4181322', 'omop:4185115', 'omop:4134598', 'omop:4330850', 'omop:4210771', 'omop:4045162', 'omop:4161828', 'omop:4161058', 'omop:4249123', 'omop:4139008', 'omop:4031321', 'omop:4154279', 'omop:4233946', 'omop:4040721', 'omop:4000756', 'omop:4195673', 'omop:4050134', 'omop:4190070', 'omop:4050128', 'omop:4062347', 'omop:4091623', 'omop:4160912', 'omop:46271049', 'omop:4030028', 'omop:4181193', 'omop:4311041', 'omop:4331725', 'omop:4184453'))" }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nx_g.nodes" ] }, { "cell_type": "code", "execution_count": 39, "id": "60cba513", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:25:49.419066Z", "start_time": "2023-09-15T04:25:49.414123Z" } }, "outputs": [ { "data": { "text/plain": "{'omop:4027561': 0.05128205128205128,\n 'omop:2733612': 0.05128205128205128,\n 'omop:40489873': 0.07692307692307693,\n 'omop:4177089': 0.07692307692307693,\n 'omop:4302652': 0.10256410256410256,\n 'omop:4054559': 0.10256410256410256,\n 'omop:4324523': 0.07692307692307693,\n 'omop:4301351': 0.1794871794871795,\n 'omop:4002031': 0.10256410256410256,\n 'omop:4148948': 0.1282051282051282,\n 'omop:4012185': 0.07692307692307693,\n 'omop:4159949': 0.05128205128205128,\n 'omop:4181322': 0.10256410256410256,\n 'omop:4185115': 0.10256410256410256,\n 'omop:4134598': 0.05128205128205128,\n 'omop:4330850': 0.07692307692307693,\n 'omop:4210771': 0.02564102564102564,\n 'omop:4045162': 0.05128205128205128,\n 'omop:4161828': 0.07692307692307693,\n 'omop:4161058': 0.07692307692307693,\n 'omop:4249123': 0.05128205128205128,\n 'omop:4139008': 0.07692307692307693,\n 'omop:4031321': 0.05128205128205128,\n 'omop:4154279': 0.05128205128205128,\n 'omop:4233946': 0.07692307692307693,\n 'omop:4040721': 0.02564102564102564,\n 'omop:4000756': 0.07692307692307693,\n 'omop:4195673': 0.05128205128205128,\n 'omop:4050134': 0.05128205128205128,\n 'omop:4190070': 0.1794871794871795,\n 'omop:4050128': 0.07692307692307693,\n 'omop:4062347': 0.07692307692307693,\n 'omop:4091623': 0.10256410256410256,\n 'omop:4160912': 0.07692307692307693,\n 'omop:46271049': 0.07692307692307693,\n 'omop:4030028': 0.10256410256410256,\n 'omop:4181193': 0.07692307692307693,\n 'omop:4311041': 0.07692307692307693,\n 'omop:4331725': 0.07692307692307693,\n 'omop:4184453': 0.05128205128205128}" }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# find graph statistics using networkx\n", "import networkx as nx\n", "nx.degree_centrality(nx_g)" ] }, { "cell_type": "markdown", "id": "101e0269", "metadata": { "collapsed": false }, "source": [ "## Term metadata" ] }, { "cell_type": "code", "execution_count": 40, "id": "50f31a17", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:25:56.811388Z", "start_time": "2023-09-15T04:25:52.143039Z" } }, "outputs": [ { "data": { "text/plain": "{'id': ['omop:4195673'],\n 'omop:concept_class_id': ['Procedure'],\n 'omop:concept_code': ['312644004'],\n 'omop:domain_id': ['Procedure'],\n 'omop:standard_concept': ['S'],\n 'omop:valid_end_date': ['2099-12-31'],\n 'omop:valid_start_date': ['2002-01-31'],\n 'omop:vocabulary_id': ['SNOMED'],\n 'rdfs:label': ['Angioplasty of posterior tibial artery'],\n 'sh:prefix': ['omop'],\n 'schema:url': ['https://athena.ohdsi.org/search-terms/terms/4195673'],\n 'rdfs:isDefinedBy': ['https://athena.ohdsi.org/search-terms/terms/']}" }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adapter.entity_metadata_map(TERM_ID)" ] }, { "cell_type": "code", "execution_count": 41, "id": "fb74f7a7", "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:26:01.804837Z", "start_time": "2023-09-15T04:26:01.797258Z" } }, "outputs": [], "source": [ "adapter.label(\"omop:312644004\")" ] }, { "cell_type": "markdown", "id": "34a4367d-9271-4a78-949d-9905d59e5a7c", "metadata": { "collapsed": false }, "source": [ "## Semantic Similarity using Rust" ] }, { "cell_type": "code", "execution_count": 42, "id": "62ccb499-dce3-4c4c-a5b0-836af733ea7f", "metadata": { "ExecuteTime": { "end_time": "2023-09-15T04:26:18.075123Z", "start_time": "2023-09-15T04:26:13.741719Z" } }, "outputs": [], "source": [ "simadapter = get_adapter('semsimian:input/n3c.db')" ] }, { "cell_type": "code", "execution_count": 43, "id": "e0c59472-b6a3-47ec-abdc-93db1cbfde39", "metadata": { "ExecuteTime": { "end_time": "2023-09-15T04:26:18.080007Z", "start_time": "2023-09-15T04:26:18.075959Z" } }, "outputs": [], "source": [ "terms1 = [\"omop:4195673\", \"omop:4000756\", \"omop:4002031\", \"omop:4012185\"]\n", "terms2 = [\"omop:4030028\", \"omop:4050128\", \"omop:4050134\", \"omop:4054559\"]\n" ] }, { "cell_type": "code", "execution_count": 44, "id": "92807c91-8ca0-4a8a-bece-460c9799670e", "metadata": { "ExecuteTime": { "end_time": "2023-09-15T04:26:56.073662Z", "start_time": "2023-09-15T04:26:56.071143Z" } }, "outputs": [], "source": [ "tsps = simadapter.termset_pairwise_similarity(terms1, terms2, predicates=[IS_A])" ] }, { "cell_type": "code", "execution_count": 45, "id": "6402925b-bd2a-4fe2-b17d-28607f3f972a", "metadata": { "ExecuteTime": { "end_time": "2023-09-15T04:26:56.096332Z", "start_time": "2023-09-15T04:26:56.088150Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "subject_termset:\n", " omop:4000756:\n", " id: omop:4000756\n", " label: Leg repair\n", " omop:4002031:\n", " id: omop:4002031\n", " label: Cardiovascular system repair\n", " omop:4012185:\n", " id: omop:4012185\n", " label: Cardiovascular surgical procedure\n", " omop:4195673:\n", " id: omop:4195673\n", " label: Angioplasty of posterior tibial artery\n", "object_termset:\n", " omop:4050128:\n", " id: omop:4050128\n", " label: Angioplasty of artery\n", " omop:4054559:\n", " id: omop:4054559\n", " label: Repair of blood vessel\n", " omop:4030028:\n", " id: omop:4030028\n", " label: Surgical procedure on lower extremity\n", " omop:4050134:\n", " id: omop:4050134\n", " label: Angioplasty of crural artery\n", "subject_best_matches:\n", " omop:4000756:\n", " match_source: omop:4000756\n", " score: 10.984781775651545\n", " similarity:\n", " subject_id: omop:4000756\n", " object_id: omop:4050134\n", " ancestor_id: omop:4091623\n", " ancestor_label: ''\n", " ancestor_information_content: 10.984781775651545\n", " jaccard_similarity: 0.25\n", " phenodigm_score: 1.657164881329823\n", " match_source_label: Leg repair\n", " match_target: omop:4050134\n", " match_target_label: Angioplasty of crural artery\n", " omop:4002031:\n", " match_source: omop:4002031\n", " score: 9.090426815106653\n", " similarity:\n", " subject_id: omop:4002031\n", " object_id: omop:4050128\n", " ancestor_id: omop:4002031\n", " ancestor_label: Cardiovascular system repair\n", " ancestor_information_content: 9.090426815106653\n", " jaccard_similarity: 0.4166666666666667\n", " phenodigm_score: 1.946195735178703\n", " match_source_label: Cardiovascular system repair\n", " match_target: omop:4050128\n", " match_target_label: Angioplasty of artery\n", " omop:4012185:\n", " match_source: omop:4012185\n", " score: 8.513920531310507\n", " similarity:\n", " subject_id: omop:4012185\n", " object_id: omop:4054559\n", " ancestor_id: omop:4012185\n", " ancestor_label: Cardiovascular surgical procedure\n", " ancestor_information_content: 8.513920531310507\n", " jaccard_similarity: 0.25\n", " phenodigm_score: 1.4589311610996685\n", " match_source_label: Cardiovascular surgical procedure\n", " match_target: omop:4054559\n", " match_target_label: Repair of blood vessel\n", " omop:4195673:\n", " match_source: omop:4195673\n", " score: 18.911289573272484\n", " similarity:\n", " subject_id: omop:4195673\n", " object_id: omop:4050134\n", " ancestor_id: omop:4050134\n", " ancestor_label: Angioplasty of crural artery\n", " ancestor_information_content: 18.911289573272484\n", " jaccard_similarity: 0.88\n", " phenodigm_score: 4.079452760417724\n", " match_source_label: Angioplasty of posterior tibial artery\n", " match_target: omop:4050134\n", " match_target_label: Angioplasty of crural artery\n", "object_best_matches:\n", " omop:4030028:\n", " match_source: omop:4030028\n", " score: 9.734760203165433\n", " similarity:\n", " subject_id: omop:4030028\n", " object_id: omop:4195673\n", " ancestor_id: omop:4030028\n", " ancestor_label: Surgical procedure on lower extremity\n", " ancestor_information_content: 9.734760203165433\n", " jaccard_similarity: 0.12\n", " phenodigm_score: 1.0808197002182427\n", " match_source_label: Surgical procedure on lower extremity\n", " match_target: omop:4195673\n", " match_target_label: Angioplasty of posterior tibial artery\n", " omop:4050128:\n", " match_source: omop:4050128\n", " score: 11.720054065584758\n", " similarity:\n", " subject_id: omop:4050128\n", " object_id: omop:4195673\n", " ancestor_id: omop:4050128\n", " ancestor_label: Angioplasty of artery\n", " ancestor_information_content: 11.720054065584758\n", " jaccard_similarity: 0.48\n", " phenodigm_score: 2.371840203614207\n", " match_source_label: Angioplasty of artery\n", " match_target: omop:4195673\n", " match_target_label: Angioplasty of posterior tibial artery\n", " omop:4050134:\n", " match_source: omop:4050134\n", " score: 18.911289573272484\n", " similarity:\n", " subject_id: omop:4050134\n", " object_id: omop:4195673\n", " ancestor_id: omop:4050134\n", " ancestor_label: Angioplasty of crural artery\n", " ancestor_information_content: 18.911289573272484\n", " jaccard_similarity: 0.88\n", " phenodigm_score: 4.079452760417724\n", " match_source_label: Angioplasty of crural artery\n", " match_target: omop:4195673\n", " match_target_label: Angioplasty of posterior tibial artery\n", " omop:4054559:\n", " match_source: omop:4054559\n", " score: 9.176700908405415\n", " similarity:\n", " subject_id: omop:4054559\n", " object_id: omop:4195673\n", " ancestor_id: omop:4054559\n", " ancestor_label: Repair of blood vessel\n", " ancestor_information_content: 9.176700908405415\n", " jaccard_similarity: 0.32\n", " phenodigm_score: 1.713634818358256\n", " match_source_label: Repair of blood vessel\n", " match_target: omop:4195673\n", " match_target_label: Angioplasty of posterior tibial artery\n", "average_score: 12.13040293072116\n", "best_score: 18.911289573272484\n", "metric: ancestor_information_content\n" ] } ], "source": [ "print(yaml_dumper.dumps(tsps))" ] }, { "cell_type": "markdown", "source": [ "## Mondo Mappings\n", "\n", "We will now demonstrate mapping to Mondo. Mondo has mappings to many sources - but not OMOP.\n", "\n", "The n3c OMOP does however have mappings to SNOMED (structured in an unusual way in the OWL),\n", "so we can use these as a join point to Mondo" ], "metadata": { "collapsed": false }, "id": "168eb5ef59b452e8" }, { "cell_type": "code", "execution_count": 49, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Parkinson's disease\n" ] } ], "source": [ "PD = \"omop:381270\"\n", "print(adapter.label(PD))" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T04:59:42.188798Z", "start_time": "2023-09-15T04:59:42.168952Z" } }, "id": "ec1958f2eb7fa093" }, { "cell_type": "code", "execution_count": 55, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['SCTID:49049000']\n" ] } ], "source": [ "def omop_mappings(id):\n", " # we SHOULD be able to just do this:\n", " # adapter.mappings([id], ...)\n", " # however, mappings are stored in the upstream OWL in a non-standard way\n", " return [f\"SCTID:{code}\" for code in adapter.entity_metadata_map(id).get(\"omop:concept_code\", [])]\n", "\n", "print(omop_mappings(PD))\n", " " ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T05:14:35.107856Z", "start_time": "2023-09-15T05:14:31.182616Z" } }, "id": "2f8af69fa46358ff" }, { "cell_type": "code", "execution_count": 56, "outputs": [], "source": [ "mondo = get_adapter(\"sqlite:obo:mondo\")" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T05:14:37.745116Z", "start_time": "2023-09-15T05:14:37.735342Z" } }, "id": "1487489855235878" }, { "cell_type": "code", "execution_count": 60, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MONDO:0005180 oio:hasDbXref SCTID:49049000 omop:381270\n" ] } ], "source": [ "for m in mondo.sssom_mappings(omop_mappings(PD)):\n", " print(m.subject_id,m.predicate_id, m.object_id, PD)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T05:17:11.448720Z", "start_time": "2023-09-15T05:17:07.161797Z" } }, "id": "20bd128d90378cd0" }, { "cell_type": "code", "execution_count": 65, "outputs": [], "source": [ "def transitive_mappings(omop_id):\n", " for m in mondo.sssom_mappings(omop_mappings(omop_id)):\n", " for m2 in mondo.sssom_mappings([m.subject_id]):\n", " yield omop_id, m.subject_id, m.object_id, m2.object_id" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T05:20:35.356850Z", "start_time": "2023-09-15T05:20:35.346694Z" } }, "id": "a492acf664c08e46" }, { "cell_type": "code", "execution_count": 66, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'DOID:14330')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'EFO:0002508')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'ICD9:332')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'ICD9:332.0')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'MESH:D010300')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'NCIT:C26845')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'NIFSTD:birnlex_2098')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'OMIMPS:168600')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'Orphanet:319705')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'SCTID:49049000')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'UMLS:C0030567')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', '')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'NCIT:C26845')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', 'DOID:14330')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', '')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', '')\n", "('omop:381270', 'MONDO:0005180', 'SCTID:49049000', '')\n" ] } ], "source": [ "for m in transitive_mappings(PD):\n", " print(m)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T05:20:40.039451Z", "start_time": "2023-09-15T05:20:35.546516Z" } }, "id": "a385db042406062f" }, { "cell_type": "markdown", "source": [ "## Value Set Expansion" ], "metadata": { "collapsed": false }, "id": "879cbe741f9fb617" }, { "cell_type": "code", "execution_count": 80, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "default_resolver:\r\n", " name: omop\r\n", " shorthand: sqlite:input/n3c.db\r\n" ] } ], "source": [ "!cat input/n3c_config.yaml" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:27:49.893020Z", "start_time": "2023-09-15T14:27:49.703855Z" } }, "id": "f0e6a9ffefc7eb88" }, { "cell_type": "code", "execution_count": 83, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "id: https://w3id.org/linkml/examples/enums\r\n", "title: Dynamic Enums Example\r\n", "name: dynamicenums-example\r\n", "description: This demonstrates the use of dynamic enums\r\n", "license: https://creativecommons.org/publicdomain/zero/1.0/\r\n", "\r\n", "prefixes:\r\n", " linkml: https://w3id.org/linkml/\r\n", " ex: https://w3id.org/linkml/examples/enums/\r\n", " sh: https://w3id.org/shacl/\r\n", " bioregistry: https://bioregistry.io/registry/\r\n", " MONDO: http://purl.obolibrary.org/obo/MONDO_\r\n", " omop: https://athena.ohdsi.org/search-terms/terms/\r\n", " loinc: http://loinc.org/\r\n", "\r\n", "default_prefix: ex\r\n", "default_range: string\r\n", "\r\n", "imports:\r\n", " - linkml:types\r\n", "\r\n", "\r\n", "enums:\r\n", " Synucleinopathies:\r\n", " reachable_from:\r\n", " include_self: true\r\n", " source_ontology: local:omop\r\n", " source_nodes:\r\n", " - omop:37203944\r\n" ] } ], "source": [ "!cat input/n3c-example-intensional-value-set.yaml" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:28:40.274869Z", "start_time": "2023-09-15T14:28:40.141236Z" } }, "id": "b228c23ad4b2f982" }, { "cell_type": "code", "execution_count": 84, "outputs": [], "source": [ "from oaklib.utilities.subsets.value_set_expander import ValueSetExpander\n", "\n", "expander = ValueSetExpander()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:28:40.951582Z", "start_time": "2023-09-15T14:28:40.947598Z" } }, "id": "60f5ec5f1be37d9b" }, { "cell_type": "code", "execution_count": 85, "outputs": [], "source": [ "from oaklib.datamodels.value_set_configuration import ValueSetConfiguration\n", "from linkml_runtime.loaders import yaml_loader\n", "\n", "expander.configuration = yaml_loader.load(\"input/n3c_config.yaml\", target_class=ValueSetConfiguration)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:28:41.489376Z", "start_time": "2023-09-15T14:28:41.482066Z" } }, "id": "a022ea4976c741d2" }, { "cell_type": "code", "execution_count": 86, "outputs": [], "source": [ "expander.expand_in_place(\n", " schema_path=\"input/n3c-example-intensional-value-set.yaml\", value_set_names=[\"Synucleinopathies\"], \n", " output_path=\"output/synucleinopathies.yaml\"\n", " )" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:28:44.838681Z", "start_time": "2023-09-15T14:28:42.327079Z" } }, "id": "523bb528b10569c8" }, { "cell_type": "code", "execution_count": 87, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "id: https://w3id.org/linkml/examples/enums\r\n", "title: Dynamic Enums Example\r\n", "name: dynamicenums-example\r\n", "description: This demonstrates the use of dynamic enums\r\n", "license: https://creativecommons.org/publicdomain/zero/1.0/\r\n", "\r\n", "prefixes:\r\n", " linkml: https://w3id.org/linkml/\r\n", " ex: https://w3id.org/linkml/examples/enums/\r\n", " sh: https://w3id.org/shacl/\r\n", " bioregistry: https://bioregistry.io/registry/\r\n", " MONDO: http://purl.obolibrary.org/obo/MONDO_\r\n", " omop: https://athena.ohdsi.org/search-terms/terms/\r\n", " loinc: http://loinc.org/\r\n", "\r\n", "default_prefix: ex\r\n", "default_range: string\r\n", "\r\n", "imports:\r\n", "- linkml:types\r\n", "\r\n", "\r\n", "enums:\r\n", " Synucleinopathies:\r\n", " reachable_from:\r\n", " include_self: true\r\n", " source_ontology: local:omop\r\n", " source_nodes:\r\n", " - omop:37203944\r\n", " permissible_values:\r\n", " omop:44800441:\r\n", " text: omop:44800441\r\n", " description: '[X]Parkinsonism in diseases classified elsewhere'\r\n", " meaning: omop:44800441\r\n", " omop:380701:\r\n", " text: omop:380701\r\n", " description: Diffuse Lewy body disease\r\n", " meaning: omop:380701\r\n", " omop:1340428:\r\n", " text: omop:1340428\r\n", " description: Exacerbation of Parkinson's disease\r\n", " meaning: omop:1340428\r\n", " omop:4219273:\r\n", " text: omop:4219273\r\n", " description: Parkinsonian syndrome with idiopathic orthostatic hypotension\r\n", " meaning: omop:4219273\r\n", " omop:4196433:\r\n", " text: omop:4196433\r\n", " description: Senile dementia of the Lewy body type\r\n", " meaning: omop:4196433\r\n", " omop:1340521:\r\n", " text: omop:1340521\r\n", " description: Progression of pure autonomic failure\r\n", " meaning: omop:1340521\r\n", " omop:40485457:\r\n", " text: omop:40485457\r\n", " description: Multiple system atrophy, Parkinson's variant\r\n", " meaning: omop:40485457\r\n", " omop:37396747:\r\n", " text: omop:37396747\r\n", " description: Autosomal dominant late onset Parkinson disease\r\n", " meaning: omop:37396747\r\n", " omop:4100236:\r\n", " text: omop:4100236\r\n", " description: Parkinsonism with orthostatic hypotension\r\n", " meaning: omop:4100236\r\n", " omop:36713737:\r\n", " text: omop:36713737\r\n", " description: Orthostatic hypotension co-occurrent and due to Parkinson's disease\r\n", " meaning: omop:36713737\r\n", " omop:381270:\r\n", " text: omop:381270\r\n", " description: Parkinson's disease\r\n", " meaning: omop:381270\r\n", " omop:4178618:\r\n", " text: omop:4178618\r\n", " description: Diffuse Lewy body disease with spongiform cortical change\r\n", " meaning: omop:4178618\r\n", " omop:37203944:\r\n", " text: omop:37203944\r\n", " description: Synucleinopathy\r\n", " meaning: omop:37203944\r\n", " omop:37110776:\r\n", " text: omop:37110776\r\n", " description: Atypical juvenile parkinsonism\r\n", " meaning: omop:37110776\r\n", " omop:37110499:\r\n", " text: omop:37110499\r\n", " description: Sporadic Parkinson disease\r\n", " meaning: omop:37110499\r\n", " omop:608078:\r\n", " text: omop:608078\r\n", " description: Autosomal recessive familial Parkinson disease\r\n", " meaning: omop:608078\r\n", " omop:37399497:\r\n", " text: omop:37399497\r\n", " description: Early onset parkinsonism and intellectual disability syndrome\r\n", " meaning: omop:37399497\r\n", " omop:37395785:\r\n", " text: omop:37395785\r\n", " description: Young onset Parkinson disease\r\n", " meaning: omop:37395785\r\n", " omop:44782763:\r\n", " text: omop:44782763\r\n", " description: Lewy body dementia with behavioral disturbance\r\n", " meaning: omop:44782763\r\n", " omop:4044053:\r\n", " text: omop:4044053\r\n", " description: Multiple system atrophy\r\n", " meaning: omop:4044053\r\n", " omop:40484594:\r\n", " text: omop:40484594\r\n", " description: Multiple system atrophy, cerebellar variant\r\n", " meaning: omop:40484594\r\n", " omop:4309357:\r\n", " text: omop:4309357\r\n", " description: Pure autonomic failure\r\n", " meaning: omop:4309357\r\n", " omop:4047751:\r\n", " text: omop:4047751\r\n", " description: Juvenile Parkinson's disease\r\n", " meaning: omop:4047751\r\n" ] } ], "source": [ "!cat output/synucleinopathies.yaml" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-09-15T14:29:00.132414Z", "start_time": "2023-09-15T14:28:59.962035Z" } }, "id": "76badc2323d4088b" }, { "cell_type": "markdown", "source": [ "## Command Line Value Set Expansion" ], "metadata": { "collapsed": false }, "id": "2669df54a24fbd9d" }, { "cell_type": "code", "execution_count": 73, "outputs": [], "source": [ "!vskit expand -c input/n3c_config.yaml -s input/n3c-example-intensional-value-set.yaml Synucleinopathies -o output/synucleinopathies.yaml" ], "metadata": { "collapsed": false, "ExecuteTime": { "start_time": "2023-09-15T05:49:31.599998Z" } }, "id": "12cc6be422e2d8ad" } ], "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.5" } }, "nbformat": 4, "nbformat_minor": 5 }