17.1.1.2.1.12. cobra.flux_analysis.variability¶

17.1.1.2.1.12.1. Module Contents¶

17.1.1.2.1.12.1.1. Functions¶

 _init_worker(model, loopless, sense) Initialize a global model object for multiprocessing. _fva_step(reaction_id) flux_variability_analysis(model, reaction_list=None, loopless=False, fraction_of_optimum=1.0, pfba_factor=None, processes=None) Determine the minimum and maximum possible flux value for each reaction. find_blocked_reactions(model, reaction_list=None, zero_cutoff=None, open_exchanges=False, processes=None) Find reactions that cannot carry any flux. find_essential_genes(model, threshold=None, processes=None) Return a set of essential genes. find_essential_reactions(model, threshold=None, processes=None) Return a set of essential reactions.
cobra.flux_analysis.variability.LOGGER[source]
cobra.flux_analysis.variability.CONFIGURATION[source]
cobra.flux_analysis.variability._init_worker(model, loopless, sense)[source]

Initialize a global model object for multiprocessing.

cobra.flux_analysis.variability._fva_step(reaction_id)[source]
cobra.flux_analysis.variability.flux_variability_analysis(model, reaction_list=None, loopless=False, fraction_of_optimum=1.0, pfba_factor=None, processes=None)[source]

Determine the minimum and maximum possible flux value for each reaction.

Parameters
• model (cobra.Model) – The model for which to run the analysis. It will not be modified.

• reaction_list (list of cobra.Reaction or str, optional) – The reactions for which to obtain min/max fluxes. If None will use all reactions in the model (default).

• loopless (boolean, optional) – Whether to return only loopless solutions. This is significantly slower. Please also refer to the notes.

• fraction_of_optimum (float, optional) – Must be <= 1.0. Requires that the objective value is at least the fraction times maximum objective value. A value of 0.85 for instance means that the objective has to be at least at 85% percent of its maximum.

• pfba_factor (float, optional) – Add an additional constraint to the model that requires the total sum of absolute fluxes must not be larger than this value times the smallest possible sum of absolute fluxes, i.e., by setting the value to 1.1 the total sum of absolute fluxes must not be more than 10% larger than the pFBA solution. Since the pFBA solution is the one that optimally minimizes the total flux sum, the pfba_factor should, if set, be larger than one. Setting this value may lead to more realistic predictions of the effective flux bounds.

• processes (int, optional) – The number of parallel processes to run. If not explicitly passed, will be set from the global configuration singleton.

Returns

A data frame with reaction identifiers as the index and two columns: - maximum: indicating the highest possible flux - minimum: indicating the lowest possible flux

Return type

pandas.DataFrame

Notes

This implements the fast version as described in 1. Please note that the flux distribution containing all minimal/maximal fluxes does not have to be a feasible solution for the model. Fluxes are minimized/maximized individually and a single minimal flux might require all others to be suboptimal.

Using the loopless option will lead to a significant increase in computation time (about a factor of 100 for large models). However, the algorithm used here (see 2) is still more than 1000x faster than the “naive” version using add_loopless(model). Also note that if you have included constraints that force a loop (for instance by setting all fluxes in a loop to be non-zero) this loop will be included in the solution.

References

1

Computationally efficient flux variability analysis. Gudmundsson S, Thiele I. BMC Bioinformatics. 2010 Sep 29;11:489. doi: 10.1186/1471-2105-11-489, PMID: 20920235

2

CycleFreeFlux: efficient removal of thermodynamically infeasible loops from flux distributions. Desouki AA, Jarre F, Gelius-Dietrich G, Lercher MJ. Bioinformatics. 2015 Jul 1;31(13):2159-65. doi: 10.1093/bioinformatics/btv096.

cobra.flux_analysis.variability.find_blocked_reactions(model, reaction_list=None, zero_cutoff=None, open_exchanges=False, processes=None)[source]

Find reactions that cannot carry any flux.

The question whether or not a reaction is blocked is highly dependent on the current exchange reaction settings for a COBRA model. Hence an argument is provided to open all exchange reactions.

Notes

Sink and demand reactions are left untouched. Please modify them manually.

Parameters
• model (cobra.Model) – The model to analyze.

• reaction_list (list, optional) – List of reactions to consider, the default includes all model reactions.

• zero_cutoff (float, optional) – Flux value which is considered to effectively be zero (default model.tolerance).

• open_exchanges (bool, optional) – Whether or not to open all exchange reactions to very high flux ranges.

• processes (int, optional) – The number of parallel processes to run. Can speed up the computations if the number of reactions is large. If not explicitly passed, it will be set from the global configuration singleton.

Returns

List with the identifiers of blocked reactions.

Return type

list

cobra.flux_analysis.variability.find_essential_genes(model, threshold=None, processes=None)[source]

Return a set of essential genes.

A gene is considered essential if restricting the flux of all reactions that depend on it to zero causes the objective, e.g., the growth rate, to also be zero, below the threshold, or infeasible.

Parameters
• model (cobra.Model) – The model to find the essential genes for.

• threshold (float, optional) – Minimal objective flux to be considered viable. By default this is 1% of the maximal objective.

• processes (int, optional) – The number of parallel processes to run. If not passed, will be set to the number of CPUs found.

• processes – The number of parallel processes to run. Can speed up the computations if the number of knockouts to perform is large. If not explicitly passed, it will be set from the global configuration singleton.

Returns

Set of essential genes

Return type

set

cobra.flux_analysis.variability.find_essential_reactions(model, threshold=None, processes=None)[source]

Return a set of essential reactions.

A reaction is considered essential if restricting its flux to zero causes the objective, e.g., the growth rate, to also be zero, below the threshold, or infeasible.

Parameters
• model (cobra.Model) – The model to find the essential reactions for.

• threshold (float, optional) – Minimal objective flux to be considered viable. By default this is 1% of the maximal objective.

• processes (int, optional) – The number of parallel processes to run. Can speed up the computations if the number of knockouts to perform is large. If not explicitly passed, it will be set from the global configuration singleton.

Returns

Set of essential reactions

Return type

set