cobra.flux_analysis.phenotype_phase_plane Module Contents

cobra.flux_analysis.phenotype_phase_plane.production_envelope(model, reactions, objective=None, carbon_sources=None, points=20, threshold=1e-07)[source]

Calculate the objective value conditioned on all combinations of fluxes for a set of chosen reactions

The production envelope can be used to analyze a model’s ability to produce a given compound conditional on the fluxes for another set of reactions, such as the uptake rates. The model is alternately optimized with respect to minimizing and maximizing the objective and the obtained fluxes are recorded. Ranges to compute production is set to the effective bounds, i.e., the minimum / maximum fluxes that can be obtained given current reaction bounds.

  • model (cobra.Model) – The model to compute the production envelope for.
  • reactions (list or string) – A list of reactions, reaction identifiers or a single reaction.
  • objective (string, dict, model.solver.interface.Objective, optional) – The objective (reaction) to use for the production envelope. Use the model’s current objective if left missing.
  • carbon_sources (list or string, optional) – One or more reactions or reaction identifiers that are the source of carbon for computing carbon (mol carbon in output over mol carbon in input) and mass yield (gram product over gram output). Only objectives with a carbon containing input and output metabolite is supported. Will identify active carbon sources in the medium if none are specified.
  • points (int, optional) – The number of points to calculate production for.
  • threshold (float, optional) – A cut-off under which flux values will be considered to be zero.

A data frame with one row per evaluated point and

  • reaction id : one column per input reaction indicating the flux at each given point,
  • carbon_source: identifiers of carbon exchange reactions

A column for the maximum and minimum each for the following types:

  • flux: the objective flux
  • carbon_yield: if carbon source is defined and the product is a single metabolite (mol carbon product per mol carbon feeding source)
  • mass_yield: if carbon source is defined and the product is a single metabolite (gram product per 1 g of feeding source)

Return type:



>>> import cobra.test
>>> from cobra.flux_analysis import production_envelope
>>> model = cobra.test.create_test_model("textbook")
>>> production_envelope(model, ["EX_glc__D_e", "EX_o2_e"])
cobra.flux_analysis.phenotype_phase_plane.add_envelope(model, reactions, grid, c_input, c_output, threshold)[source]
cobra.flux_analysis.phenotype_phase_plane.total_yield(input_fluxes, input_elements, output_flux, output_elements)[source]

Compute total output per input unit.

Units are typically mol carbon atoms or gram of source and product.

  • input_fluxes (list) – A list of input reaction fluxes in the same order as the input_components.
  • input_elements (list) – A list of reaction components which are in turn list of numbers.
  • output_flux (float) – The output flux value.
  • output_elements (list) – A list of stoichiometrically weighted output reaction components.

The ratio between output (mol carbon atoms or grams of product) and input (mol carbon atoms or grams of source compounds).

Return type:



Split metabolites into the atoms times their stoichiometric coefficients.

Parameters:reaction (Reaction) – The metabolic reaction whose components are desired.
Returns:Each of the reaction’s metabolites’ desired carbon elements (if any) times that metabolite’s stoichiometric coefficient.
Return type:list

Return the metabolite weight times its stoichiometric coefficient.

cobra.flux_analysis.phenotype_phase_plane.total_components_flux(flux, components, consumption=True)[source]

Compute the total components consumption or production flux.

  • flux (float) – The reaction flux for the components.
  • components (list) – List of stoichiometrically weighted components.
  • consumption (bool, optional) – Whether to sum up consumption or production fluxes.

Find all active carbon source reactions.

Parameters:model (Model) – A genome-scale metabolic model.
Returns:The medium reactions with carbon input flux.
Return type:list