Analyzing models

cameo uses the model data structures defined by cobrapy, our favorite COnstraints-Based Reconstruction and Analysis tool for Python. 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.


In [1]:
from cameo import models
model = models.bigg.e_coli_core

Flux Variability Analysis

Flux variability analysis (FVA) enables the computation of lower and upper bounds of reaction fluxes.


In [2]:
from cameo import flux_variability_analysis

In [3]:
fva_result = flux_variability_analysis(model)
fva_result.data_frame


Out[3]:
lower_bound upper_bound
ACALD -20.000000 0.000000
ACALDt -20.000000 0.000000
ACKr -20.000000 0.000000
ACONTa 0.000000 20.000000
ACONTb 0.000000 20.000000
ACt2r -20.000000 0.000000
ADK1 0.000000 166.610000
AKGDH 0.000000 20.000000
AKGt2r -10.000000 0.000000
ALCD2x -20.000000 0.000000
ATPM 8.390000 175.000000
ATPS4r -31.610000 150.000000
BIOMASS_Ecoli_core_w_GAM 0.000000 0.873922
CO2t -60.000000 11.104242
CS 0.000000 20.000000
CYTBD 0.000000 120.000000
D_LACt2 -20.000000 0.000000
ENO 0.000000 20.000000
ETOHt2r -20.000000 0.000000
EX_ac_e 0.000000 20.000000
EX_acald_e 0.000000 20.000000
EX_akg_e 0.000000 10.000000
EX_co2_e -11.104242 60.000000
EX_etoh_e 0.000000 20.000000
EX_for_e 0.000000 40.000000
EX_fru_e 0.000000 0.000000
EX_fum_e 0.000000 0.000000
EX_glc__D_e -10.000000 -0.479429
EX_gln__L_e 0.000000 0.000000
EX_glu__L_e 0.000000 10.000000
... ... ...
ME2 0.000000 98.305000
NADH16 0.000000 120.000000
NADTRHD 0.000000 378.220000
NH4t 0.000000 10.000000
O2t 0.000000 60.000000
PDH 0.000000 40.000000
PFK 0.000000 176.610000
PFL 0.000000 40.000000
PGI -50.000000 10.000000
PGK -20.000000 0.000000
PGL 0.000000 60.000000
PGM -20.000000 0.000000
PIt2r 0.000000 3.214895
PPC 0.000000 166.610000
PPCK 0.000000 166.610000
PPS 0.000000 166.610000
PTAr 0.000000 20.000000
PYK 0.000000 176.610000
PYRt2 -20.000000 0.000000
RPE -0.620909 40.000000
RPI -20.000000 0.000000
SUCCt2_2 0.000000 222.146667
SUCCt3 0.000000 222.146667
SUCDi 0.000000 1000.000000
SUCOAS -20.000000 0.000000
TALA -0.154536 20.000000
THD2 0.000000 333.220000
TKT1 -0.154536 20.000000
TKT2 -0.466373 20.000000
TPI -10.000000 10.000000

95 rows × 2 columns


In [4]:
fva_result.plot(index=fva_result.data_frame.index[:25])


One very useful application of FVA is determining if alternative optimal solution exist.


In [5]:
fva_result2 = flux_variability_analysis(model,fraction_of_optimum=0.5)
fva_result2.data_frame


Out[5]:
lower_bound upper_bound
ACALD -12.602453 0.000000
ACALDt -12.602453 0.000000
ACKr -13.358852 0.000000
ACONTa 0.471437 13.830289
ACONTb 0.471437 13.830289
ACt2r -13.358852 0.000000
ADK1 0.000000 84.338330
AKGDH 0.000000 13.358852
AKGt2r -6.679426 0.000000
ALCD2x -11.071613 0.000000
ATPM 8.390000 92.728330
ATPS4r 5.298677 99.656146
BIOMASS_Ecoli_core_w_GAM 0.436961 0.873922
CO2t -41.404917 0.925477
CS 0.471437 13.830289
CYTBD 12.517553 81.799493
D_LACt2 -10.725625 0.000000
ENO 4.825882 18.184734
ETOHt2r -11.071613 0.000000
EX_ac_e 0.000000 13.358852
EX_acald_e 0.000000 12.602453
EX_akg_e 0.000000 6.679426
EX_co2_e -0.925477 41.404917
EX_etoh_e 0.000000 11.071613
EX_for_e 0.000000 28.826782
EX_fru_e 0.000000 0.000000
EX_fum_e 0.000000 0.000000
EX_glc__D_e -10.000000 -5.233056
EX_gln__L_e 0.000000 0.000000
EX_glu__L_e 0.000000 6.281521
... ... ...
ME2 0.000000 52.201468
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
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
PGM -18.184734 -4.825882
PIt2r 1.607448 3.214895
PPC 0.000000 85.590485
PPCK 0.000000 84.338330
PPS 0.000000 84.338330
PTAr 0.000000 13.358852
PYK 0.000000 92.296238
PYRt2 -12.602453 0.000000
RPE -0.620909 26.403617
RPI -13.672939 -0.314087
SUCCt2_2 0.000000 112.451107
SUCCt3 0.000000 112.451107
SUCDi 0.000000 1000.000000
SUCOAS -13.358852 0.000000
TALA -0.154536 13.280680
THD2 0.000000 168.676660
TKT1 -0.154536 13.280680
TKT2 -0.466373 13.122937
TPI -3.793497 9.565355

95 rows × 2 columns


In [6]:
fva_result2.plot()



In [7]:
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.


In [8]:
from cameo import phenotypic_phase_plane

In [9]:
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)

In [10]:
result.plot()


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.


In [11]:
result.plot(points=[(0.52, 0), (0.23, 12.2)], points_colors=["green", "red"])


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.


In [12]:
result = phenotypic_phase_plane(model, 
                                variables=[model.reactions.BIOMASS_Ecoli_core_w_GAM],
                                objective=model.reactions.EX_ac_e)
result.plot()



In [13]:
result.data_frame


Out[13]:
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.


In [14]:
result.plot(points=[(0.2, 8), (0.2, 2)], points_colors=["green", "red"])


The computed data can be inspected in the format of a pandas data frame by calling result.data_frame


In [15]:
result.data_frame


Out[15]:
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

In [16]:
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()


Flux Balance Impact Degree


In [17]:
from cameo.flux_analysis.analysis import flux_balance_impact_degree

In [18]:
model.reactions.EX_o2_e.lower_bound = -10

In [19]:
%time fbid = flux_balance_impact_degree(model, ["EX_o2_e"])


CPU times: user 447 ms, sys: 5.18 ms, total: 452 ms
Wall time: 470 ms

In [20]:
fbid


Out[20]:

Flux Balance Impact Degree

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

In [ ]: