In many instances you might be interested what metabolites your microbial community consumes and produces.
micom provides facilities to make this simple. Since flux distributions are usually not unique we will usually analyze the “minimal medium”, meaning the smallest set of import fluxes that allow optimal growth. We will again use our E. coli test case.
from micom import Community, data tax = data.test_taxonomy() com = Community(tax)
The easiest case would be that we have a particular community growth rate we want to enforce. In this case we can get the minimal medium with:
from micom.media import minimal_medium med = minimal_medium(com, 0.8) med
EX_o2_m 1.398333 EX_glc__D_m 1.398333 dtype: float64
By default this gives the solution with the smallest total import flux. We could also minimize the number of used import fluxes:
minimal_medium(com, 0.8, minimize_components=True)
EX_glc__D_m 3.499375 dtype: float64
However, this will be unfeasibly slow and complicated for larger (ergo real) community models so we recommend using the default instead.
As argued before there are many unrealistic growth rate distributions that can be used for a given optimal community growth rate. It is also possible to use the results from cooperative tradeoff as additional constraints in the minimal media calculation.
sol = com.cooperative_tradeoff() rates = sol.members.growth_rate.drop("medium") # extracellular medium has no growth rate med = minimal_medium(com, sol.growth_rate, min_growth=rates) med
EX_pi_m 3.214886 EX_o2_m 21.799487 EX_nh4_m 4.765318 EX_glc__D_m 10.000000 dtype: float64
In practice you might want to lower the required growth rates a bit to avoid the inclusion of particular imports just to push you the last few percent to the optimum. For instance to only require 95% of the community and individual growth rates:
med = minimal_medium(com, 0.95*sol.growth_rate, min_growth=0.95*rates) med
EX_pi_m 3.054150 EX_o2_m 19.895954 EX_nh4_m 4.527052 EX_glc__D_m 10.000000 dtype: float64
Sometimes you will also be interested in which metabolites the community produces. This information can be obtained with the
exports argument of the
minimal_medium function which will also return the active exports (metabolites produced by the community) under minimal growth.
med = minimal_medium(com, sol.growth_rate, min_growth=rates, exports=True) med
EX_h_m -17.530883 EX_pi_m 3.214886 EX_o2_m 21.799487 EX_nh4_m 4.765318 EX_glc__D_m 10.000000 EX_co2_m -22.809827 EX_h2o_m -29.175810 dtype: float64
By convention exports have a negative sign and imports a positive one.
Applying growth media#
micom pretty much uses the cobrapy method of assigning media. Essentially you will need a dictionary-like structure that maps exchange reactions to their upper import flux bound. Fortunately, the output of
minimal_medium can be used directly for that. So to calculate the minimal medium and use it as the actual growth medium afterwards we can do the following:
med = minimal_medium(com, 0.8, min_growth=0.8) com.medium = med com.cooperative_tradeoff()
As we see the new medium has been applied and as a consequence the growth rate has been lowered to the one specified in the minimal medium calculation.