-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated tutorials & added tutorial for atopo, db translation and netw…
…ork comparison (#15) * Add network building tutorial * Add resource tutorial * Add atopo tutorial * Add upstream connection tutorial * Add phosphosite tutorial * Add phenotype tutorial * Add tissue mapping tutorial * Add network comparison tutorial
- Loading branch information
Showing
8 changed files
with
7,705 additions
and
2,176 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,385 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "55b5595c-fec9-41c3-b756-b95cd0c52048", | ||
"metadata": {}, | ||
"source": [ | ||
"# Connect to downstream Gene Ontology terms.\n", | ||
"\n", | ||
"This notebook showcases the functionality of Omniflow that connects the existing nodes of a network to a phenotype of interest. " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"id": "3c317de8", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"CPU times: user 34 µs, sys: 2 µs, total: 36 µs\n", | ||
"Wall time: 41.2 µs\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%time\n", | ||
"from neko.core.network import Network\n", | ||
"from neko._visual.visualize_network import NetworkVisualizer\n", | ||
"from neko._inputs.resources import Resources\n", | ||
"from neko._annotations.gene_ontology import Ontology\n", | ||
"import omnipath as op" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2910c871-fdfc-4d20-b76f-af213f06a3f0", | ||
"metadata": {}, | ||
"source": [ | ||
"### 1. Build network\n", | ||
"\n", | ||
"Please see the [Network building](https://omniflow-project.readthedocs.io/en/latest/notebooks/network_building.html) tutorial for detailed explanations of each step." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 11, | ||
"id": "79c09e13", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"genes = [\"SRC\", \"NOTCH1\", \"FAK\"]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "fcf68a99-8454-41e3-8816-c3f976d04c0b", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "c3540efecec947a5853420e3000ea9c4", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"0.00B [00:00, ?B/s]" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"new_net1 = Network(genes)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"id": "370180cc", | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"CPU times: user 139 ms, sys: 3.96 ms, total: 143 ms\n", | ||
"Wall time: 141 ms\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%time\n", | ||
"new_net1.connect_nodes(only_signed=True, consensus_only=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "8ed135d3-9f71-4cec-9381-96c63fba766e", | ||
"metadata": {}, | ||
"source": [ | ||
"### 2. Connect to Gene Ontology (GO) term\n", | ||
"\n", | ||
"Connect the nodes of the Network with markers of a certain phenotype, from Gene Ontology. \n", | ||
"\n", | ||
"The _connect_genes_to_phenotype_ function will look for interactions between the nodes of the network and genes annotated with a GO term of interest. The argument _compress_ replaces the individual phenotype-specific genes into one phenotype node.\n", | ||
"\n", | ||
"<div class=\"alert alert-info\">\n", | ||
"\n", | ||
"**Note**\n", | ||
" \n", | ||
"We suggest to the users to choose gene ontology terms lower in the hierarcy (e.g., execution phase of apoptosis _versus_ apoptosis) to avoid the inclusion of too many genes.\n", | ||
"\n", | ||
"</div> " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 16, | ||
"id": "fa499a38-c22a-4a0e-b1d4-3ffb10e4a370", | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Start requesting genes from Gene Ontology\n", | ||
"Fetching from: https://golr-aux.geneontology.io/solr/select?defType=edismax&qt=standard&indent=on&wt=csv&rows=100000&start=0&fl=bioentity_label&facet=true&facet.mincount=1&facet.sort=count&json.nl=arrarr&facet.limit=25&hl=true&hl.simple.pre=%3Cem%20class=%22hilite%22%3E&hl.snippets=1000&csv.encapsulator=&csv.separator=%09&csv.header=false&csv.mv.separator=%7C&fq=document_category:%22annotation%22&fq=isa_partof_closure:%22GO:0001837%22&fq=taxon_subset_closure_label:%22Homo%20sapiens%22&fq=type:%22protein%22&fq=annotation_class_label:%22epithelial%20to%20mesenchymal%20transition%22&facet.field=aspect&facet.field=taxon_subset_closure_label&facet.field=type&facet.field=evidence_subset_closure_label&facet.field=regulates_closure_label&facet.field=isa_partof_closure_label&facet.field=annotation_class_label&facet.field=qualifier&facet.field=annotation_extension_class_closure_label&facet.field=assigned_by&facet.field=panther_family_label&q=*:*\n", | ||
"Done\n", | ||
"Starting connecting network's nodes to: ['WNT5A', 'WNT4', 'NOTCH1', 'RFLNB', 'SP6', 'AMELX', 'ROCK2', 'SLC39A6', 'PPP3R1', 'LEF1', 'FOXF2', 'ROCK1', 'S100A4', 'TGFB2', 'RBPJ', 'DLG5', 'DACT3', 'WNT11', 'HGF', 'CUL7', 'TGFB1', 'NOG', 'TRIM28', 'BMP2', 'TGFBR3', 'TGFBR1', 'FLNA', 'HMGA2', 'DDX17', 'TGFBR3L', 'EPB41L5', 'SNAI1', 'AKNA', 'IGF1', 'DDX5', 'SOX9', 'TGFBR2', 'HIF1A', 'BMP7', 'FGFR2', 'SMAD4', 'ENG', 'LOXL2', 'SNAI2', 'FGFR1', 'LIMS1', 'LOXL3', 'NCAM1', 'NOTCH4', 'GSK3B', 'SLC39A10', 'FAM83D', 'HNRNPAB', 'CTNNB1']\n", | ||
"CPU times: user 3.2 s, sys: 35 µs, total: 3.2 s\n", | ||
"Wall time: 4.07 s\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%time\n", | ||
"new_net1.connect_genes_to_phenotype(id_accession=\"GO:0001837\", phenotype=\"epithelial to mesenchymal transition\", only_signed=True, compress=True, maxlen=1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 17, | ||
"id": "33300268-bcf6-442b-97be-c7718922a939", | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"image/svg+xml": [ | ||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", | ||
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", | ||
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", | ||
"<!-- Generated by graphviz version 2.43.0 (0)\n", | ||
" -->\n", | ||
"<!-- Title: %3 Pages: 1 -->\n", | ||
"<svg width=\"378pt\" height=\"188pt\"\n", | ||
" viewBox=\"0.00 0.00 378.47 188.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", | ||
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 184)\">\n", | ||
"<title>%3</title>\n", | ||
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-184 374.47,-184 374.47,4 -4,4\"/>\n", | ||
"<!-- SRC -->\n", | ||
"<g id=\"node1\" class=\"node\">\n", | ||
"<title>SRC</title>\n", | ||
"<ellipse fill=\"lightgray\" stroke=\"black\" cx=\"113.23\" cy=\"-162\" rx=\"30.59\" ry=\"18\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"113.23\" y=\"-158.3\" font-family=\"Times,serif\" font-size=\"14.00\">SRC</text>\n", | ||
"</g>\n", | ||
"<!-- PTK2 -->\n", | ||
"<g id=\"node2\" class=\"node\">\n", | ||
"<title>PTK2</title>\n", | ||
"<ellipse fill=\"lightgray\" stroke=\"black\" cx=\"81.23\" cy=\"-90\" rx=\"36\" ry=\"18\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"81.23\" y=\"-86.3\" font-family=\"Times,serif\" font-size=\"14.00\">PTK2</text>\n", | ||
"</g>\n", | ||
"<!-- SRC->PTK2 -->\n", | ||
"<g id=\"edge1\" class=\"edge\">\n", | ||
"<title>SRC->PTK2</title>\n", | ||
"<path fill=\"none\" stroke=\"green\" d=\"M105.65,-144.41C101.92,-136.25 97.33,-126.22 93.15,-117.07\"/>\n", | ||
"<polygon fill=\"green\" stroke=\"green\" points=\"96.33,-115.6 88.98,-107.96 89.96,-118.51 96.33,-115.6\"/>\n", | ||
"</g>\n", | ||
"<!-- epithelial_to_mesenchymal_transition -->\n", | ||
"<g id=\"node3\" class=\"node\">\n", | ||
"<title>epithelial_to_mesenchymal_transition</title>\n", | ||
"<ellipse fill=\"lightgray\" stroke=\"black\" cx=\"185.23\" cy=\"-18\" rx=\"185.47\" ry=\"18\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"185.23\" y=\"-14.3\" font-family=\"Times,serif\" font-size=\"14.00\">epithelial_to_mesenchymal_transition</text>\n", | ||
"</g>\n", | ||
"<!-- SRC->epithelial_to_mesenchymal_transition -->\n", | ||
"<g id=\"edge2\" class=\"edge\">\n", | ||
"<title>SRC->epithelial_to_mesenchymal_transition</title>\n", | ||
"<path fill=\"none\" stroke=\"red\" d=\"M121.63,-144.43C134.61,-118.84 159.54,-69.68 174.03,-41.09\"/>\n", | ||
"<polygon fill=\"red\" stroke=\"red\" points=\"171.53,-34.98 180.45,-39.5 179.54,-41.28 170.62,-36.76 171.53,-34.98\"/>\n", | ||
"<polyline fill=\"none\" stroke=\"red\" points=\"176.44,-36.35 174.18,-40.81 \"/>\n", | ||
"</g>\n", | ||
"<!-- PTK2->epithelial_to_mesenchymal_transition -->\n", | ||
"<g id=\"edge4\" class=\"edge\">\n", | ||
"<title>PTK2->epithelial_to_mesenchymal_transition</title>\n", | ||
"<path fill=\"none\" stroke=\"purple\" d=\"M101.78,-75.17C115.47,-65.95 133.83,-53.6 149.84,-42.82\"/>\n", | ||
"<polygon fill=\"purple\" stroke=\"purple\" points=\"149.99,-42.72 152.74,-36.05 159.95,-36.02 157.2,-42.69 149.99,-42.72\"/>\n", | ||
"</g>\n", | ||
"<!-- NOTCH1 -->\n", | ||
"<g id=\"node4\" class=\"node\">\n", | ||
"<title>NOTCH1</title>\n", | ||
"<ellipse fill=\"lightgray\" stroke=\"black\" cx=\"225.23\" cy=\"-90\" rx=\"51.99\" ry=\"18\"/>\n", | ||
"<text text-anchor=\"middle\" x=\"225.23\" y=\"-86.3\" font-family=\"Times,serif\" font-size=\"14.00\">NOTCH1</text>\n", | ||
"</g>\n", | ||
"<!-- NOTCH1->epithelial_to_mesenchymal_transition -->\n", | ||
"<g id=\"edge3\" class=\"edge\">\n", | ||
"<title>NOTCH1->epithelial_to_mesenchymal_transition</title>\n", | ||
"<path fill=\"none\" stroke=\"green\" d=\"M210.16,-72.76C204.58,-64.61 198.57,-54.53 193.7,-45.31\"/>\n", | ||
"<polygon fill=\"green\" stroke=\"green\" points=\"196.72,-43.51 189.12,-36.12 190.46,-46.63 196.72,-43.51\"/>\n", | ||
"</g>\n", | ||
"<!-- NOTCH1->epithelial_to_mesenchymal_transition -->\n", | ||
"<g id=\"edge5\" class=\"edge\">\n", | ||
"<title>NOTCH1->epithelial_to_mesenchymal_transition</title>\n", | ||
"<path fill=\"none\" stroke=\"green\" d=\"M221.26,-71.7C217.45,-63.56 212.02,-53.69 206.45,-44.7\"/>\n", | ||
"<polygon fill=\"green\" stroke=\"green\" points=\"209.27,-42.61 200.9,-36.1 203.39,-46.4 209.27,-42.61\"/>\n", | ||
"</g>\n", | ||
"</g>\n", | ||
"</svg>\n" | ||
], | ||
"text/plain": [ | ||
"<graphviz.graphs.Digraph at 0x7f640e187e20>" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"#Visualize network\n", | ||
"visualizer1 = NetworkVisualizer(new_net1, color_by='effect')\n", | ||
"visualizer1.render()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"id": "7ba750f3-8440-4bf6-a37b-5c917f334fc9", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>source</th>\n", | ||
" <th>target</th>\n", | ||
" <th>Type</th>\n", | ||
" <th>Effect</th>\n", | ||
" <th>References</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>P12931</td>\n", | ||
" <td>Q05397</td>\n", | ||
" <td>post_translational</td>\n", | ||
" <td>stimulation</td>\n", | ||
" <td>Adhesome:10085298;Adhesome:10592173;Adhesome:1...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>P12931</td>\n", | ||
" <td>epithelial_to_mesenchymal_transition</td>\n", | ||
" <td>post_translational</td>\n", | ||
" <td>inhibition</td>\n", | ||
" <td>ProtMapper:16859511;ProtMapper:17440088;ProtMa...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>P46531</td>\n", | ||
" <td>epithelial_to_mesenchymal_transition</td>\n", | ||
" <td>transcriptional, post_translational</td>\n", | ||
" <td>stimulation</td>\n", | ||
" <td>CollecTRI:22110751, ACSN:22330899;ACSN:2236313...</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>3</th>\n", | ||
" <td>Q05397</td>\n", | ||
" <td>epithelial_to_mesenchymal_transition</td>\n", | ||
" <td>post_translational</td>\n", | ||
" <td>bimodal</td>\n", | ||
" <td>nan</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>4</th>\n", | ||
" <td>P46531</td>\n", | ||
" <td>epithelial_to_mesenchymal_transition</td>\n", | ||
" <td>NaN</td>\n", | ||
" <td>stimulation</td>\n", | ||
" <td>Gene Ontology</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" source target \\\n", | ||
"0 P12931 Q05397 \n", | ||
"1 P12931 epithelial_to_mesenchymal_transition \n", | ||
"2 P46531 epithelial_to_mesenchymal_transition \n", | ||
"3 Q05397 epithelial_to_mesenchymal_transition \n", | ||
"4 P46531 epithelial_to_mesenchymal_transition \n", | ||
"\n", | ||
" Type Effect \\\n", | ||
"0 post_translational stimulation \n", | ||
"1 post_translational inhibition \n", | ||
"2 transcriptional, post_translational stimulation \n", | ||
"3 post_translational bimodal \n", | ||
"4 NaN stimulation \n", | ||
"\n", | ||
" References \n", | ||
"0 Adhesome:10085298;Adhesome:10592173;Adhesome:1... \n", | ||
"1 ProtMapper:16859511;ProtMapper:17440088;ProtMa... \n", | ||
"2 CollecTRI:22110751, ACSN:22330899;ACSN:2236313... \n", | ||
"3 nan \n", | ||
"4 Gene Ontology " | ||
] | ||
}, | ||
"execution_count": 18, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"new_net1.edges" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ff7e1fd6-53fd-4985-9866-417b743486b2", | ||
"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.10.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.