6. Production envelopes

Production envelopes (aka phenotype phase planes) will show distinct phases of optimal growth with different use of two different substrates. For more information, see Edwards et al.

Cobrapy supports calculating these production envelopes and they can easily be plotted using your favorite plotting package. Here, we will make one for the “textbook” E. coli core model and demonstrate plotting using matplotlib.

[1]:
import cobra.test
from cobra.flux_analysis import production_envelope

model = cobra.test.create_test_model("textbook")

We want to make a phenotype phase plane to evaluate uptakes of Glucose and Oxygen.

[2]:
prod_env = production_envelope(model, ["EX_glc__D_e", "EX_o2_e"])
[3]:
prod_env.head()
[3]:
EX_glc__D_e EX_o2_e direction flux
0 -10.0 -60.000000 minimum 0.0
1 -10.0 -56.842105 minimum 0.0
2 -10.0 -53.684211 minimum 0.0
3 -10.0 -50.526316 minimum 0.0
4 -10.0 -47.368421 minimum 0.0

If we specify the carbon source, we can also get the carbon and mass yield. For example, temporarily setting the objective to produce acetate instead we could get production envelope as follows and pandas to quickly plot the results.

[4]:
prod_env = production_envelope(
    model, ["EX_o2_e"], objective="EX_ac_e", c_source="EX_glc__D_e")
[5]:
prod_env.head()
[5]:
EX_o2_e carbon_source carbon_yield direction flux mass_yield
0 -60.000000 EX_glc__D_e 0.0 minimum 0.0 0.0
1 -56.842105 EX_glc__D_e 0.0 minimum 0.0 0.0
2 -53.684211 EX_glc__D_e 0.0 minimum 0.0 0.0
3 -50.526316 EX_glc__D_e 0.0 minimum 0.0 0.0
4 -47.368421 EX_glc__D_e 0.0 minimum 0.0 0.0
[6]:
%matplotlib inline
[7]:
prod_env[prod_env.direction == 'maximum'].plot(
    kind='line', x='EX_o2_e', y='carbon_yield')
[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x10fc37630>
_images/phenotype_phase_plane_10_1.png

Previous versions of cobrapy included more tailored plots for phase planes which have now been dropped in order to improve maintainability and enhance the focus of cobrapy. Plotting for cobra models is intended for another package.