:py:mod:`gempipe.interface.sanity` ================================== .. py:module:: gempipe.interface.sanity Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: gempipe.interface.sanity.close_boundaries gempipe.interface.sanity.verify_egc gempipe.interface.sanity.verify_egc_all gempipe.interface.sanity.check_sinks gempipe.interface.sanity.check_demands gempipe.interface.sanity.check_sinks_demands gempipe.interface.sanity.check_exr_notation gempipe.interface.sanity.remove_EX_annots gempipe.interface.sanity.check_missing_charges gempipe.interface.sanity.check_missing_formulas gempipe.interface.sanity.check_artificial_atoms gempipe.interface.sanity.get_unconstrained_bounds gempipe.interface.sanity.reset_unconstrained_bounds gempipe.interface.sanity.check_constrained_metabolic gempipe.interface.sanity.check_mass_unbalances gempipe.interface.sanity.check_charge_unbalances gempipe.interface.sanity.search_biomass gempipe.interface.sanity.sanity_report .. py:function:: close_boundaries(model) Set all the EX_change reactions to (0, 0). :param model: target model. :type model: cobra.Model .. py:function:: verify_egc(model, mid, escher=False, threshold=1e-05, verbose=True) Test the presence of energy-generating cycles (EGCs). Can also output a model for Escher, with just the reactions composing the cycle. :param model: target model. Must be encoded with the BiGG notation. :type model: cobra.Model :param mid: metabolite ID for which the EGC must be checked. Warning: must be without compartment, so for example ``atp`` instead of ``atp_c``. :type mid: str :param escher: save a reduced ``cobra.Model`` in the current directory. To be loaded in Escher. :type escher: bool :param threshold: values below this treshold are considered as 0. :type threshold: float :param verbose: if True, show results of the test even if no EGC was detected. :type verbose: bool :returns: ``True`` if an EGC is detected. :rtype: bool .. py:function:: verify_egc_all(model) Quickly check the presence of EGCs for the main metabolites. Internally calls `verify_egc()` over a list of metabolite IDs. :param model: target model. :type model: cobra.Model .. py:function:: check_sinks(model, verbose=True) Check presence of sink reactions. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of sink reactions found. :rtype: list .. py:function:: check_demands(model, verbose=True) Check presence of demand reactions. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of demand reactions found. :rtype: list .. py:function:: check_sinks_demands(model, verbose=True) Check presence of sink and demand reactions. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of sink/demand reactions found. :rtype: list .. py:function:: check_exr_notation(model, verbose=True) Check that every EX_change reaction ID begins with ``EX_``. Here EX_change reactions are defined as those reactions having just 1 metabolite involved, included in the extracellular compartment. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of EX_change reactions with bad ID. :rtype: list .. py:function:: remove_EX_annots(model) Remove all annotations from EX_change reactions. :param model: target model. :type model: cobra.Model .. py:function:: check_missing_charges(model, verbose=True) Check if all metabolites have a charge attribute. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of matabolites missing the charge attribute. :rtype: list .. py:function:: check_missing_formulas(model, verbose=True) Check if all metabolites have a formula attribute. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of matabolites missing the formula attribute. :rtype: list .. py:function:: check_artificial_atoms(model, preview=None, verbose=True) Check if artificial atoms like 'R' and 'X' are present. :param model: target model. :type model: cobra.Model :param preview: maximum number of metabolite IDs to show for each artificial atom. If ``None``, they will be all displayed. :type preview: int :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of matabolites with artificial atoms. :rtype: list .. py:function:: get_unconstrained_bounds(model) Get the minimum and maximum bounds used in the model. Usually they correspond to the "unconstrained" negative and positive flux constants. :param model: target model. :type model: cobra.Model :returns: min and max bounds. :rtype: tuple .. py:function:: reset_unconstrained_bounds(model) Set the uncontrained flux constants to 1000. :param model: target model. :type model: cobra.Model .. py:function:: check_constrained_metabolic(model, verbose=True) Check the presence of constrained metabolic reactions. Metabolic reactions are here defined as those having more then 1 involved metabolites. Constrained reactions are here defined as those having bounds other then (0, 1000) or (-1000, 1000). Biomass assembly reactions are ignored. :param model: target model. :type model: cobra.Model :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of reactions with constrained metabolic reactions. :rtype: list .. py:function:: check_mass_unbalances(model, threshold=1e-05, verbose=True) Check the presence of mass-unbalaned reactions in the model. EExchange, sink, demand, and biomass reactions are ignored. :param model: target model. :type model: cobra.Model :param threshold: values below this treshold are considered as 0. :type threshold: float :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of reactions with mass unbalanced. :rtype: list .. py:function:: check_charge_unbalances(model, threshold=1e-05, verbose=True) Check the presence of charge-unbalaned reactions in the model. Exchange, sink, demand, and biomass reactions are ignored. :param model: target model. :type model: cobra.Model :param threshold: values below this treshold are considered as 0. :type threshold: float :param verbose: if ``False``, don't print. :type verbose: bool :returns: IDs of reactions with charge unbalanced. :rtype: list .. py:function:: search_biomass(model, show_reaction=False, verbose=True) Search for biomass reactions. Simple function involving just an exact match of substrings: 'biomass', 'growth', 'bof'. :param model: target model. :type model: cobra.Model :param show_reaction: whether to show also the reaction string :type show_reaction: bool .. py:function:: sanity_report(model) Print a small sanity report. Get a sanity report calling some of the gempipe.curate functions. :param model: target model. :type model: cobra.Model