{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from IPython.display import display\n", "import re" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Predict heterologous pathways\n", "\n", "Predicting heterologous pathways is an important strategy to generate new viable strains. Because portfolio of available reactions is very large, computer assisted pathway design becomes essential. **Cameo** implements a pathway search algorithm using an universal biochemical reaction database that enumerates the shortest pathways." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", "If you're running this notebook on [try.cameo.bio](http://try.cameo.bio), things might run very slow due to our inability to provide access to the proprietary [CPLEX](https://www-01.ibm.com/software/commerce/optimization/cplex-optimizer/) solver on a public webserver. Furthermore, Jupyter kernels might crash and restart due to memory limitations on the server.\n", "
" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/javascript": [ "\n", "(function(global) {\n", " function now() {\n", " return new Date();\n", " }\n", "\n", " if (typeof (window._bokeh_onload_callbacks) === \"undefined\") {\n", " window._bokeh_onload_callbacks = [];\n", " }\n", "\n", " function run_callbacks() {\n", " window._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n", " delete window._bokeh_onload_callbacks\n", " console.info(\"Bokeh: all callbacks have finished\");\n", " }\n", "\n", " function load_libs(js_urls, callback) {\n", " window._bokeh_onload_callbacks.push(callback);\n", " if (window._bokeh_is_loading > 0) {\n", " console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n", " return null;\n", " }\n", " if (js_urls == null || js_urls.length === 0) {\n", " run_callbacks();\n", " return null;\n", " }\n", " console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n", " window._bokeh_is_loading = js_urls.length;\n", " for (var i = 0; i < js_urls.length; i++) {\n", " var url = js_urls[i];\n", " var s = document.createElement('script');\n", " s.src = url;\n", " s.async = false;\n", " s.onreadystatechange = s.onload = function() {\n", " window._bokeh_is_loading--;\n", " if (window._bokeh_is_loading === 0) {\n", " console.log(\"Bokeh: all BokehJS libraries loaded\");\n", " run_callbacks()\n", " }\n", " };\n", " s.onerror = function() {\n", " console.warn(\"failed to load library \" + url);\n", " };\n", " console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n", " document.getElementsByTagName(\"head\")[0].appendChild(s);\n", " }\n", " };\n", "\n", " var js_urls = ['https://cdn.pydata.org/bokeh/release/bokeh-0.11.1.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.11.1.min.js', 'https://cdn.pydata.org/bokeh/release/bokeh-compiler-0.11.1.min.js'];\n", "\n", " var inline_js = [\n", " function(Bokeh) {\n", " Bokeh.set_log_level(\"info\");\n", " },\n", " \n", " function(Bokeh) {\n", " Bokeh.$(\"#ef7ad822-bd8f-4c58-8566-3289d164f92e\").text(\"BokehJS successfully loaded\");\n", " },\n", " function(Bokeh) {\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.11.1.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.11.1.min.css\");\n", " console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.11.1.min.css\");\n", " Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.11.1.min.css\");\n", " }\n", " ];\n", "\n", " function run_inline_js() {\n", " for (var i = 0; i < inline_js.length; i++) {\n", " inline_js[i](window.Bokeh);\n", " }\n", " }\n", "\n", " if (window._bokeh_is_loading === 0) {\n", " console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n", " run_inline_js();\n", " } else {\n", " load_libs(js_urls, function() {\n", " console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n", " run_inline_js();\n", " });\n", " }\n", "}(this));" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from cameo import models\n", "from cameo.strain_design import pathway_prediction" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "model = models.bigg.iMM904" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [], "source": [ "predictor = pathway_prediction.PathwayPredictor(model=model, compartment_regexp=re.compile(\".*_c$\"))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "Pathway 1" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
equationlower_boundupper_bound
MNXR5336vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+...-10001000
MNXR5340formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben...-10001000
MNXR68718H2O + 3,4-dihydroxybenzoate <=> 3-dehydroshiki...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5336 vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+... -1000 \n", "MNXR5340 formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben... -1000 \n", "MNXR68718 H2O + 3,4-dihydroxybenzoate <=> 3-dehydroshiki... -1000 \n", "\n", " upper_bound \n", "MNXR5336 1000 \n", "MNXR5340 1000 \n", "MNXR68718 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Pathway 2" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
equationlower_boundupper_bound
MNXR230NADP(+) + H2O + 3,4-dihydroxybenzoate <=> O2 +...-10001000
MNXR5336vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+...-10001000
MNXR5340formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR230 NADP(+) + H2O + 3,4-dihydroxybenzoate <=> O2 +... -1000 \n", "MNXR5336 vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+... -1000 \n", "MNXR5340 formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben... -1000 \n", "\n", " upper_bound \n", "MNXR230 1000 \n", "MNXR5336 1000 \n", "MNXR5340 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Pathway 3" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
equationlower_boundupper_bound
MNXR5336vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+...-10001000
MNXR5340formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben...-10001000
MNXR14769H2O + 3,4-dihydroxybenzoate + NAD(+) <=> NADH(...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5336 vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+... -1000 \n", "MNXR5340 formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben... -1000 \n", "MNXR14769 H2O + 3,4-dihydroxybenzoate + NAD(+) <=> NADH(... -1000 \n", "\n", " upper_bound \n", "MNXR5336 1000 \n", "MNXR5340 1000 \n", "MNXR14769 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "Pathway 4" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
equationlower_boundupper_bound
MNXR5336vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+...-10001000
MNXR5340formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben...-10001000
MNXR6101anthranilate + NADH(2-) + O2 + 3.0 H(+) <=> NH...-10001000
MNXR70673,4-dihydroxybenzoate + H(+) <=> catechol + CO(2)-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5336 vanillin + H2O + NAD(+) <=> NADH(2-) + 2.0 H(+... -1000 \n", "MNXR5340 formaldehyde + H2O + NAD(+) + 3,4-dihydroxyben... -1000 \n", "MNXR6101 anthranilate + NADH(2-) + O2 + 3.0 H(+) <=> NH... -1000 \n", "MNXR7067 3,4-dihydroxybenzoate + H(+) <=> catechol + CO(2) -1000 \n", "\n", " upper_bound \n", "MNXR5336 1000 \n", "MNXR5340 1000 \n", "MNXR6101 1000 \n", "MNXR7067 1000 " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pathways = predictor.run(product=\"vanillin\", max_predictions=4)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
IdMNXR5336
Namerhea:13309
StoichiometryMNXM754 + MNXM2 + MNXM8 <=> MNXM10 + 2.0 MNXM1 + MNXM982
Lower bound-1000.000000
Upper bound1000.000000
\n", " " ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pathways.pathways[0].reactions[0]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pathways.plot_production_envelopes(model, objective=model.reactions.BIOMASS_SC5_notrace)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [default]", "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.4.5" } }, "nbformat": 4, "nbformat_minor": 0 }