cobra.flux_analysis.fastcc
==========================

.. py:module:: cobra.flux_analysis.fastcc

.. autoapi-nested-parse::

   Provide an implementation of FASTCC.



Attributes
----------

.. autoapisummary::

   cobra.flux_analysis.fastcc.logger
   cobra.flux_analysis.fastcc.LARGE_VALUE


Functions
---------

.. autoapisummary::

   cobra.flux_analysis.fastcc._add_lp7_vars
   cobra.flux_analysis.fastcc._find_sparse_mode
   cobra.flux_analysis.fastcc._flip_coefficients
   cobra.flux_analysis.fastcc._any_set
   cobra.flux_analysis.fastcc.fastcc


Module Contents
---------------

.. py:data:: logger

.. py:data:: LARGE_VALUE
   :value: 1000000.0


.. py:function:: _add_lp7_vars(model: cobra.core.Model, rxns: List[cobra.core.Reaction], flux_threshold: float) -> None

   Add the variables and constraints for the LP.

   :param model: The model to operate on.
   :type model: cobra.Model
   :param rxns: The reactions to use for LP.
   :type rxns: list of cobra.Reaction
   :param flux_threshold: The upper threshold an auxiliary variable can have.
   :type flux_threshold: float


.. py:function:: _find_sparse_mode(model: cobra.core.Model, rxn_ids: Set[str], zero_cutoff: float) -> List[cobra.core.Reaction]

   Perform the LP required for FASTCC.

   :param model: The model to perform FASTCC on.
   :type model: cobra.Model
   :param rxns: The reactions to use for LP.
   :type rxns: list of cobra.Reaction
   :param zero_cutoff: The cutoff below which flux is considered zero.
   :type zero_cutoff: float

   :returns: The list of reactions to consider as consistent.
   :rtype: list of cobra.Reaction


.. py:function:: _flip_coefficients(model: cobra.core.Model, rxn_ids: Set[str]) -> None

   Flip the coefficients for optimizing in reverse direction.

   :param model: The model to operate on.
   :type model: cobra.Model
   :param rxns: The list of reactions whose coefficients will be flipped.
   :type rxns: list of cobra.Reaction


.. py:function:: _any_set(s)

.. py:function:: fastcc(model: cobra.core.Model, flux_threshold: float = 1.0, zero_cutoff: Optional[float] = None) -> cobra.core.Model

   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]_.

   :param model: The model to operate on.
   :type model: cobra.Model
   :param flux_threshold: The flux threshold to consider (default 1.0).
   :type flux_threshold: float, optional
   :param zero_cutoff: The cutoff to consider for zero flux (default model.tolerance).
   :type zero_cutoff: float, optional

   :returns: The consistent model.
   :rtype: cobra.Model

   .. rubric:: 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

   .. rubric:: References

   .. [1] Vlassis N, Pacheco MP, Sauter T (2014)
          Fast Reconstruction of Compact Context-Specific Metabolic Network
          Models.
          PLoS Comput Biol 10(1): e1003424. doi:10.1371/journal.pcbi.1003424


