{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Predict expression modulation targets\n", "\n", "Cameo provides algorithms to search for genes or reactions that can be over or down regulated in order to achieve a given biological objective." ] }, { "cell_type": "code", "execution_count": 1, "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.$(\"#012ac511-bf21-4670-bcce-4db334096a9e\").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" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load the E. coli core model." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "model = models.bigg.e_coli_core" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Flux Scanning based on Enforced Objective Flux" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from cameo.strain_design.deterministic.flux_variability_based import FSEOF" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fseof = FSEOF(model)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "Model: e_coli_core
\n", "Enforced objective: EX_succ_e
\n", "Primary objective: Maximize\n", "-1.0*BIOMASS_Ecoli_core_w_GAM_reverse_712e5 + 1.0*BIOMASS_Ecoli_core_w_GAM
\n", "
\n", "Reaction fluxes

\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", " \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", " \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", " \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", " \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", " \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", "
12345678910
ADK10.0000000.0000000.0000000.000000-0.0000000.000000-0.0000000.0000000.4103381.527283
ENO15.23889215.76164516.21240716.57753516.94266217.30779017.70441518.60229219.29329219.628048
FBA7.7569418.0364998.2425158.3610488.4795828.5981158.7477939.3931029.8307879.910940
FRD70.0000000.0000000.0000001.4532353.1753024.8973696.5867037.7551419.12784210.852285
GAPD16.43113216.83873717.17361817.42198917.67035917.91873018.19843118.97672319.54778419.761991
ICL0.0000000.0000000.3860571.2313422.0766272.9219123.7353224.0414594.1433333.893465
MALS0.0000000.0000000.3860571.2313422.0766272.9219123.7353224.0414594.1433333.893465
.................................
PGM-15.238892-15.761645-16.212407-16.577535-16.942662-17.307790-17.704415-18.602292-19.293292-19.628048
PPC3.7583205.0123305.8788756.2845166.6901577.0957997.5329968.4723679.61532311.108854
PPS0.0000000.0000000.0000000.0000000.0000000.0000000.0000000.0000000.4103381.527283
SUCCt31.4745752.9491504.4237255.8983007.3728758.84745010.32202511.79660013.27117514.745750
THD20.0000000.0000000.0000000.0000000.0000000.0000000.1196742.1438482.9168071.535161
TPI7.7569418.0364998.2425158.3610488.4795828.5981158.7477939.3931029.8307879.910940
EX_succ_e1.4745752.9491504.4237255.8983007.3728758.84745010.32202511.79660013.27117514.745750
\n", "

18 rows × 10 columns

\n", "
\n" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fseof.run(target=model.reactions.EX_succ_e)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Differential flux variability analysis\n", "\n", "Compares flux ranges of a reference model to a set of models that have been parameterized to lie on a grid of evenly spaced points in the n-dimensional production envelope (n being the number of reaction bounds to be varied)." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from cameo.flux_analysis.analysis import phenotypic_phase_plane\n", "from cameo.strain_design.deterministic import DifferentialFVA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Succinate production" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The production envelope looks like this." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "production_envelope = phenotypic_phase_plane(model, \n", " variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM],\n", " objective=model.metabolites.succ_e)\n", "production_envelope.plot(height=400)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set up a model that represents a reference state (in this case a model with a constrained growth rate)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [], "source": [ "model.reactions.EX_o2_e.lower_bound = 0\n", "reference_model = model.copy()\n", "biomass_rxn = reference_model.reactions.BIOMASS_Ecoli_core_w_GAM\n", "biomass_rxn.lower_bound = 0.\n", "target = reference_model.metabolites.succ_e" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Set up the differential flux variability analysis strain design method." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [], "source": [ "diffFVA = DifferentialFVA(design_space_model=model,\n", " reference_model=reference_model,\n", " objective=target,\n", " variables=[biomass_rxn],\n", " normalize_ranges_by=biomass_rxn,\n", " points=10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Run differential flux variability analysis (only on the surface of the production envelope)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 1.49 s, sys: 32.3 ms, total: 1.52 s\n", "Wall time: 2.16 s\n" ] }, { "data": { "text/html": [ "\n", "\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%time result = diffFVA.run(surface_only=True)\n", "result.plot()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result.plot(5, variables=['FBP', 'G6PDH2r', 'PGL', 'PGK'])" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "BIOMASS_Ecoli_core_w_GAM: 0.094072" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "DM_succ_e: 9.873904" ], "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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
upper_boundlower_boundgapsnormalized_gapsKOflux_reversalsuddenly_essential
ACALD-9.10733e-16-9.10733e-1600FalseFalseTrue
ACALDt0000FalseFalseTrue
ACKr-8.69634-8.69634082.443FalseFalseTrue
ACONTa0.1014950.10149500FalseFalseFalse
ACONTb0.1014950.10149500FalseFalseFalse
ACt2r-8.69634-8.69634082.443FalseFalseTrue
ADK10.5831160.58311600FalseFalseFalse
........................
SUCDi990.126000FalseFalseFalse
SUCOAS0-1.88738e-1400FalseFalseTrue
TALA-0.0168296-0.01682960-0.141033FalseFalseTrue
THD21.612981.6129800FalseFalseFalse
TKT1-0.0168296-0.01682960-0.141033FalseFalseTrue
TKT2-0.0507897-0.05078970-0.425623FalseFalseTrue
TPI9.906439.90643095.3064FalseFalseFalse
\n", "

76 rows × 7 columns

\n", "
" ], "text/plain": [ " upper_bound lower_bound gaps normalized_gaps KO flux_reversal \\\n", "ACALD -9.10733e-16 -9.10733e-16 0 0 False False \n", "ACALDt 0 0 0 0 False False \n", "ACKr -8.69634 -8.69634 0 82.443 False False \n", "ACONTa 0.101495 0.101495 0 0 False False \n", "ACONTb 0.101495 0.101495 0 0 False False \n", "ACt2r -8.69634 -8.69634 0 82.443 False False \n", "ADK1 0.583116 0.583116 0 0 False False \n", "... ... ... ... ... ... ... \n", "SUCDi 990.126 0 0 0 False False \n", "SUCOAS 0 -1.88738e-14 0 0 False False \n", "TALA -0.0168296 -0.0168296 0 -0.141033 False False \n", "THD2 1.61298 1.61298 0 0 False False \n", "TKT1 -0.0168296 -0.0168296 0 -0.141033 False False \n", "TKT2 -0.0507897 -0.0507897 0 -0.425623 False False \n", "TPI 9.90643 9.90643 0 95.3064 False False \n", "\n", " suddenly_essential \n", "ACALD True \n", "ACALDt True \n", "ACKr True \n", "ACONTa False \n", "ACONTb False \n", "ACt2r True \n", "ADK1 False \n", "... ... \n", "SUCDi False \n", "SUCOAS True \n", "TALA True \n", "THD2 False \n", "TKT1 True \n", "TKT2 True \n", "TPI False \n", "\n", "[76 rows x 7 columns]" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "result" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", "\n", "\n", "\n", "
\n", "\n", " \n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "result.display_on_map(5, map_name=\"iJO1366.Central metabolism\")" ] } ], "metadata": { "kernelspec": { "display_name": "IPython (Python 3)", "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.2" } }, "nbformat": 4, "nbformat_minor": 0 }