:mod:`memote.support.consistency` ================================= .. py:module:: memote.support.consistency .. autoapi-nested-parse:: Supporting functions for stoichiometric consistency checks. .. !! processed by numpydoc !! Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: memote.support.consistency.check_stoichiometric_consistency memote.support.consistency.find_unconserved_metabolites memote.support.consistency.find_inconsistent_min_stoichiometry memote.support.consistency.find_elementary_leakage_modes memote.support.consistency.detect_energy_generating_cycles memote.support.consistency.find_mass_unbalanced_reactions memote.support.consistency.find_charge_unbalanced_reactions memote.support.consistency.find_stoichiometrically_balanced_cycles memote.support.consistency.find_orphans memote.support.consistency.find_deadends memote.support.consistency.find_disconnected memote.support.consistency._init_worker memote.support.consistency._solve_metabolite_exchange memote.support.consistency.find_blocked_metabolites memote.support.consistency.find_metabolites_not_produced_with_open_bounds memote.support.consistency.find_metabolites_not_consumed_with_open_bounds memote.support.consistency.find_reactions_with_unbounded_flux_default_condition .. data:: LOGGER .. data:: ENERGY_COUPLES .. data:: TOLERANCE_THRESHOLD :annotation: = 1e-07 .. data:: cobra_configuration .. function:: check_stoichiometric_consistency(model) Verify the consistency of the model's stoichiometry. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. rubric:: Notes See [Rd78dc1e4f86e-1]_ section 3.1 for a complete description of the algorithm. .. [Rd78dc1e4f86e-1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Detection of Stoichiometric Inconsistencies in Biomolecular Models." Bioinformatics 24, no. 19 (2008): 2245. .. !! processed by numpydoc !! .. function:: find_unconserved_metabolites(model) Detect unconserved metabolites. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. rubric:: Notes See [R4b851317cfc9-1]_ section 3.2 for a complete description of the algorithm. .. [R4b851317cfc9-1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Detection of Stoichiometric Inconsistencies in Biomolecular Models." Bioinformatics 24, no. 19 (2008): 2245. .. !! processed by numpydoc !! .. function:: find_inconsistent_min_stoichiometry(model, atol=1e-13, max_mets_computed=10) Detect inconsistent minimal net stoichiometries. :Parameters: **model** : cobra.Model The metabolic model under investigation. **atol** : float, optional Values below the absolute tolerance are treated as zero. Expected to be very small but larger than zero. **max_mets_computed: int, optional** To avoid computing for too long, a soft cap is added to the number of computed unconserved metabolites (trivial cases are ignored). .. rubric:: Notes See [R5ab1ed7de6f9-1]_ section 3.3 for a complete description of the algorithm. .. rubric:: References .. [R5ab1ed7de6f9-1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Detection of Stoichiometric Inconsistencies in Biomolecular Models." Bioinformatics 24, no. 19 (2008): 2245. .. only:: latex [R5ab1ed7de6f9-1]_ .. !! processed by numpydoc !! .. function:: find_elementary_leakage_modes(model, atol=1e-13) Detect elementary leakage modes. :Parameters: **model** : cobra.Model The metabolic model under investigation. **atol** : float, optional Values below the absolute tolerance are treated as zero. Expected to be very small but larger than zero. .. rubric:: Notes See [R63c97beb26b3-1]_ section 3.4 for a complete description of the algorithm. .. rubric:: References .. [R63c97beb26b3-1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Detection of Stoichiometric Inconsistencies in Biomolecular Models." Bioinformatics 24, no. 19 (2008): 2245. .. only:: latex [R63c97beb26b3-1]_ .. !! processed by numpydoc !! .. function:: detect_energy_generating_cycles(model, metabolite_id) Detect erroneous energy-generating cycles for a a single metabolite. The function will first build a dissipation reaction corresponding to the input metabolite. This reaction is then set as the objective for optimization, after closing all exchanges. If the reaction was able to carry flux, an erroneous energy-generating cycle must be present. In this case a list of reactions with a flux greater than zero is returned. Otherwise, the function returns False. :Parameters: **model** : cobra.Model The metabolic model under investigation. **metabolite_id** : str The identifier of an energy metabolite. .. rubric:: Notes "[...] energy generating cycles (EGC) [...] charge energy metabolites without a source of energy. [...] To efficiently identify the existence of diverse EGCs, we first add a dissipation reaction to the metabolic network for each metabolite used to transmit cellular energy; e.g., for ATP, the irreversible reaction ATP + H2O → ADP + P + H+ is added. These dissipation reactions close any existing energy-generating cycles, thereby converting them to type-III pathways. Fluxes through any of the dissipation reactions at steady state indicate the generation of energy through the metabolic network. Second, all uptake reactions are constrained to zero. The sum of the fluxes through the energy dissipation reactions is now maximized using FBA. For a model without EGCs, these reactions cannot carry any flux without the uptake of nutrients. [Re70472ebbbba-1]_." .. rubric:: References .. [Re70472ebbbba-1] Fritzemeier, C. J., Hartleb, D., Szappanos, B., Papp, B., & Lercher, M. J. (2017). Erroneous energy-generating cycles in published genome scale metabolic networks: Identification and removal. PLoS Computational Biology, 13(4), 1–14. http://doi.org/10.1371/journal.pcbi.1005494 .. only:: latex [Re70472ebbbba-1]_ .. !! processed by numpydoc !! .. function:: find_mass_unbalanced_reactions(reactions) Find metabolic reactions that are not mass balanced. :Parameters: **reactions** : iterable An iterable of cobra.Reaction's. .. !! processed by numpydoc !! .. function:: find_charge_unbalanced_reactions(reactions) Find metabolic reactions that are not charge balanced. :Parameters: **reactions** : iterable An iterable of cobra.Reaction's. .. !! processed by numpydoc !! .. function:: find_stoichiometrically_balanced_cycles(model) Find metabolic reactions in stoichiometrically balanced cycles (SBCs). Identify forward and reverse cycles by closing all exchanges and using FVA. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. rubric:: Notes "SBCs are artifacts of metabolic reconstructions due to insufficient constraints (e.g., thermodynamic constraints and regulatory constraints) [Rc9b74fe00a19-1]_." They are defined by internal reactions that carry flux in spite of closed exchange reactions. .. rubric:: References .. [Rc9b74fe00a19-1] Thiele, I., & Palsson, B. Ø. (2010, January). A protocol for generating a high-quality genome-scale metabolic reconstruction. Nature protocols. Nature Publishing Group. http://doi.org/10.1038/nprot.2009.203 .. only:: latex [Rc9b74fe00a19-1]_ .. !! processed by numpydoc !! .. function:: find_orphans(model) Return metabolites that are only consumed in reactions. Metabolites that are involved in an exchange reaction are never considered to be orphaned. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. !! processed by numpydoc !! .. function:: find_deadends(model) Return metabolites that are only produced in reactions. Metabolites that are involved in an exchange reaction are never considered to be dead ends. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. !! processed by numpydoc !! .. function:: find_disconnected(model) Return metabolites that are not in any of the reactions. :Parameters: **model** : cobra.Model The metabolic model under investigation. .. !! processed by numpydoc !! .. function:: _init_worker(model, variable_name, coefficient) Initialize a global model object for multiprocessing. :Parameters: **model** : cobra.Model The metabolic model under investigation. **variable_name: str** The name of the variable representing the metabolite exchange. **coefficient: int** The value of the metabolite's stoichiometric coefficient: -1 to test if the model can produce the metabolite and 1 to test if it can be consumed. .. !! processed by numpydoc !! .. function:: _solve_metabolite_exchange(metabolite_id) Solve for a metabolite's exchange flux. By adding the exchange variable to the metabolite constraint, the solution tests whether the metabolic model produce or consume the metabolite. :Parameters: **metabolite_id: str** The exchange will be added to this metabolite as a linear coefficient. :Returns: float The numeric value of the solution of the flux-balance problem; *NaN* if infeasible. str The identifier of the considered metabolite. .. rubric:: Notes The model, exchange variable, and stoichiometric coefficient are globals. .. !! processed by numpydoc !! .. function:: find_blocked_metabolites(model, coefficient, processes=None) Return metabolite identifiers that cannot be produced or consumed. :Parameters: **model** : cobra.Model The metabolic model under investigation. **coefficient: int** Test if production is possible with -1 and consumption with 1. **processes: int, optional** Number of processes to be used (the default is taken from `cobra.Configuration.processes`). :Returns: list The identifiers of blocked metabolites. .. !! processed by numpydoc !! .. function:: find_metabolites_not_produced_with_open_bounds(model, processes=None) Return metabolite identifiers that cannot be produced with open exchanges. A perfect model should be able to produce each and every metabolite when all medium components are available. :Parameters: **model** : cobra.Model The metabolic model under investigation. **processes: int, optional** Number of processes to be used (the default is taken from `cobra.Configuration.processes`). :Returns: list The metabolite identifiers that could not be produced. .. !! processed by numpydoc !! .. function:: find_metabolites_not_consumed_with_open_bounds(model, processes=None) Return metabolite identifiers that cannot be consumed with open exchanges. When all metabolites can be secreted, it should be possible for each and every metabolite to be consumed in some form. :Parameters: **model** : cobra.Model The metabolic model under investigation. **processes: int, optional** Number of processes to be used (the default is taken from `cobra.Configuration.processes`). :Returns: list The metabolite identifiers that could not be consumed. .. !! processed by numpydoc !! .. function:: find_reactions_with_unbounded_flux_default_condition(model) Return list of reactions whose flux is unbounded in the default condition. :Parameters: **model** : cobra.Model The metabolic model under investigation. :Returns: tuple list A list of reactions that in default modeling conditions are able to carry flux as high/low as the systems maximal and minimal bounds. float The fraction of the amount of unbounded reactions to the amount of non-blocked reactions. list A list of reactions that in default modeling conditions are not able to carry flux at all. .. !! processed by numpydoc !!