cobra.flux_analysis.fastcc#

Provide an implementation of FASTCC.

Attributes#

Functions#

_add_lp7_vars(→ None)

Add the variables and constraints for the LP.

_find_sparse_mode(→ List[cobra.core.Reaction])

Perform the LP required for FASTCC.

_flip_coefficients(→ None)

Flip the coefficients for optimizing in reverse direction.

_any_set(s)

fastcc(→ cobra.core.Model)

Check consistency of a metabolic network using FASTCC [1].

Module Contents#

cobra.flux_analysis.fastcc.logger#
cobra.flux_analysis.fastcc.LARGE_VALUE = 1000000.0#
cobra.flux_analysis.fastcc._add_lp7_vars(model: cobra.core.Model, rxns: List[cobra.core.Reaction], flux_threshold: float) None[source]#

Add the variables and constraints for the LP.

Parameters:
  • model (cobra.Model) – The model to operate on.

  • rxns (list of cobra.Reaction) – The reactions to use for LP.

  • flux_threshold (float) – The upper threshold an auxiliary variable can have.

cobra.flux_analysis.fastcc._find_sparse_mode(model: cobra.core.Model, rxn_ids: Set[str], zero_cutoff: float) List[cobra.core.Reaction][source]#

Perform the LP required for FASTCC.

Parameters:
  • model (cobra.Model) – The model to perform FASTCC on.

  • rxns (list of cobra.Reaction) – The reactions to use for LP.

  • zero_cutoff (float) – The cutoff below which flux is considered zero.

Returns:

The list of reactions to consider as consistent.

Return type:

list of cobra.Reaction

cobra.flux_analysis.fastcc._flip_coefficients(model: cobra.core.Model, rxn_ids: Set[str]) None[source]#

Flip the coefficients for optimizing in reverse direction.

Parameters:
cobra.flux_analysis.fastcc._any_set(s)[source]#
cobra.flux_analysis.fastcc.fastcc(model: cobra.core.Model, flux_threshold: float = 1.0, zero_cutoff: float | None = None) cobra.core.Model[source]#

Check consistency of a metabolic network using FASTCC [1].

FASTCC (Fast Consistency Check) is an algorithm for rapid and efficient consistency check in metabolic networks. FASTCC is a pure LP implementation and is low on computation resource demand. FASTCC also circumvents the problem associated with reversible reactions for the purpose. Given a global model, it will generate a consistent global model i.e., remove blocked reactions. For more details on FASTCC, please check [1].

Parameters:
  • model (cobra.Model) – The model to operate on.

  • flux_threshold (float, optional) – The flux threshold to consider (default 1.0).

  • zero_cutoff (float, optional) – The cutoff to consider for zero flux (default model.tolerance).

Returns:

The consistent model.

Return type:

cobra.Model

Notes

The LP used for FASTCC is like so: maximize: sum_{i in J} z_i s.t. : z_i in [0, varepsilon] forall i in J, z_i in mathbb{R}_+

v_i ge z_i forall i in J Sv = 0 v in B

References