{ "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": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "## Making sure you have cplex installed\n", "import cplex" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import re\n", "from cobra.io import read_sbml_model\n", "from cameo.strain_design import pathway_prediction" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "model = read_sbml_model('data/iMM904.xml.gz')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true, "scrolled": true }, "outputs": [], "source": [ "predictor = pathway_prediction.PathwayPredictor(model)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "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", " \n", "
equationlower_boundupper_bound
MNXR5340H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih...-10001000
MNXR53362.0 H(+) + NADH + vanillate <=> H2O + vanillin...-10001000
MNXR230H(+) + 4-hydroxybenzoate + O2 + NADPH <=> H2O ...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5340 H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih... -1000 \n", "MNXR5336 2.0 H(+) + NADH + vanillate <=> H2O + vanillin... -1000 \n", "MNXR230 H(+) + 4-hydroxybenzoate + O2 + NADPH <=> H2O ... -1000 \n", "\n", " upper_bound \n", "MNXR5340 1000 \n", "MNXR5336 1000 \n", "MNXR230 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Max flux: 1.90533\n" ] }, { "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", " \n", "
equationlower_boundupper_bound
MNXR5340H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih...-10001000
MNXR53362.0 H(+) + NADH + vanillate <=> H2O + vanillin...-10001000
MNXR68718H2O + 3,4-dihydroxybenzoate <=> 3-dehydroshiki...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5340 H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih... -1000 \n", "MNXR5336 2.0 H(+) + NADH + vanillate <=> H2O + vanillin... -1000 \n", "MNXR68718 H2O + 3,4-dihydroxybenzoate <=> 3-dehydroshiki... -1000 \n", "\n", " upper_bound \n", "MNXR5340 1000 \n", "MNXR5336 1000 \n", "MNXR68718 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Max flux: 3.36842\n" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \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
MNXR4008H(+) + 3-oxoadipate <=> H2O + 5-oxo-4,5-dihydr...-10001000
MNXR1843-oxoadipyl-CoA + succinate <=> 3-oxoadipate +...-10001000
MNXR5340H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih...-10001000
MNXR53362.0 H(+) + NADH + vanillate <=> H2O + vanillin...-10001000
MNXR228CO2 + 5-oxo-4,5-dihydro-2-furylacetate <=> H(+...-10001000
MNXR41192.0 H(+) + 3-carboxy-cis,cis-muconate <=> 3,4-...-10001000
MNXR209CoA + 3-oxoadipyl-CoA <=> acetyl-CoA + succiny...-10001000
MNXR36552-(carboxymethyl)-5-oxo-2,5-dihydro-2-furoate ...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR4008 H(+) + 3-oxoadipate <=> H2O + 5-oxo-4,5-dihydr... -1000 \n", "MNXR184 3-oxoadipyl-CoA + succinate <=> 3-oxoadipate +... -1000 \n", "MNXR5340 H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih... -1000 \n", "MNXR5336 2.0 H(+) + NADH + vanillate <=> H2O + vanillin... -1000 \n", "MNXR228 CO2 + 5-oxo-4,5-dihydro-2-furylacetate <=> H(+... -1000 \n", "MNXR4119 2.0 H(+) + 3-carboxy-cis,cis-muconate <=> 3,4-... -1000 \n", "MNXR209 CoA + 3-oxoadipyl-CoA <=> acetyl-CoA + succiny... -1000 \n", "MNXR3655 2-(carboxymethyl)-5-oxo-2,5-dihydro-2-furoate ... -1000 \n", "\n", " upper_bound \n", "MNXR4008 1000 \n", "MNXR184 1000 \n", "MNXR5340 1000 \n", "MNXR5336 1000 \n", "MNXR228 1000 \n", "MNXR4119 1000 \n", "MNXR209 1000 \n", "MNXR3655 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Max flux: 5.59223\n" ] }, { "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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \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
MNXR53382.0 H(+) + NADH + 3,4-dihydroxybenzoate <=> H2...-10001000
MNXR1041diphosphate + AMP + caffeoyl-CoA <=> CoA + ATP...-10001000
MNXR4974O2 + 2.0 trans-4-coumarate <=> 2.0 trans-caffeate-10001000
MNXR227diphosphate + AMP + 4-coumaroyl-CoA <=> CoA + ...-10001000
MNXR5340H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih...-10001000
MNXR53362.0 H(+) + NADH + vanillate <=> H2O + vanillin...-10001000
MNXR18369CoA + H2O + 4-coumaroyl-CoA + NAD(+) <=> H(+) ...-10001000
MNXR232H(+) + CoA + 4-hydroxybenzoate <=> H2O + 4-hyd...-10001000
MNXR1039acetyl-CoA + 3,4-dihydroxybenzaldehyde <=> H2O...-10001000
\n", "
" ], "text/plain": [ " equation lower_bound \\\n", "MNXR5338 2.0 H(+) + NADH + 3,4-dihydroxybenzoate <=> H2... -1000 \n", "MNXR1041 diphosphate + AMP + caffeoyl-CoA <=> CoA + ATP... -1000 \n", "MNXR4974 O2 + 2.0 trans-4-coumarate <=> 2.0 trans-caffeate -1000 \n", "MNXR227 diphosphate + AMP + 4-coumaroyl-CoA <=> CoA + ... -1000 \n", "MNXR5340 H(+) + NADH + O2 + vanillate <=> H2O + 3,4-dih... -1000 \n", "MNXR5336 2.0 H(+) + NADH + vanillate <=> H2O + vanillin... -1000 \n", "MNXR18369 CoA + H2O + 4-coumaroyl-CoA + NAD(+) <=> H(+) ... -1000 \n", "MNXR232 H(+) + CoA + 4-hydroxybenzoate <=> H2O + 4-hyd... -1000 \n", "MNXR1039 acetyl-CoA + 3,4-dihydroxybenzaldehyde <=> H2O... -1000 \n", "\n", " upper_bound \n", "MNXR5338 1000 \n", "MNXR1041 1000 \n", "MNXR4974 1000 \n", "MNXR227 1000 \n", "MNXR5340 1000 \n", "MNXR5336 1000 \n", "MNXR18369 1000 \n", "MNXR232 1000 \n", "MNXR1039 1000 " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Max flux: 2.24390\n" ] } ], "source": [ "pathways = predictor.run(product=\"vanillin\", max_predictions=4)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This is the format of your plot grid:\n", "[ (1,1) x1,y1 ] [ (1,2) x2,y2 ]\n", "[ (2,1) x3,y3 ] [ (2,2) x4,y4 ]\n", "\n" ] }, { "data": { "text/html": [ "" ], "text/vnd.plotly.v1+html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "data": [ { "fill": "toself", "fillcolor": "#B3E2CD", "hoverinfo": "none", "marker": { "line": { "color": "#B3E2CD" }, "opacity": 0.3 }, "mode": "line", "name": "WT", "opacity": 0.3, "type": "scatter", "x": [ 0, 0.015150826510737757, 0.030301653021475514, 0.04545247953221327, 0.06060330604295103, 0.07575413255368879, 0.09090495906442654, 0.10605578557516429, 0.12120661208590205, 0.13635743859663982, 0.15150826510737758, 0.16665909161811532, 0.18180991812885308, 0.19696074463959085, 0.21211157115032858, 0.22726239766106635, 0.2424132241718041, 0.25756405068254185, 0.27271487719327964, 0.2878657037040174, 0.2878657037040174, 0.27271487719327964, 0.25756405068254185, 0.2424132241718041, 0.22726239766106635, 0.21211157115032858, 0.19696074463959085, 0.18180991812885308, 0.16665909161811532, 0.15150826510737758, 0.13635743859663982, 0.12120661208590205, 0.10605578557516429, 0.09090495906442654, 0.07575413255368879, 0.06060330604295103, 0.04545247953221327, 0.030301653021475514, 0.015150826510737757, 0, 0, 0 ], "xaxis": "x1", "y": [ 0, -4.2549213257374257e-16, 4.549206539927471e-17, -3.3306690738754696e-16, 2.3314683517128287e-15, -1.5413018084053931e-15, 2.609024107869118e-15, 0, -4.551914400963142e-15, 3.887948990533018e-16, 3.219646771412954e-15, 0, 1.7162197588997212e-15, -1.7948605564773365e-15, 0, 0, 0, 0, -4.3021142204224816e-16, 0, -2.5807141860603532e-14, 0.10587001500621684, 0.2109468334643466, 0.31602365192251314, 0.42078896773675556, 0.5253460487659192, 0.6299031297951616, 0.7342299103776192, 0.8354770791226925, 0.9329929217191597, 1.0302261739259329, 1.1274594261327329, 1.224692678339508, 1.3219259305462772, 1.4191591827530659, 1.516392434959843, 1.6136256871666286, 1.7108589393734155, 1.8080921915801937, 1.905325443786982, 0, 1.905325443786982 ], "yaxis": "y1" }, { "fill": "toself", "fillcolor": "#B3E2CD", "hoverinfo": "none", "marker": { "line": { "color": "#B3E2CD" }, "opacity": 0.3 }, "mode": "line", "name": "WT", "opacity": 0.3, "type": "scatter", "x": [ 0, 0.015150826510737684, 0.030301653021475368, 0.045452479532213055, 0.060603306042950736, 0.07575413255368842, 0.09090495906442611, 0.10605578557516379, 0.12120661208590147, 0.13635743859663915, 0.15150826510737683, 0.1666590916181145, 0.18180991812885222, 0.1969607446395899, 0.21211157115032758, 0.22726239766106526, 0.24241322417180294, 0.2575640506825406, 0.2727148771932783, 0.287865703704016, 0.287865703704016, 0.2727148771932783, 0.2575640506825406, 0.24241322417180294, 0.22726239766106526, 0.21211157115032758, 0.1969607446395899, 0.18180991812885222, 0.1666590916181145, 0.15150826510737683, 0.13635743859663915, 0.12120661208590147, 0.10605578557516379, 0.09090495906442611, 0.07575413255368842, 0.060603306042950736, 0.045452479532213055, 0.030301653021475368, 0.015150826510737684, 0, 0, 0 ], "xaxis": "x2", "y": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9.317592466449263e-14, 0.17882452650702219, 0.35630926858944795, 0.5337940106718836, 0.7112787527543039, 0.8887634948367396, 1.0662482369191637, 1.2437329790015998, 1.4212177210840344, 1.598702463166458, 1.776187205248919, 1.953671947331248, 2.1311566894137437, 2.308641431496142, 2.486126173578582, 2.663610915660994, 2.841095657743408, 3.018580399825894, 3.1947467190008907, 3.3684210526315645, 0, 3.3684210526315645 ], "yaxis": "y2" }, { "fill": "toself", "fillcolor": "#B3E2CD", "hoverinfo": "none", "marker": { "line": { "color": "#B3E2CD" }, "opacity": 0.3 }, "mode": "line", "name": "WT", "opacity": 0.3, "type": "scatter", "x": [ 0, 0.015153230613312627, 0.030306461226625253, 0.04545969183993788, 0.060612922453250506, 0.07576615306656313, 0.09091938367987576, 0.10607261429318839, 0.12122584490650101, 0.13637907551981365, 0.15153230613312627, 0.16668553674643888, 0.18183876735975152, 0.19699199797306416, 0.21214522858637677, 0.22729845919968938, 0.24245168981300202, 0.25760492042631467, 0.2727581510396273, 0.2879113816529399, 0.2879113816529399, 0.2727581510396273, 0.25760492042631467, 0.24245168981300202, 0.22729845919968938, 0.21214522858637677, 0.19699199797306416, 0.18183876735975152, 0.16668553674643888, 0.15153230613312627, 0.13637907551981365, 0.12122584490650101, 0.10607261429318839, 0.09091938367987576, 0.07576615306656313, 0.060612922453250506, 0.04545969183993788, 0.030306461226625253, 0.015153230613312627, 0, 0, 0 ], "xaxis": "x3", "y": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.001488501843245426, 0.0014885018430793923, 0.32984928320076795, 0.6582100645585559, 0.9781711038579864, 1.2665499729736696, 1.554928842089343, 1.8433077112049832, 2.1316865803206753, 2.4200654494363296, 2.7084443185520195, 2.9968231876675753, 3.2852020567833944, 3.5735809258989977, 3.8619597950147195, 4.150338664130354, 4.4387175332460505, 4.727096402361686, 5.015475271477397, 5.3038541405930655, 5.5922330097087345, 0, 5.5922330097087345 ], "yaxis": "y3" }, { "fill": "toself", "fillcolor": "#B3E2CD", "hoverinfo": "none", "marker": { "line": { "color": "#B3E2CD" }, "opacity": 0.3 }, "mode": "line", "name": "WT", "opacity": 0.3, "type": "scatter", "x": [ 0, 0.015150826510737762, 0.030301653021475524, 0.045452479532213284, 0.06060330604295105, 0.0757541325536888, 0.09090495906442657, 0.10605578557516433, 0.1212066120859021, 0.13635743859663985, 0.1515082651073776, 0.16665909161811537, 0.18180991812885314, 0.1969607446395909, 0.21211157115032866, 0.22726239766106643, 0.2424132241718042, 0.25756405068254196, 0.2727148771932797, 0.2878657037040175, 0.2878657037040175, 0.2727148771932797, 0.25756405068254196, 0.2424132241718042, 0.22726239766106643, 0.21211157115032866, 0.1969607446395909, 0.18180991812885314, 0.16665909161811537, 0.1515082651073776, 0.13635743859663985, 0.1212066120859021, 0.10605578557516433, 0.09090495906442657, 0.0757541325536888, 0.06060330604295105, 0.045452479532213284, 0.030301653021475524, 0.015150826510737762, 0, 0, 0 ], "xaxis": "x4", "y": [ -6.162975822039155e-33, 4.440892098500626e-16, -6.142005307130383e-16, 6.487865800153259e-16, 1.4432899320127035e-15, -7.945033519973776e-16, 0, 0, 3.3306690738754696e-16, -6.661338147750939e-16, 0, -3.3306690738754696e-15, 0, 0, 5.551115123125783e-17, 0, 4.0245584642661925e-16, -5.342948306008566e-16, 1.3877787807814457e-17, -7.042977312465837e-16, -1.1917550279960665e-14, 0.12052129933467777, 0.24013963215333012, 0.3597579649719723, 0.4793762977906275, 0.5989946306092716, 0.7186129634279205, 0.8382312962465754, 0.9578496290652223, 1.0773265884037864, 1.1967046964108152, 1.3160828044178399, 1.4354609124248585, 1.5546339029164304, 1.6713442640088463, 1.7858558990119546, 1.9003675340150514, 2.0148791690181627, 2.1293908040212792, 2.243902439024401, -6.162975822039155e-33, 2.243902439024401 ], "yaxis": "y4" } ], "layout": { "annotations": [ { "font": { "size": 16 }, "showarrow": false, "text": "Pathway 1", "x": 0.225, "xanchor": "center", "xref": "paper", "y": 1, "yanchor": "bottom", "yref": "paper" }, { "font": { "size": 16 }, "showarrow": false, "text": "Pathway 2", "x": 0.775, "xanchor": "center", "xref": "paper", "y": 1, "yanchor": "bottom", "yref": "paper" }, { "font": { "size": 16 }, "showarrow": false, "text": "Pathway 3", "x": 0.225, "xanchor": "center", "xref": "paper", "y": 0.375, "yanchor": "bottom", "yref": "paper" }, { "font": { "size": 16 }, "showarrow": false, "text": "Pathway 4", "x": 0.775, "xanchor": "center", "xref": "paper", "y": 0.375, "yanchor": "bottom", "yref": "paper" } ], "height": null, "width": null, "xaxis1": { "anchor": "y1", "domain": [ 0, 0.45 ] }, "xaxis2": { "anchor": "y2", "domain": [ 0.55, 1 ] }, "xaxis3": { "anchor": "y3", "domain": [ 0, 0.45 ] }, "xaxis4": { "anchor": "y4", "domain": [ 0.55, 1 ] }, "yaxis1": { "anchor": "x1", "domain": [ 0.625, 1 ] }, "yaxis2": { "anchor": "x2", "domain": [ 0.625, 1 ] }, "yaxis3": { "anchor": "x3", "domain": [ 0, 0.375 ] }, "yaxis4": { "anchor": "x4", "domain": [ 0, 0.375 ] } } }, "text/html": [ "
" ], "text/vnd.plotly.v1+html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pathways.plot_production_envelopes(model, objective=model.reactions.BIOMASS_SC5_notrace)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Exercise (30 min)\n", "\n", "* Predict pathways for a desired product of your choice and organism.\n", "* Do predictions change if you use a different 'universal' reaction database (other databases are available under `cameo.models.universal`)?" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from cameo.models import universal" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Namemetanetx_universal_model_bigg_rhea_kegg
Memory address0x0125436400
Number of metabolites9478
Number of reactions21270
Objective expression0
Compartments
" ], "text/plain": [ " at 0x125436400 with factory functools.partial(, '/Users/henred/proj/cameo/cameo/models/universal_models/metanetx_universal_model_bigg_rhea_kegg.json')>" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "universal.metanetx_universal_model_bigg_rhea_kegg" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": true }, "outputs": [], "source": [ "predictor2 = pathway_prediction.PathwayPredictor(model=model,\n", " universal_model=universal.metanetx_universal_model_bigg_rhea_kegg)" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [conda env:cell-factory-course]", "language": "python", "name": "conda-env-cell-factory-course-py" }, "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": 1 }