Analyzing models ================ **cameo** uses and extends 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:: python from cameo import models model = models.bigg.e_coli_core .. raw:: html Flux Variability Analysis ------------------------- Flux variability analysis (FVA) enables the computation of lower and upper bounds of reaction fluxes. .. code:: python from cameo import flux_variability_analysis .. code:: python fva_result = flux_variability_analysis(model) fva_result.data_frame .. raw:: html
upper_bound lower_bound
ACALD 9.375217e-16 -2.000000e+01
ACALDt 0.000000e+00 -2.000000e+01
ACKr -1.862346e-15 -2.000000e+01
ACONTa 2.000000e+01 -4.825168e-16
ACONTb 2.000000e+01 -1.999683e-16
ACt2r 0.000000e+00 -2.000000e+01
ADK1 1.666100e+02 0.000000e+00
... ... ...
SUCDi 1.000000e+03 0.000000e+00
SUCOAS -3.552714e-15 -2.000000e+01
TALA 2.000000e+01 -1.545362e-01
THD2 3.332200e+02 0.000000e+00
TKT1 2.000000e+01 -1.545362e-01
TKT2 2.000000e+01 -4.663728e-01
TPI 1.000000e+01 -1.000000e+01

95 rows × 2 columns

.. code:: python fva_result.plot(index=fva_result.data_frame.index[:25]) .. raw:: html
One very useful application of FVA is determining if alternative optimal solution exist. .. code:: python fva_result2 = flux_variability_analysis(model,fraction_of_optimum=0.5) fva_result2.data_frame .. raw:: html
upper_bound lower_bound
ACALD 0.000000e+00 -12.602453
ACALDt 3.774758e-15 -12.602453
ACKr 0.000000e+00 -13.358852
ACONTa 1.383029e+01 0.471437
ACONTb 1.383029e+01 0.471437
ACt2r -6.527569e-14 -13.358852
ADK1 8.433833e+01 0.000000
... ... ...
SUCDi 1.000000e+03 0.000000
SUCOAS 0.000000e+00 -13.358852
TALA 1.328068e+01 -0.154536
THD2 1.686767e+02 0.000000
TKT1 1.328068e+01 -0.154536
TKT2 1.312294e+01 -0.466373
TPI 9.565355e+00 -3.793497

95 rows × 2 columns

.. code:: python fva_result2.plot() .. raw:: html
.. code:: python from cameo.visualization import plotting Phenotpic 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:: python from cameo import phenotypic_phase_plane .. code:: python 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:: python result.plot() .. 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:: python result.plot(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:: python result = phenotypic_phase_plane(model, variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM], objective=model.reactions.EX_ac_e) result.plot() .. raw:: html
.. code:: python result.data_frame .. raw:: html
BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound
0 0.559051 9.90568 11.503269
1 0.529627 2.62796 11.950466
2 0.500203 0.00000 12.397662
3 0.470779 0.00000 12.844858
4 0.441356 0.00000 13.292055
5 0.411932 0.00000 13.739251
6 0.382508 0.00000 14.186448
... ... ... ...
13 0.176542 0.00000 17.316822
14 0.147119 0.00000 17.764018
15 0.117695 0.00000 18.211215
16 0.088271 0.00000 18.658411
17 0.058847 0.00000 19.105607
18 0.029424 0.00000 19.552804
19 0.000000 0.00000 20.000000

20 rows × 3 columns

One can imediatly see if a design is feasible within the new defined constraints. .. code:: python result.plot(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:: python result.data_frame .. raw:: html
BIOMASS_Ecoli_core_w_GAM objective_lower_bound objective_upper_bound
0 0.559051 9.90568 11.503269
1 0.529627 2.62796 11.950466
2 0.500203 0.00000 12.397662
3 0.470779 0.00000 12.844858
4 0.441356 0.00000 13.292055
5 0.411932 0.00000 13.739251
6 0.382508 0.00000 14.186448
... ... ... ...
13 0.176542 0.00000 17.316822
14 0.147119 0.00000 17.764018
15 0.117695 0.00000 18.211215
16 0.088271 0.00000 18.658411
17 0.058847 0.00000 19.105607
18 0.029424 0.00000 19.552804
19 0.000000 0.00000 20.000000

20 rows × 3 columns

.. code:: python 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() .. raw:: html
Flux Balance Impact Degree -------------------------- .. code:: python from cameo.flux_analysis.analysis import flux_balance_impact_degree .. code:: python model.reactions.EX_o2_e.lower_bound = -10 .. code:: python %time fbid = flux_balance_impact_degree(model, ["EX_o2_e"]) .. parsed-literal:: CPU times: user 312 ms, sys: 6.53 ms, total: 318 ms Wall time: 595 ms .. code:: python fbid .. raw:: html

Flux Balance Impact Degree

perturbed
ACALD False
ACALDt False
ACKr False
ACt2r False
ADK1 False
ALCD2x False
ATPM False
... ...
PYK False
PYRt2 False
SUCCt2_2 False
SUCCt3 False
SUCDi False
THD2 False
TPI False

62 rows × 1 columns