Analyzing models ================ **cameo** uses the model data structures defined by `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. .. code:: ipython3 from cameo import models from cameo.visualization.plotting.with_plotly import PlotlyPlotter model = models.bigg.e_coli_core plotter = PlotlyPlotter() .. container:: alert alert-warning Note that plotter is passed as the first argument of every plotting function. Flux Variability Analysis ------------------------- Flux variability analysis (FVA) enables the computation of lower and upper bounds of reaction fluxes. .. code:: ipython3 from cameo import flux_variability_analysis .. code:: ipython3 fva_result = flux_variability_analysis(model) fva_result.data_frame .. raw:: html
lower_bound upper_bound
PFK 0.000000e+00 176.61
PFL 0.000000e+00 40.00
PGI -5.000000e+01 10.00
PGK -2.000000e+01 0.00
PGL 0.000000e+00 60.00
... ... ...
NADH16 0.000000e+00 120.00
NADTRHD 0.000000e+00 378.22
NH4t -5.712836e-30 10.00
O2t 0.000000e+00 60.00
PDH 0.000000e+00 40.00

95 rows × 2 columns

.. code:: ipython3 fva_result.plot(plotter, index=fva_result.data_frame.index[:25]) .. raw:: html .. raw:: html
One very useful application of FVA is determining if alternative optimal solution exist. .. code:: ipython3 fva_result2 = flux_variability_analysis(model,fraction_of_optimum=0.5) fva_result2.data_frame .. raw:: html
lower_bound upper_bound
PFK 0.000000 93.903685
PFL 0.000000 28.826782
PGI -30.166133 9.910423
PGK -18.838427 -5.479575
PGL 0.000000 40.076556
... ... ...
NADH16 12.517553 81.799493
NADTRHD 0.000000 193.989678
NH4t 2.382660 8.664181
O2t 6.258776 40.899746
PDH 0.000000 28.826782

95 rows × 2 columns

.. code:: ipython3 fva_result2.plot(plotter) .. raw:: html
.. code:: ipython3 from cameo.visualization import plotting Phenotypic Phase Plane ---------------------- 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]. 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. .. code:: ipython3 from cameo import phenotypic_phase_plane .. code:: ipython3 model.reactions.EX_o2_e.lower_bound = -10 result = phenotypic_phase_plane(model, variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM], objective=model.reactions.EX_succ_e, points=10) .. code:: ipython3 result.plot(plotter) .. raw:: html
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. .. code:: ipython3 result.plot(plotter, points=[(0.52, 0), (0.23, 12.2)], points_colors=["green", "red"]) .. raw:: html
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. .. code:: ipython3 result = phenotypic_phase_plane(model, variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM], objective=model.reactions.EX_ac_e) result.plot(plotter) .. raw:: html
.. code:: ipython3 result.data_frame .. raw:: html
BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound c_yield_lower_bound c_yield_upper_bound mass_yield_lower_bound mass_yield_upper_bound
0 0.000000 0.00000 20.000000 0.000000 0.666667 0.000000 0.655477
1 0.029424 0.00000 19.552804 0.000000 0.651760 0.000000 0.640821
2 0.058847 0.00000 19.105607 0.000000 0.636854 0.000000 0.626164
3 0.088271 0.00000 18.658411 0.000000 0.621947 0.000000 0.611508
4 0.117695 0.00000 18.211215 0.000000 0.607040 0.000000 0.596852
5 0.147119 0.00000 17.764018 0.000000 0.592134 0.000000 0.582195
6 0.176542 0.00000 17.316822 0.000000 0.577227 0.000000 0.567539
7 0.205966 0.00000 16.869626 0.000000 0.562321 0.000000 0.552883
8 0.235390 0.00000 16.422429 0.000000 0.547414 0.000000 0.538226
9 0.264813 0.00000 15.975233 0.000000 0.532508 0.000000 0.523570
10 0.294237 0.00000 15.528037 0.000000 0.517601 0.000000 0.508914
11 0.323661 0.00000 15.080840 0.000000 0.502695 0.000000 0.494257
12 0.353085 0.00000 14.633644 0.000000 0.487788 0.000000 0.479601
13 0.382508 0.00000 14.186448 0.000000 0.472882 0.000000 0.464945
14 0.411932 0.00000 13.739251 0.000000 0.457975 0.000000 0.450288
15 0.441356 0.00000 13.292055 0.000000 0.443068 0.000000 0.435632
16 0.470779 0.00000 12.844858 0.000000 0.428162 0.000000 0.420975
17 0.500203 0.00000 12.397662 0.000000 0.413255 0.000000 0.406319
18 0.529627 2.62796 11.950466 0.087599 0.398349 0.086128 0.391663
19 0.559051 9.90568 11.503269 0.330189 0.383442 0.324647 0.377006
One can immediately see if a design is feasible within the new defined constraints. .. code:: ipython3 result.plot(plotter, points=[(0.2, 8), (0.2, 2)], points_colors=["green", "red"]) .. raw:: html
The computed data can be inspected in the format of a pandas data frame by calling `result.data_frame` .. code:: ipython3 result.data_frame .. raw:: html
BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound c_yield_lower_bound c_yield_upper_bound mass_yield_lower_bound mass_yield_upper_bound
0 0.000000 0.00000 20.000000 0.000000 0.666667 0.000000 0.655477
1 0.029424 0.00000 19.552804 0.000000 0.651760 0.000000 0.640821
2 0.058847 0.00000 19.105607 0.000000 0.636854 0.000000 0.626164
3 0.088271 0.00000 18.658411 0.000000 0.621947 0.000000 0.611508
4 0.117695 0.00000 18.211215 0.000000 0.607040 0.000000 0.596852
5 0.147119 0.00000 17.764018 0.000000 0.592134 0.000000 0.582195
6 0.176542 0.00000 17.316822 0.000000 0.577227 0.000000 0.567539
7 0.205966 0.00000 16.869626 0.000000 0.562321 0.000000 0.552883
8 0.235390 0.00000 16.422429 0.000000 0.547414 0.000000 0.538226
9 0.264813 0.00000 15.975233 0.000000 0.532508 0.000000 0.523570
10 0.294237 0.00000 15.528037 0.000000 0.517601 0.000000 0.508914
11 0.323661 0.00000 15.080840 0.000000 0.502695 0.000000 0.494257
12 0.353085 0.00000 14.633644 0.000000 0.487788 0.000000 0.479601
13 0.382508 0.00000 14.186448 0.000000 0.472882 0.000000 0.464945
14 0.411932 0.00000 13.739251 0.000000 0.457975 0.000000 0.450288
15 0.441356 0.00000 13.292055 0.000000 0.443068 0.000000 0.435632
16 0.470779 0.00000 12.844858 0.000000 0.428162 0.000000 0.420975
17 0.500203 0.00000 12.397662 0.000000 0.413255 0.000000 0.406319
18 0.529627 2.62796 11.950466 0.087599 0.398349 0.086128 0.391663
19 0.559051 9.90568 11.503269 0.330189 0.383442 0.324647 0.377006
.. code:: ipython3 model.reactions.EX_o2_e.lower_bound = 0 result2 = phenotypic_phase_plane(model, variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM], objective=model.reactions.EX_ac_e, points=10) result2.plot(plotter) .. raw:: html
Flux Balance Impact Degree -------------------------- .. code:: ipython3 from cameo.flux_analysis.analysis import flux_balance_impact_degree .. code:: ipython3 model.reactions.EX_o2_e.lower_bound = -10 .. code:: ipython3 %time fbid = flux_balance_impact_degree(model, ["EX_o2_e"]) .. parsed-literal:: CPU times: user 137 ms, sys: 0 ns, total: 137 ms Wall time: 136 ms .. code:: ipython3 fbid .. raw:: html

Flux Balance Impact Degree

perturbed
PFK False
PGI False
PGK False
ACALD False
PGM False
ALCD2x False
ACALDt False
ACKr False
PPC False
ATPM False
PPCK False
PPS False
ADK1 False
ATPS4r True
PTAr True
PYK False
PYRt2 False
CO2t False
SUCCt2_2 False
CYTBD True
D_LACt2 False
ENO False
SUCCt3 False
ETOHt2r False
SUCDi False
THD2 False
TPI False
EX_acald_e True
EX_co2_e False
EX_etoh_e False
EX_glc__D_e False
EX_h_e False
EX_h2o_e False
EX_lac__D_e False
EX_pyr_e True
FBA False
FBP False
FRD7 False
FUM False
G6PDH2r True
GAPD False
GLCpts False
GLNS False
GLUDy False
GLUN False
GLUSy False
GND True
H2Ot False
LDH_D False
MDH False
ME1 False
ME2 False
NADH16 True
NADTRHD False
PDH False