cobra.flux_analysis.phenotype_phase_plane
¶
Provide functions for phenotype phase plane analysis.
Module Contents¶
Functions¶
|
Calculate the objective value conditioned on all flux combinations. |
|
Add a production envelope based on the parameters provided. |
|
Compute total output per input unit. |
|
Split metabolites into atoms times their stoichiometric coefficients. |
|
Return the metabolite weight times its stoichiometric coefficient. |
|
Compute the total components consumption or production flux. |
|
Find all active carbon source reactions. |
- cobra.flux_analysis.phenotype_phase_plane.production_envelope(model: cobra.Model, reactions: List[cobra.Reaction], objective: Union[Dict, optlang.interface.Objective, None] = None, carbon_sources: Optional[List[cobra.Reaction]] = None, points: int = 20, threshold: Optional[float] = None) pandas.DataFrame [source]¶
Calculate the objective value conditioned on all flux combinations.
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.
- Parameters
model (cobra.Model) – The model to compute the production envelope for.
reactions (list of cobra.Reaction) – A list of reaction objects.
objective (dict or cobra.Model.objective, optional) – The objective (reaction) to use for the production envelope. Use the model’s current objective if left missing (default None).
carbon_sources (list of cobra.Reaction, optional) – One or more reactions 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 (default None).
points (int, optional) – The number of points to calculate production for (default 20).
threshold (float, optional) – A cut-off under which flux values will be considered to be zero. If not specified, it defaults to model.tolerance (default None).
- Returns
A DataFrame with fixed columns as: - carbon_source : identifiers of carbon exchange reactions - flux_maximum : maximum objective flux - flux_minimum : minimum objective flux - carbon_yield_maximum : maximum yield of a carbon source - carbon_yield_minimum : minimum yield of a carbon source - mass_yield_maximum : maximum mass yield of a carbon source - mass_yield_minimum : minimum mass yield of a carbon source
and variable columns (for each input reactions) as: - reaction_id : flux at each given point
- Return type
pandas.DataFrame
- Raises
ValueError – If model’s objective is comprised of multiple reactions.
Examples
>>> import cobra.io >>> from cobra.flux_analysis import production_envelope >>> model = cobra.io.load_model("textbook") >>> production_envelope(model, ["EX_glc__D_e", "EX_o2_e"]) carbon_source flux_minimum carbon_yield_minimum mass_yield_minimum ... 0 EX_glc__D_e 0.0 0.0 NaN ... 1 EX_glc__D_e 0.0 0.0 NaN ... 2 EX_glc__D_e 0.0 0.0 NaN ... 3 EX_glc__D_e 0.0 0.0 NaN ... 4 EX_glc__D_e 0.0 0.0 NaN ... .. ... ... ... ... ... 395 EX_glc__D_e NaN NaN NaN ... 396 EX_glc__D_e NaN NaN NaN ... 397 EX_glc__D_e NaN NaN NaN ... 398 EX_glc__D_e NaN NaN NaN ... 399 EX_glc__D_e NaN NaN NaN ...
[400 rows x 9 columns]
- cobra.flux_analysis.phenotype_phase_plane._add_envelope(model: cobra.Model, reactions: List[cobra.Reaction], grid: pandas.DataFrame, c_input: List[cobra.Reaction], c_output: List[cobra.Reaction], threshold: float) None [source]¶
Add a production envelope based on the parameters provided.
- Parameters
model (cobra.Model) – The model to operate on.
reactions (list of cobra.Reaction) – The input reaction objects.
grid (pandas.DataFrame) – The DataFrame containing all the data regarding the operation.
c_input (list of cobra.Reaction) – The list of reaction objects acting as carbon inputs.
c_output (list of cobra.Reaction) – The list of reaction objects acting as carbon outputs.
- cobra.flux_analysis.phenotype_phase_plane._total_yield(input_fluxes: List[float], input_elements: List[float], output_flux: List[float], output_elements: List[float]) float [source]¶
Compute total output per input unit.
Units are typically mol carbon atoms or gram of source and product.
- Parameters
input_fluxes (list of float) – A list of input reaction fluxes in the same order as the input_components.
input_elements (list of float) – 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.
- Returns
The ratio between output (mol carbon atoms or grams of product) and input (mol carbon atoms or grams of source compounds). If input flux of carbon sources is zero then numpy.nan is returned.
- Return type
- cobra.flux_analysis.phenotype_phase_plane._reaction_elements(reaction: cobra.Reaction) List[float] [source]¶
Split metabolites into atoms times their stoichiometric coefficients.
- Parameters
reaction (cobra.Reaction) – The reaction whose metabolite components are desired.
- Returns
Each of the reaction’s metabolites’ desired carbon elements (if any) times that metabolite’s stoichiometric coefficient.
- Return type
- cobra.flux_analysis.phenotype_phase_plane._reaction_weight(reaction: cobra.Reaction) List[float] [source]¶
Return the metabolite weight times its stoichiometric coefficient.
- Parameters
reaction (cobra.Reaction) – The reaction whose metabolite component weights is desired.
- Returns
Each of reaction’s metabolite components’ weights.
- Return type
- Raises
ValueError – If more than one metabolite comprises the reaction.
- cobra.flux_analysis.phenotype_phase_plane._total_components_flux(flux: float, components: List[float], consumption: bool = True) float [source]¶
Compute the total components consumption or production flux.
- Parameters
- Returns
The total consumption or production flux of components.
- Return type
- cobra.flux_analysis.phenotype_phase_plane._find_carbon_sources(model: cobra.Model) List[cobra.Reaction] [source]¶
Find all active carbon source reactions.
- Parameters
model (Model) – The model whose active carbon sources need to found.
- Returns
The medium reactions with carbon input flux.
- Return type