{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Analyzing models\n",
"\n",
"**cameo** uses the model data structures defined by [cobrapy](https://opencobra.github.io/cobrapy/), our favorite **CO**nstraints-**B**ased **R**econstruction and **A**nalysis tool for **Py**thon. **cameo** is thus 100% compatible with **cobrapy**. For efficiency reasons though **cameo** implements its own analysis methods that take advantage of a more advanced solver interface."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from cameo import models\n",
"model = models.bigg.e_coli_core"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Flux Variability Analysis\n",
"\n",
"Flux variability analysis (FVA) enables the computation of lower and upper bounds of reaction fluxes."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from cameo import flux_variability_analysis"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" lower_bound | \n",
" upper_bound | \n",
"
\n",
" \n",
" \n",
" \n",
" ACALD | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACALDt | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACKr | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACONTa | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" ACONTb | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" ACt2r | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ADK1 | \n",
" 0.000000 | \n",
" 166.610000 | \n",
"
\n",
" \n",
" AKGDH | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" AKGt2r | \n",
" -10.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ALCD2x | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ATPM | \n",
" 8.390000 | \n",
" 175.000000 | \n",
"
\n",
" \n",
" ATPS4r | \n",
" -31.610000 | \n",
" 150.000000 | \n",
"
\n",
" \n",
" BIOMASS_Ecoli_core_w_GAM | \n",
" 0.000000 | \n",
" 0.873922 | \n",
"
\n",
" \n",
" CO2t | \n",
" -60.000000 | \n",
" 11.104242 | \n",
"
\n",
" \n",
" CS | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" CYTBD | \n",
" 0.000000 | \n",
" 120.000000 | \n",
"
\n",
" \n",
" D_LACt2 | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ENO | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" ETOHt2r | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_ac_e | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" EX_acald_e | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" EX_akg_e | \n",
" 0.000000 | \n",
" 10.000000 | \n",
"
\n",
" \n",
" EX_co2_e | \n",
" -11.104242 | \n",
" 60.000000 | \n",
"
\n",
" \n",
" EX_etoh_e | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" EX_for_e | \n",
" 0.000000 | \n",
" 40.000000 | \n",
"
\n",
" \n",
" EX_fru_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_fum_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_glc__D_e | \n",
" -10.000000 | \n",
" -0.479429 | \n",
"
\n",
" \n",
" EX_gln__L_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_glu__L_e | \n",
" 0.000000 | \n",
" 10.000000 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" ME2 | \n",
" 0.000000 | \n",
" 98.305000 | \n",
"
\n",
" \n",
" NADH16 | \n",
" 0.000000 | \n",
" 120.000000 | \n",
"
\n",
" \n",
" NADTRHD | \n",
" 0.000000 | \n",
" 378.220000 | \n",
"
\n",
" \n",
" NH4t | \n",
" 0.000000 | \n",
" 10.000000 | \n",
"
\n",
" \n",
" O2t | \n",
" 0.000000 | \n",
" 60.000000 | \n",
"
\n",
" \n",
" PDH | \n",
" 0.000000 | \n",
" 40.000000 | \n",
"
\n",
" \n",
" PFK | \n",
" 0.000000 | \n",
" 176.610000 | \n",
"
\n",
" \n",
" PFL | \n",
" 0.000000 | \n",
" 40.000000 | \n",
"
\n",
" \n",
" PGI | \n",
" -50.000000 | \n",
" 10.000000 | \n",
"
\n",
" \n",
" PGK | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" PGL | \n",
" 0.000000 | \n",
" 60.000000 | \n",
"
\n",
" \n",
" PGM | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" PIt2r | \n",
" 0.000000 | \n",
" 3.214895 | \n",
"
\n",
" \n",
" PPC | \n",
" 0.000000 | \n",
" 166.610000 | \n",
"
\n",
" \n",
" PPCK | \n",
" 0.000000 | \n",
" 166.610000 | \n",
"
\n",
" \n",
" PPS | \n",
" 0.000000 | \n",
" 166.610000 | \n",
"
\n",
" \n",
" PTAr | \n",
" 0.000000 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" PYK | \n",
" 0.000000 | \n",
" 176.610000 | \n",
"
\n",
" \n",
" PYRt2 | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" RPE | \n",
" -0.620909 | \n",
" 40.000000 | \n",
"
\n",
" \n",
" RPI | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" SUCCt2_2 | \n",
" 0.000000 | \n",
" 222.146667 | \n",
"
\n",
" \n",
" SUCCt3 | \n",
" 0.000000 | \n",
" 222.146667 | \n",
"
\n",
" \n",
" SUCDi | \n",
" 0.000000 | \n",
" 1000.000000 | \n",
"
\n",
" \n",
" SUCOAS | \n",
" -20.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" TALA | \n",
" -0.154536 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" THD2 | \n",
" 0.000000 | \n",
" 333.220000 | \n",
"
\n",
" \n",
" TKT1 | \n",
" -0.154536 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" TKT2 | \n",
" -0.466373 | \n",
" 20.000000 | \n",
"
\n",
" \n",
" TPI | \n",
" -10.000000 | \n",
" 10.000000 | \n",
"
\n",
" \n",
"
\n",
"
95 rows × 2 columns
\n",
"
"
],
"text/plain": [
" lower_bound upper_bound\n",
"ACALD -20.000000 0.000000\n",
"ACALDt -20.000000 0.000000\n",
"ACKr -20.000000 0.000000\n",
"ACONTa 0.000000 20.000000\n",
"ACONTb 0.000000 20.000000\n",
"ACt2r -20.000000 0.000000\n",
"ADK1 0.000000 166.610000\n",
"AKGDH 0.000000 20.000000\n",
"AKGt2r -10.000000 0.000000\n",
"ALCD2x -20.000000 0.000000\n",
"ATPM 8.390000 175.000000\n",
"ATPS4r -31.610000 150.000000\n",
"BIOMASS_Ecoli_core_w_GAM 0.000000 0.873922\n",
"CO2t -60.000000 11.104242\n",
"CS 0.000000 20.000000\n",
"CYTBD 0.000000 120.000000\n",
"D_LACt2 -20.000000 0.000000\n",
"ENO 0.000000 20.000000\n",
"ETOHt2r -20.000000 0.000000\n",
"EX_ac_e 0.000000 20.000000\n",
"EX_acald_e 0.000000 20.000000\n",
"EX_akg_e 0.000000 10.000000\n",
"EX_co2_e -11.104242 60.000000\n",
"EX_etoh_e 0.000000 20.000000\n",
"EX_for_e 0.000000 40.000000\n",
"EX_fru_e 0.000000 0.000000\n",
"EX_fum_e 0.000000 0.000000\n",
"EX_glc__D_e -10.000000 -0.479429\n",
"EX_gln__L_e 0.000000 0.000000\n",
"EX_glu__L_e 0.000000 10.000000\n",
"... ... ...\n",
"ME2 0.000000 98.305000\n",
"NADH16 0.000000 120.000000\n",
"NADTRHD 0.000000 378.220000\n",
"NH4t 0.000000 10.000000\n",
"O2t 0.000000 60.000000\n",
"PDH 0.000000 40.000000\n",
"PFK 0.000000 176.610000\n",
"PFL 0.000000 40.000000\n",
"PGI -50.000000 10.000000\n",
"PGK -20.000000 0.000000\n",
"PGL 0.000000 60.000000\n",
"PGM -20.000000 0.000000\n",
"PIt2r 0.000000 3.214895\n",
"PPC 0.000000 166.610000\n",
"PPCK 0.000000 166.610000\n",
"PPS 0.000000 166.610000\n",
"PTAr 0.000000 20.000000\n",
"PYK 0.000000 176.610000\n",
"PYRt2 -20.000000 0.000000\n",
"RPE -0.620909 40.000000\n",
"RPI -20.000000 0.000000\n",
"SUCCt2_2 0.000000 222.146667\n",
"SUCCt3 0.000000 222.146667\n",
"SUCDi 0.000000 1000.000000\n",
"SUCOAS -20.000000 0.000000\n",
"TALA -0.154536 20.000000\n",
"THD2 0.000000 333.220000\n",
"TKT1 -0.154536 20.000000\n",
"TKT2 -0.466373 20.000000\n",
"TPI -10.000000 10.000000\n",
"\n",
"[95 rows x 2 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fva_result = flux_variability_analysis(model)\n",
"fva_result.data_frame"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"fillcolor": "#B3E2CD",
"hoverinfo": "none",
"mode": "markers",
"name": "WT",
"opacity": 0.3,
"type": "scatter",
"x": [
-10,
-10,
-10,
10,
10,
-10,
83.305,
10,
-5,
-10,
91.695,
59.19499999999997,
0.4369607534842152,
-24.447878787878786,
10,
60,
-10,
10,
-10,
10,
10,
5,
24.447878787878786,
10,
20
],
"y": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
}
],
"layout": {
"height": 432,
"shapes": [
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 0.5,
"y1": 1.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 1.5,
"y1": 2.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 2.5,
"y1": 3.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 3.5,
"y1": 4.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 4.5,
"y1": 5.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 5.5,
"y1": 6.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 166.61,
"x1": 0,
"y0": 6.5,
"y1": 7.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 7.5,
"y1": 8.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -10,
"y0": 8.5,
"y1": 9.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 9.5,
"y1": 10.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 175,
"x1": 8.39,
"y0": 10.5,
"y1": 11.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 149.99999999999994,
"x1": -31.61,
"y0": 11.5,
"y1": 12.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0.8739215069684304,
"x1": 0,
"y0": 12.5,
"y1": 13.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 11.104242424242424,
"x1": -59.99999999999999,
"y0": 13.5,
"y1": 14.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 14.5,
"y1": 15.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 120,
"x1": 0,
"y0": 15.5,
"y1": 16.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 16.5,
"y1": 17.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 17.5,
"y1": 18.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -20,
"y0": 18.5,
"y1": 19.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 19.5,
"y1": 20.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 20.5,
"y1": 21.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 10,
"x1": 0,
"y0": 21.5,
"y1": 22.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 59.99999999999999,
"x1": -11.104242424242424,
"y0": 22.5,
"y1": 23.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 20,
"x1": 0,
"y0": 23.5,
"y1": 24.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 40,
"x1": 0,
"y0": 24.5,
"y1": 25.5
}
],
"title": "Flux Variability Analysis",
"width": 700,
"xaxis": {
"title": "Flux limits"
},
"yaxis": {
"ticktext": [
"",
"ACALD",
"ACALDt",
"ACKr",
"ACONTa",
"ACONTb",
"ACt2r",
"ADK1",
"AKGDH",
"AKGt2r",
"ALCD2x",
"ATPM",
"ATPS4r",
"BIOMASS_Ecoli_core_w_GAM",
"CO2t",
"CS",
"CYTBD",
"D_LACt2",
"ENO",
"ETOHt2r",
"EX_ac_e",
"EX_acald_e",
"EX_akg_e",
"EX_co2_e",
"EX_etoh_e",
"EX_for_e"
],
"tickvals": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
],
"title": "Reactions"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fva_result.plot(index=fva_result.data_frame.index[:25])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One very useful application of FVA is determining if alternative optimal solution exist."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" lower_bound | \n",
" upper_bound | \n",
"
\n",
" \n",
" \n",
" \n",
" ACALD | \n",
" -12.602453 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACALDt | \n",
" -12.602453 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACKr | \n",
" -13.358852 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ACONTa | \n",
" 0.471437 | \n",
" 13.830289 | \n",
"
\n",
" \n",
" ACONTb | \n",
" 0.471437 | \n",
" 13.830289 | \n",
"
\n",
" \n",
" ACt2r | \n",
" -13.358852 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ADK1 | \n",
" 0.000000 | \n",
" 84.338330 | \n",
"
\n",
" \n",
" AKGDH | \n",
" 0.000000 | \n",
" 13.358852 | \n",
"
\n",
" \n",
" AKGt2r | \n",
" -6.679426 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ALCD2x | \n",
" -11.071613 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ATPM | \n",
" 8.390000 | \n",
" 92.728330 | \n",
"
\n",
" \n",
" ATPS4r | \n",
" 5.298677 | \n",
" 99.656146 | \n",
"
\n",
" \n",
" BIOMASS_Ecoli_core_w_GAM | \n",
" 0.436961 | \n",
" 0.873922 | \n",
"
\n",
" \n",
" CO2t | \n",
" -41.404917 | \n",
" 0.925477 | \n",
"
\n",
" \n",
" CS | \n",
" 0.471437 | \n",
" 13.830289 | \n",
"
\n",
" \n",
" CYTBD | \n",
" 12.517553 | \n",
" 81.799493 | \n",
"
\n",
" \n",
" D_LACt2 | \n",
" -10.725625 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" ENO | \n",
" 4.825882 | \n",
" 18.184734 | \n",
"
\n",
" \n",
" ETOHt2r | \n",
" -11.071613 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_ac_e | \n",
" 0.000000 | \n",
" 13.358852 | \n",
"
\n",
" \n",
" EX_acald_e | \n",
" 0.000000 | \n",
" 12.602453 | \n",
"
\n",
" \n",
" EX_akg_e | \n",
" 0.000000 | \n",
" 6.679426 | \n",
"
\n",
" \n",
" EX_co2_e | \n",
" -0.925477 | \n",
" 41.404917 | \n",
"
\n",
" \n",
" EX_etoh_e | \n",
" 0.000000 | \n",
" 11.071613 | \n",
"
\n",
" \n",
" EX_for_e | \n",
" 0.000000 | \n",
" 28.826782 | \n",
"
\n",
" \n",
" EX_fru_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_fum_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_glc__D_e | \n",
" -10.000000 | \n",
" -5.233056 | \n",
"
\n",
" \n",
" EX_gln__L_e | \n",
" 0.000000 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" EX_glu__L_e | \n",
" 0.000000 | \n",
" 6.281521 | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" ME2 | \n",
" 0.000000 | \n",
" 52.201468 | \n",
"
\n",
" \n",
" NADH16 | \n",
" 12.517553 | \n",
" 81.799493 | \n",
"
\n",
" \n",
" NADTRHD | \n",
" 0.000000 | \n",
" 193.989678 | \n",
"
\n",
" \n",
" NH4t | \n",
" 2.382660 | \n",
" 8.664181 | \n",
"
\n",
" \n",
" O2t | \n",
" 6.258776 | \n",
" 40.899746 | \n",
"
\n",
" \n",
" PDH | \n",
" 0.000000 | \n",
" 28.826782 | \n",
"
\n",
" \n",
" PFK | \n",
" 0.000000 | \n",
" 93.903685 | \n",
"
\n",
" \n",
" PFL | \n",
" 0.000000 | \n",
" 28.826782 | \n",
"
\n",
" \n",
" PGI | \n",
" -30.166133 | \n",
" 9.910423 | \n",
"
\n",
" \n",
" PGK | \n",
" -18.838427 | \n",
" -5.479575 | \n",
"
\n",
" \n",
" PGL | \n",
" 0.000000 | \n",
" 40.076556 | \n",
"
\n",
" \n",
" PGM | \n",
" -18.184734 | \n",
" -4.825882 | \n",
"
\n",
" \n",
" PIt2r | \n",
" 1.607448 | \n",
" 3.214895 | \n",
"
\n",
" \n",
" PPC | \n",
" 0.000000 | \n",
" 85.590485 | \n",
"
\n",
" \n",
" PPCK | \n",
" 0.000000 | \n",
" 84.338330 | \n",
"
\n",
" \n",
" PPS | \n",
" 0.000000 | \n",
" 84.338330 | \n",
"
\n",
" \n",
" PTAr | \n",
" 0.000000 | \n",
" 13.358852 | \n",
"
\n",
" \n",
" PYK | \n",
" 0.000000 | \n",
" 92.296238 | \n",
"
\n",
" \n",
" PYRt2 | \n",
" -12.602453 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" RPE | \n",
" -0.620909 | \n",
" 26.403617 | \n",
"
\n",
" \n",
" RPI | \n",
" -13.672939 | \n",
" -0.314087 | \n",
"
\n",
" \n",
" SUCCt2_2 | \n",
" 0.000000 | \n",
" 112.451107 | \n",
"
\n",
" \n",
" SUCCt3 | \n",
" 0.000000 | \n",
" 112.451107 | \n",
"
\n",
" \n",
" SUCDi | \n",
" 0.000000 | \n",
" 1000.000000 | \n",
"
\n",
" \n",
" SUCOAS | \n",
" -13.358852 | \n",
" 0.000000 | \n",
"
\n",
" \n",
" TALA | \n",
" -0.154536 | \n",
" 13.280680 | \n",
"
\n",
" \n",
" THD2 | \n",
" 0.000000 | \n",
" 168.676660 | \n",
"
\n",
" \n",
" TKT1 | \n",
" -0.154536 | \n",
" 13.280680 | \n",
"
\n",
" \n",
" TKT2 | \n",
" -0.466373 | \n",
" 13.122937 | \n",
"
\n",
" \n",
" TPI | \n",
" -3.793497 | \n",
" 9.565355 | \n",
"
\n",
" \n",
"
\n",
"
95 rows × 2 columns
\n",
"
"
],
"text/plain": [
" lower_bound upper_bound\n",
"ACALD -12.602453 0.000000\n",
"ACALDt -12.602453 0.000000\n",
"ACKr -13.358852 0.000000\n",
"ACONTa 0.471437 13.830289\n",
"ACONTb 0.471437 13.830289\n",
"ACt2r -13.358852 0.000000\n",
"ADK1 0.000000 84.338330\n",
"AKGDH 0.000000 13.358852\n",
"AKGt2r -6.679426 0.000000\n",
"ALCD2x -11.071613 0.000000\n",
"ATPM 8.390000 92.728330\n",
"ATPS4r 5.298677 99.656146\n",
"BIOMASS_Ecoli_core_w_GAM 0.436961 0.873922\n",
"CO2t -41.404917 0.925477\n",
"CS 0.471437 13.830289\n",
"CYTBD 12.517553 81.799493\n",
"D_LACt2 -10.725625 0.000000\n",
"ENO 4.825882 18.184734\n",
"ETOHt2r -11.071613 0.000000\n",
"EX_ac_e 0.000000 13.358852\n",
"EX_acald_e 0.000000 12.602453\n",
"EX_akg_e 0.000000 6.679426\n",
"EX_co2_e -0.925477 41.404917\n",
"EX_etoh_e 0.000000 11.071613\n",
"EX_for_e 0.000000 28.826782\n",
"EX_fru_e 0.000000 0.000000\n",
"EX_fum_e 0.000000 0.000000\n",
"EX_glc__D_e -10.000000 -5.233056\n",
"EX_gln__L_e 0.000000 0.000000\n",
"EX_glu__L_e 0.000000 6.281521\n",
"... ... ...\n",
"ME2 0.000000 52.201468\n",
"NADH16 12.517553 81.799493\n",
"NADTRHD 0.000000 193.989678\n",
"NH4t 2.382660 8.664181\n",
"O2t 6.258776 40.899746\n",
"PDH 0.000000 28.826782\n",
"PFK 0.000000 93.903685\n",
"PFL 0.000000 28.826782\n",
"PGI -30.166133 9.910423\n",
"PGK -18.838427 -5.479575\n",
"PGL 0.000000 40.076556\n",
"PGM -18.184734 -4.825882\n",
"PIt2r 1.607448 3.214895\n",
"PPC 0.000000 85.590485\n",
"PPCK 0.000000 84.338330\n",
"PPS 0.000000 84.338330\n",
"PTAr 0.000000 13.358852\n",
"PYK 0.000000 92.296238\n",
"PYRt2 -12.602453 0.000000\n",
"RPE -0.620909 26.403617\n",
"RPI -13.672939 -0.314087\n",
"SUCCt2_2 0.000000 112.451107\n",
"SUCCt3 0.000000 112.451107\n",
"SUCDi 0.000000 1000.000000\n",
"SUCOAS -13.358852 0.000000\n",
"TALA -0.154536 13.280680\n",
"THD2 0.000000 168.676660\n",
"TKT1 -0.154536 13.280680\n",
"TKT2 -0.466373 13.122937\n",
"TPI -3.793497 9.565355\n",
"\n",
"[95 rows x 2 columns]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fva_result2 = flux_variability_analysis(model,fraction_of_optimum=0.5)\n",
"fva_result2.data_frame"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"fillcolor": "#B3E2CD",
"hoverinfo": "none",
"mode": "markers",
"name": "WT",
"opacity": 0.3,
"type": "scatter",
"x": [
-6.301226350813717,
-6.301226350813717,
-6.679425994085078,
7.150862951019199,
7.150862951019199,
-6.679425994085078,
42.16916509839322,
6.67942599408508,
-3.33971299704254,
-5.535806451612918
],
"y": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
]
}
],
"layout": {
"height": 432,
"shapes": [
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -12.602452701627435,
"y0": 0.5,
"y1": 1.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -12.602452701627435,
"y0": 1.5,
"y1": 2.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -13.358851988170157,
"y0": 2.5,
"y1": 3.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 13.830288945104279,
"x1": 0.47143695693411947,
"y0": 3.5,
"y1": 4.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 13.830288945104279,
"x1": 0.47143695693411947,
"y0": 4.5,
"y1": 5.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -13.358851988170157,
"y0": 5.5,
"y1": 6.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 84.33833019678644,
"x1": 0,
"y0": 6.5,
"y1": 7.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 13.35885198817016,
"x1": 0,
"y0": 7.5,
"y1": 8.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -6.67942599408508,
"y0": 8.5,
"y1": 9.5
},
{
"fillcolor": "#B3E2CD",
"line": {
"color": "#B3E2CD",
"width": 0
},
"opacity": 0.3,
"type": "rect",
"x0": 0,
"x1": -11.071612903225835,
"y0": 9.5,
"y1": 10.5
}
],
"title": "Flux Variability Analysis",
"width": 700,
"xaxis": {
"title": "Flux limits"
},
"yaxis": {
"ticktext": [
"",
"ACALD",
"ACALDt",
"ACKr",
"ACONTa",
"ACONTb",
"ACt2r",
"ADK1",
"AKGDH",
"AKGt2r",
"ALCD2x"
],
"tickvals": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10
],
"title": "Reactions"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fva_result2.plot()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from cameo.visualization import plotting"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Phenotypic Phase Plane\n",
"--------------------\n",
"\n",
"The phenotypic phase plane is a modeling technique was developed to do a theoretical accessement of what cell can or cannot do in terms of the stoichiometric constraints [Edawards *et al.* 2001]. \n",
"\n",
"The phenotipic phase plane between growth and a product of interest yields the production envelope: a representation between the trade of between production of the desired product and growth."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"from cameo import phenotypic_phase_plane"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"model.reactions.EX_o2_e.lower_bound = -10\n",
"result = phenotypic_phase_plane(model, \n",
" variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM],\n",
" objective=model.reactions.EX_succ_e,\n",
" points=10)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"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.06211673330133617,
0.12423346660267234,
0.18635019990400853,
0.2484669332053447,
0.31058366650668084,
0.37270039980801706,
0.4348171331093532,
0.4969338664106894,
0.5590505997120255,
0.5590505997120255,
0.4969338664106894,
0.4348171331093532,
0.37270039980801706,
0.31058366650668084,
0.2484669332053447,
0.18635019990400853,
0.12423346660267234,
0.06211673330133617,
0,
0,
0
],
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4.3798766917375955,
6.814195460874885,
9.190730513378575,
10.684340589920453,
11.83019587619151,
12.97407991251248,
14.110775497230406,
15.24747108194856,
16.3841666666666,
0,
16.3841666666666
]
}
],
"layout": {
"height": 432,
"title": "Phenotypic Phase Plane (flux)",
"width": 700,
"xaxis": {
"title": "BIOMASS_Ecoli_core_w_GAM [h^-1]"
},
"yaxis": {
"title": "EX_succ_e [mmol gDW^-1 h^-1]"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The production envelope allows is a quick way to inspect the limitations of the system to design and how the production relates for with growth. In the previous example, succinate prudction is completly decoupled from growth and by decreasing the growth rate it is theoretically possible to produce up to 15 times more succinate. "
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"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.06211673330133617,
0.12423346660267234,
0.18635019990400853,
0.2484669332053447,
0.31058366650668084,
0.37270039980801706,
0.4348171331093532,
0.4969338664106894,
0.5590505997120255,
0.5590505997120255,
0.4969338664106894,
0.4348171331093532,
0.37270039980801706,
0.31058366650668084,
0.2484669332053447,
0.18635019990400853,
0.12423346660267234,
0.06211673330133617,
0,
0,
0
],
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
4.3798766917375955,
6.814195460874885,
9.190730513378575,
10.684340589920453,
11.83019587619151,
12.97407991251248,
14.110775497230406,
15.24747108194856,
16.3841666666666,
0,
16.3841666666666
]
},
{
"marker": {
"color": [
"green",
"red"
]
},
"mode": "markers",
"name": "Data Points",
"type": "scatter",
"x": [
0.52,
0.23
],
"y": [
0,
12.2
]
}
],
"layout": {
"height": 432,
"title": "Phenotypic Phase Plane (flux)",
"width": 700,
"xaxis": {
"title": "BIOMASS_Ecoli_core_w_GAM [h^-1]"
},
"yaxis": {
"title": "EX_succ_e [mmol gDW^-1 h^-1]"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result.plot(points=[(0.52, 0), (0.23, 12.2)], points_colors=[\"green\", \"red\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The production envelope can show the coupling between growth and production. There is no stoichiometric couple between growth and production for succinate under aerobic conditions, but that is not the case for acetate under anaerobic conditions."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"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.029423715774317058,
0.058847431548634116,
0.08827114732295117,
0.11769486309726823,
0.1471185788715853,
0.17654229464590235,
0.2059660104202194,
0.23538972619453646,
0.26481344196885354,
0.2942371577431706,
0.3236608735174876,
0.3530845892918047,
0.38250830506612177,
0.4119320208404388,
0.44135573661475586,
0.4707794523890729,
0.5002031681633899,
0.5296268839377071,
0.5590505997120241,
0.5590505997120241,
0.5296268839377071,
0.5002031681633899,
0.4707794523890729,
0.44135573661475586,
0.4119320208404388,
0.38250830506612177,
0.3530845892918047,
0.3236608735174876,
0.2942371577431706,
0.26481344196885354,
0.23538972619453646,
0.2059660104202194,
0.17654229464590235,
0.1471185788715853,
0.11769486309726823,
0.08827114732295117,
0.058847431548634116,
0.029423715774317058,
0,
0,
0
],
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2.627960120303466,
9.905679878989176,
11.503269460276801,
11.950465804472762,
12.397662148668719,
12.844858492864677,
13.292054837060633,
13.739251181256595,
14.186447525452547,
14.63364386964851,
15.080840213844464,
15.528036558040423,
15.97523290223638,
16.422429246432337,
16.869625590628296,
17.31682193482426,
17.764018279020206,
18.211214623216172,
18.658410967412124,
19.105607311608082,
19.55280365580404,
20,
0,
20
]
}
],
"layout": {
"height": 432,
"title": "Phenotypic Phase Plane (flux)",
"width": 700,
"xaxis": {
"title": "BIOMASS_Ecoli_core_w_GAM [h^-1]"
},
"yaxis": {
"title": "EX_ac_e [mmol gDW^-1 h^-1]"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result = phenotypic_phase_plane(model, \n",
" variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM],\n",
" objective=model.reactions.EX_ac_e)\n",
"result.plot()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" BIOMASS_Ecoli_core_w_GAM | \n",
" objective_lower_bound | \n",
" objective_upper_bound | \n",
" c_yield_lower_bound | \n",
" c_yield_upper_bound | \n",
" mass_yield_lower_bound | \n",
" mass_yield_upper_bound | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0.000000 | \n",
" 0.00000 | \n",
" 20.000000 | \n",
" 0.000000 | \n",
" 0.666667 | \n",
" 0.000000 | \n",
" 0.655477 | \n",
"
\n",
" \n",
" 1 | \n",
" 0.029424 | \n",
" 0.00000 | \n",
" 19.552804 | \n",
" 0.000000 | \n",
" 0.651760 | \n",
" 0.000000 | \n",
" 0.640821 | \n",
"
\n",
" \n",
" 2 | \n",
" 0.058847 | \n",
" 0.00000 | \n",
" 19.105607 | \n",
" 0.000000 | \n",
" 0.636854 | \n",
" 0.000000 | \n",
" 0.626164 | \n",
"
\n",
" \n",
" 3 | \n",
" 0.088271 | \n",
" 0.00000 | \n",
" 18.658411 | \n",
" 0.000000 | \n",
" 0.621947 | \n",
" 0.000000 | \n",
" 0.611508 | \n",
"
\n",
" \n",
" 4 | \n",
" 0.117695 | \n",
" 0.00000 | \n",
" 18.211215 | \n",
" 0.000000 | \n",
" 0.607040 | \n",
" 0.000000 | \n",
" 0.596852 | \n",
"
\n",
" \n",
" 5 | \n",
" 0.147119 | \n",
" 0.00000 | \n",
" 17.764018 | \n",
" 0.000000 | \n",
" 0.592134 | \n",
" 0.000000 | \n",
" 0.582195 | \n",
"
\n",
" \n",
" 6 | \n",
" 0.176542 | \n",
" 0.00000 | \n",
" 17.316822 | \n",
" 0.000000 | \n",
" 0.577227 | \n",
" 0.000000 | \n",
" 0.567539 | \n",
"
\n",
" \n",
" 7 | \n",
" 0.205966 | \n",
" 0.00000 | \n",
" 16.869626 | \n",
" 0.000000 | \n",
" 0.562321 | \n",
" 0.000000 | \n",
" 0.552883 | \n",
"
\n",
" \n",
" 8 | \n",
" 0.235390 | \n",
" 0.00000 | \n",
" 16.422429 | \n",
" 0.000000 | \n",
" 0.547414 | \n",
" 0.000000 | \n",
" 0.538226 | \n",
"
\n",
" \n",
" 9 | \n",
" 0.264813 | \n",
" 0.00000 | \n",
" 15.975233 | \n",
" 0.000000 | \n",
" 0.532508 | \n",
" 0.000000 | \n",
" 0.523570 | \n",
"
\n",
" \n",
" 10 | \n",
" 0.294237 | \n",
" 0.00000 | \n",
" 15.528037 | \n",
" 0.000000 | \n",
" 0.517601 | \n",
" 0.000000 | \n",
" 0.508914 | \n",
"
\n",
" \n",
" 11 | \n",
" 0.323661 | \n",
" 0.00000 | \n",
" 15.080840 | \n",
" 0.000000 | \n",
" 0.502695 | \n",
" 0.000000 | \n",
" 0.494257 | \n",
"
\n",
" \n",
" 12 | \n",
" 0.353085 | \n",
" 0.00000 | \n",
" 14.633644 | \n",
" 0.000000 | \n",
" 0.487788 | \n",
" 0.000000 | \n",
" 0.479601 | \n",
"
\n",
" \n",
" 13 | \n",
" 0.382508 | \n",
" 0.00000 | \n",
" 14.186448 | \n",
" 0.000000 | \n",
" 0.472882 | \n",
" 0.000000 | \n",
" 0.464945 | \n",
"
\n",
" \n",
" 14 | \n",
" 0.411932 | \n",
" 0.00000 | \n",
" 13.739251 | \n",
" 0.000000 | \n",
" 0.457975 | \n",
" 0.000000 | \n",
" 0.450288 | \n",
"
\n",
" \n",
" 15 | \n",
" 0.441356 | \n",
" 0.00000 | \n",
" 13.292055 | \n",
" 0.000000 | \n",
" 0.443068 | \n",
" 0.000000 | \n",
" 0.435632 | \n",
"
\n",
" \n",
" 16 | \n",
" 0.470779 | \n",
" 0.00000 | \n",
" 12.844858 | \n",
" 0.000000 | \n",
" 0.428162 | \n",
" 0.000000 | \n",
" 0.420975 | \n",
"
\n",
" \n",
" 17 | \n",
" 0.500203 | \n",
" 0.00000 | \n",
" 12.397662 | \n",
" 0.000000 | \n",
" 0.413255 | \n",
" 0.000000 | \n",
" 0.406319 | \n",
"
\n",
" \n",
" 18 | \n",
" 0.529627 | \n",
" 2.62796 | \n",
" 11.950466 | \n",
" 0.087599 | \n",
" 0.398349 | \n",
" 0.086128 | \n",
" 0.391663 | \n",
"
\n",
" \n",
" 19 | \n",
" 0.559051 | \n",
" 9.90568 | \n",
" 11.503269 | \n",
" 0.330189 | \n",
" 0.383442 | \n",
" 0.324647 | \n",
" 0.377006 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound \\\n",
"0 0.000000 0.00000 20.000000 \n",
"1 0.029424 0.00000 19.552804 \n",
"2 0.058847 0.00000 19.105607 \n",
"3 0.088271 0.00000 18.658411 \n",
"4 0.117695 0.00000 18.211215 \n",
"5 0.147119 0.00000 17.764018 \n",
"6 0.176542 0.00000 17.316822 \n",
"7 0.205966 0.00000 16.869626 \n",
"8 0.235390 0.00000 16.422429 \n",
"9 0.264813 0.00000 15.975233 \n",
"10 0.294237 0.00000 15.528037 \n",
"11 0.323661 0.00000 15.080840 \n",
"12 0.353085 0.00000 14.633644 \n",
"13 0.382508 0.00000 14.186448 \n",
"14 0.411932 0.00000 13.739251 \n",
"15 0.441356 0.00000 13.292055 \n",
"16 0.470779 0.00000 12.844858 \n",
"17 0.500203 0.00000 12.397662 \n",
"18 0.529627 2.62796 11.950466 \n",
"19 0.559051 9.90568 11.503269 \n",
"\n",
" c_yield_lower_bound c_yield_upper_bound mass_yield_lower_bound \\\n",
"0 0.000000 0.666667 0.000000 \n",
"1 0.000000 0.651760 0.000000 \n",
"2 0.000000 0.636854 0.000000 \n",
"3 0.000000 0.621947 0.000000 \n",
"4 0.000000 0.607040 0.000000 \n",
"5 0.000000 0.592134 0.000000 \n",
"6 0.000000 0.577227 0.000000 \n",
"7 0.000000 0.562321 0.000000 \n",
"8 0.000000 0.547414 0.000000 \n",
"9 0.000000 0.532508 0.000000 \n",
"10 0.000000 0.517601 0.000000 \n",
"11 0.000000 0.502695 0.000000 \n",
"12 0.000000 0.487788 0.000000 \n",
"13 0.000000 0.472882 0.000000 \n",
"14 0.000000 0.457975 0.000000 \n",
"15 0.000000 0.443068 0.000000 \n",
"16 0.000000 0.428162 0.000000 \n",
"17 0.000000 0.413255 0.000000 \n",
"18 0.087599 0.398349 0.086128 \n",
"19 0.330189 0.383442 0.324647 \n",
"\n",
" mass_yield_upper_bound \n",
"0 0.655477 \n",
"1 0.640821 \n",
"2 0.626164 \n",
"3 0.611508 \n",
"4 0.596852 \n",
"5 0.582195 \n",
"6 0.567539 \n",
"7 0.552883 \n",
"8 0.538226 \n",
"9 0.523570 \n",
"10 0.508914 \n",
"11 0.494257 \n",
"12 0.479601 \n",
"13 0.464945 \n",
"14 0.450288 \n",
"15 0.435632 \n",
"16 0.420975 \n",
"17 0.406319 \n",
"18 0.391663 \n",
"19 0.377006 "
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result.data_frame"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One can immediately see if a design is feasible within the new defined constraints."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"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.029423715774317058,
0.058847431548634116,
0.08827114732295117,
0.11769486309726823,
0.1471185788715853,
0.17654229464590235,
0.2059660104202194,
0.23538972619453646,
0.26481344196885354,
0.2942371577431706,
0.3236608735174876,
0.3530845892918047,
0.38250830506612177,
0.4119320208404388,
0.44135573661475586,
0.4707794523890729,
0.5002031681633899,
0.5296268839377071,
0.5590505997120241,
0.5590505997120241,
0.5296268839377071,
0.5002031681633899,
0.4707794523890729,
0.44135573661475586,
0.4119320208404388,
0.38250830506612177,
0.3530845892918047,
0.3236608735174876,
0.2942371577431706,
0.26481344196885354,
0.23538972619453646,
0.2059660104202194,
0.17654229464590235,
0.1471185788715853,
0.11769486309726823,
0.08827114732295117,
0.058847431548634116,
0.029423715774317058,
0,
0,
0
],
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2.627960120303466,
9.905679878989176,
11.503269460276801,
11.950465804472762,
12.397662148668719,
12.844858492864677,
13.292054837060633,
13.739251181256595,
14.186447525452547,
14.63364386964851,
15.080840213844464,
15.528036558040423,
15.97523290223638,
16.422429246432337,
16.869625590628296,
17.31682193482426,
17.764018279020206,
18.211214623216172,
18.658410967412124,
19.105607311608082,
19.55280365580404,
20,
0,
20
]
},
{
"marker": {
"color": [
"green",
"red"
]
},
"mode": "markers",
"name": "Data Points",
"type": "scatter",
"x": [
0.2,
0.2
],
"y": [
8,
2
]
}
],
"layout": {
"height": 432,
"title": "Phenotypic Phase Plane (flux)",
"width": 700,
"xaxis": {
"title": "BIOMASS_Ecoli_core_w_GAM [h^-1]"
},
"yaxis": {
"title": "EX_ac_e [mmol gDW^-1 h^-1]"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"result.plot(points=[(0.2, 8), (0.2, 2)], points_colors=[\"green\", \"red\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The computed data can be inspected in the format of a pandas data frame by calling `result.data_frame`"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" BIOMASS_Ecoli_core_w_GAM | \n",
" objective_lower_bound | \n",
" objective_upper_bound | \n",
" c_yield_lower_bound | \n",
" c_yield_upper_bound | \n",
" mass_yield_lower_bound | \n",
" mass_yield_upper_bound | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0.000000 | \n",
" 0.00000 | \n",
" 20.000000 | \n",
" 0.000000 | \n",
" 0.666667 | \n",
" 0.000000 | \n",
" 0.655477 | \n",
"
\n",
" \n",
" 1 | \n",
" 0.029424 | \n",
" 0.00000 | \n",
" 19.552804 | \n",
" 0.000000 | \n",
" 0.651760 | \n",
" 0.000000 | \n",
" 0.640821 | \n",
"
\n",
" \n",
" 2 | \n",
" 0.058847 | \n",
" 0.00000 | \n",
" 19.105607 | \n",
" 0.000000 | \n",
" 0.636854 | \n",
" 0.000000 | \n",
" 0.626164 | \n",
"
\n",
" \n",
" 3 | \n",
" 0.088271 | \n",
" 0.00000 | \n",
" 18.658411 | \n",
" 0.000000 | \n",
" 0.621947 | \n",
" 0.000000 | \n",
" 0.611508 | \n",
"
\n",
" \n",
" 4 | \n",
" 0.117695 | \n",
" 0.00000 | \n",
" 18.211215 | \n",
" 0.000000 | \n",
" 0.607040 | \n",
" 0.000000 | \n",
" 0.596852 | \n",
"
\n",
" \n",
" 5 | \n",
" 0.147119 | \n",
" 0.00000 | \n",
" 17.764018 | \n",
" 0.000000 | \n",
" 0.592134 | \n",
" 0.000000 | \n",
" 0.582195 | \n",
"
\n",
" \n",
" 6 | \n",
" 0.176542 | \n",
" 0.00000 | \n",
" 17.316822 | \n",
" 0.000000 | \n",
" 0.577227 | \n",
" 0.000000 | \n",
" 0.567539 | \n",
"
\n",
" \n",
" 7 | \n",
" 0.205966 | \n",
" 0.00000 | \n",
" 16.869626 | \n",
" 0.000000 | \n",
" 0.562321 | \n",
" 0.000000 | \n",
" 0.552883 | \n",
"
\n",
" \n",
" 8 | \n",
" 0.235390 | \n",
" 0.00000 | \n",
" 16.422429 | \n",
" 0.000000 | \n",
" 0.547414 | \n",
" 0.000000 | \n",
" 0.538226 | \n",
"
\n",
" \n",
" 9 | \n",
" 0.264813 | \n",
" 0.00000 | \n",
" 15.975233 | \n",
" 0.000000 | \n",
" 0.532508 | \n",
" 0.000000 | \n",
" 0.523570 | \n",
"
\n",
" \n",
" 10 | \n",
" 0.294237 | \n",
" 0.00000 | \n",
" 15.528037 | \n",
" 0.000000 | \n",
" 0.517601 | \n",
" 0.000000 | \n",
" 0.508914 | \n",
"
\n",
" \n",
" 11 | \n",
" 0.323661 | \n",
" 0.00000 | \n",
" 15.080840 | \n",
" 0.000000 | \n",
" 0.502695 | \n",
" 0.000000 | \n",
" 0.494257 | \n",
"
\n",
" \n",
" 12 | \n",
" 0.353085 | \n",
" 0.00000 | \n",
" 14.633644 | \n",
" 0.000000 | \n",
" 0.487788 | \n",
" 0.000000 | \n",
" 0.479601 | \n",
"
\n",
" \n",
" 13 | \n",
" 0.382508 | \n",
" 0.00000 | \n",
" 14.186448 | \n",
" 0.000000 | \n",
" 0.472882 | \n",
" 0.000000 | \n",
" 0.464945 | \n",
"
\n",
" \n",
" 14 | \n",
" 0.411932 | \n",
" 0.00000 | \n",
" 13.739251 | \n",
" 0.000000 | \n",
" 0.457975 | \n",
" 0.000000 | \n",
" 0.450288 | \n",
"
\n",
" \n",
" 15 | \n",
" 0.441356 | \n",
" 0.00000 | \n",
" 13.292055 | \n",
" 0.000000 | \n",
" 0.443068 | \n",
" 0.000000 | \n",
" 0.435632 | \n",
"
\n",
" \n",
" 16 | \n",
" 0.470779 | \n",
" 0.00000 | \n",
" 12.844858 | \n",
" 0.000000 | \n",
" 0.428162 | \n",
" 0.000000 | \n",
" 0.420975 | \n",
"
\n",
" \n",
" 17 | \n",
" 0.500203 | \n",
" 0.00000 | \n",
" 12.397662 | \n",
" 0.000000 | \n",
" 0.413255 | \n",
" 0.000000 | \n",
" 0.406319 | \n",
"
\n",
" \n",
" 18 | \n",
" 0.529627 | \n",
" 2.62796 | \n",
" 11.950466 | \n",
" 0.087599 | \n",
" 0.398349 | \n",
" 0.086128 | \n",
" 0.391663 | \n",
"
\n",
" \n",
" 19 | \n",
" 0.559051 | \n",
" 9.90568 | \n",
" 11.503269 | \n",
" 0.330189 | \n",
" 0.383442 | \n",
" 0.324647 | \n",
" 0.377006 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound \\\n",
"0 0.000000 0.00000 20.000000 \n",
"1 0.029424 0.00000 19.552804 \n",
"2 0.058847 0.00000 19.105607 \n",
"3 0.088271 0.00000 18.658411 \n",
"4 0.117695 0.00000 18.211215 \n",
"5 0.147119 0.00000 17.764018 \n",
"6 0.176542 0.00000 17.316822 \n",
"7 0.205966 0.00000 16.869626 \n",
"8 0.235390 0.00000 16.422429 \n",
"9 0.264813 0.00000 15.975233 \n",
"10 0.294237 0.00000 15.528037 \n",
"11 0.323661 0.00000 15.080840 \n",
"12 0.353085 0.00000 14.633644 \n",
"13 0.382508 0.00000 14.186448 \n",
"14 0.411932 0.00000 13.739251 \n",
"15 0.441356 0.00000 13.292055 \n",
"16 0.470779 0.00000 12.844858 \n",
"17 0.500203 0.00000 12.397662 \n",
"18 0.529627 2.62796 11.950466 \n",
"19 0.559051 9.90568 11.503269 \n",
"\n",
" c_yield_lower_bound c_yield_upper_bound mass_yield_lower_bound \\\n",
"0 0.000000 0.666667 0.000000 \n",
"1 0.000000 0.651760 0.000000 \n",
"2 0.000000 0.636854 0.000000 \n",
"3 0.000000 0.621947 0.000000 \n",
"4 0.000000 0.607040 0.000000 \n",
"5 0.000000 0.592134 0.000000 \n",
"6 0.000000 0.577227 0.000000 \n",
"7 0.000000 0.562321 0.000000 \n",
"8 0.000000 0.547414 0.000000 \n",
"9 0.000000 0.532508 0.000000 \n",
"10 0.000000 0.517601 0.000000 \n",
"11 0.000000 0.502695 0.000000 \n",
"12 0.000000 0.487788 0.000000 \n",
"13 0.000000 0.472882 0.000000 \n",
"14 0.000000 0.457975 0.000000 \n",
"15 0.000000 0.443068 0.000000 \n",
"16 0.000000 0.428162 0.000000 \n",
"17 0.000000 0.413255 0.000000 \n",
"18 0.087599 0.398349 0.086128 \n",
"19 0.330189 0.383442 0.324647 \n",
"\n",
" mass_yield_upper_bound \n",
"0 0.655477 \n",
"1 0.640821 \n",
"2 0.626164 \n",
"3 0.611508 \n",
"4 0.596852 \n",
"5 0.582195 \n",
"6 0.567539 \n",
"7 0.552883 \n",
"8 0.538226 \n",
"9 0.523570 \n",
"10 0.508914 \n",
"11 0.494257 \n",
"12 0.479601 \n",
"13 0.464945 \n",
"14 0.450288 \n",
"15 0.435632 \n",
"16 0.420975 \n",
"17 0.406319 \n",
"18 0.391663 \n",
"19 0.377006 "
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"result.data_frame"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"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.02351810552614555,
0.0470362110522911,
0.07055431657843665,
0.0940724221045822,
0.11759052763072776,
0.1411086331568733,
0.16462673868301886,
0.1881448442091644,
0.21166294973530997,
0.21166294973530997,
0.1881448442091644,
0.16462673868301886,
0.1411086331568733,
0.11759052763072776,
0.0940724221045822,
0.07055431657843665,
0.0470362110522911,
0.02351810552614555,
0,
0,
0
],
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
8.503585277961015,
8.503585277961303,
8.669853580410049,
8.836121882858794,
9.002390185307537,
9.168658487756279,
9.334926790205028,
9.501195092653768,
9.667463395102514,
9.833731697551253,
10,
0,
10
]
}
],
"layout": {
"height": 432,
"title": "Phenotypic Phase Plane (flux)",
"width": 700,
"xaxis": {
"title": "BIOMASS_Ecoli_core_w_GAM [h^-1]"
},
"yaxis": {
"title": "EX_ac_e [mmol gDW^-1 h^-1]"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"model.reactions.EX_o2_e.lower_bound = 0\n",
"result2 = phenotypic_phase_plane(model, \n",
" variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM],\n",
" objective=model.reactions.EX_ac_e,\n",
" points=10)\n",
"result2.plot()"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"## Flux Balance Impact Degree"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"from cameo.flux_analysis.analysis import flux_balance_impact_degree"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"model.reactions.EX_o2_e.lower_bound = -10"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 447 ms, sys: 5.18 ms, total: 452 ms\n",
"Wall time: 470 ms\n"
]
}
],
"source": [
"%time fbid = flux_balance_impact_degree(model, [\"EX_o2_e\"])"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" Flux Balance Impact Degree
\n",
" \n",
" - Degree: 6
\n",
" - Reactions: 50
\n",
"
\n",
" \n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" perturbed | \n",
"
\n",
" \n",
" \n",
" \n",
" ACALD | \n",
" False | \n",
"
\n",
" \n",
" ACALDt | \n",
" False | \n",
"
\n",
" \n",
" ADK1 | \n",
" False | \n",
"
\n",
" \n",
" ALCD2x | \n",
" False | \n",
"
\n",
" \n",
" ATPM | \n",
" False | \n",
"
\n",
" \n",
" ATPS4r | \n",
" True | \n",
"
\n",
" \n",
" CO2t | \n",
" False | \n",
"
\n",
" \n",
" CYTBD | \n",
" True | \n",
"
\n",
" \n",
" D_LACt2 | \n",
" False | \n",
"
\n",
" \n",
" ENO | \n",
" False | \n",
"
\n",
" \n",
" ETOHt2r | \n",
" False | \n",
"
\n",
" \n",
" EX_acald_e | \n",
" True | \n",
"
\n",
" \n",
" EX_co2_e | \n",
" False | \n",
"
\n",
" \n",
" EX_etoh_e | \n",
" False | \n",
"
\n",
" \n",
" EX_glc__D_e | \n",
" False | \n",
"
\n",
" \n",
" EX_h2o_e | \n",
" True | \n",
"
\n",
" \n",
" EX_h_e | \n",
" False | \n",
"
\n",
" \n",
" EX_lac__D_e | \n",
" False | \n",
"
\n",
" \n",
" EX_pyr_e | \n",
" True | \n",
"
\n",
" \n",
" FBA | \n",
" False | \n",
"
\n",
" \n",
" FBP | \n",
" False | \n",
"
\n",
" \n",
" FRD7 | \n",
" False | \n",
"
\n",
" \n",
" GAPD | \n",
" False | \n",
"
\n",
" \n",
" GLCpts | \n",
" False | \n",
"
\n",
" \n",
" GLNS | \n",
" False | \n",
"
\n",
" \n",
" GLUDy | \n",
" False | \n",
"
\n",
" \n",
" GLUN | \n",
" False | \n",
"
\n",
" \n",
" GLUSy | \n",
" False | \n",
"
\n",
" \n",
" H2Ot | \n",
" False | \n",
"
\n",
" \n",
" LDH_D | \n",
" False | \n",
"
\n",
" \n",
" MDH | \n",
" False | \n",
"
\n",
" \n",
" ME1 | \n",
" False | \n",
"
\n",
" \n",
" ME2 | \n",
" False | \n",
"
\n",
" \n",
" NADH16 | \n",
" True | \n",
"
\n",
" \n",
" NADTRHD | \n",
" False | \n",
"
\n",
" \n",
" PDH | \n",
" False | \n",
"
\n",
" \n",
" PFK | \n",
" False | \n",
"
\n",
" \n",
" PGI | \n",
" False | \n",
"
\n",
" \n",
" PGK | \n",
" False | \n",
"
\n",
" \n",
" PGM | \n",
" False | \n",
"
\n",
" \n",
" PPC | \n",
" False | \n",
"
\n",
" \n",
" PPCK | \n",
" False | \n",
"
\n",
" \n",
" PPS | \n",
" False | \n",
"
\n",
" \n",
" PYK | \n",
" False | \n",
"
\n",
" \n",
" PYRt2 | \n",
" False | \n",
"
\n",
" \n",
" SUCCt2_2 | \n",
" False | \n",
"
\n",
" \n",
" SUCCt3 | \n",
" False | \n",
"
\n",
" \n",
" SUCDi | \n",
" False | \n",
"
\n",
" \n",
" THD2 | \n",
" False | \n",
"
\n",
" \n",
" TPI | \n",
" False | \n",
"
\n",
" \n",
"
\n",
"
\n",
" "
],
"text/plain": [
""
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fbid"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "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.5"
}
},
"nbformat": 4,
"nbformat_minor": 1
}