gempipe.interface.sanity
Module Contents
Functions
|
Set all the EX_change reactions to (0, 0). |
|
Test the presence of energy-generating cycles (EGCs). |
|
Quickly check the presence of EGCs for the main metabolites. |
|
Check presence of sink reactions. |
|
Check presence of demand reactions. |
|
Check presence of sink and demand reactions. |
|
Check that every EX_change reaction ID begins with |
|
Remove all annotations from EX_change reactions. |
|
Check if all metabolites have a charge attribute. |
|
Check if all metabolites have a formula attribute. |
|
Check if artificial atoms like 'R' and 'X' are present. |
|
Get the minimum and maximum bounds used in the model. |
|
Set the uncontrained flux constants to 1000. |
|
Check the presence of constrained metabolic reactions. |
|
Check the presence of mass-unbalaned reactions in the model. |
|
Check the presence of charge-unbalaned reactions in the model. |
|
Search for biomass reactions. |
|
Print a small sanity report. |
- gempipe.interface.sanity.close_boundaries(model)[source]
Set all the EX_change reactions to (0, 0).
- Parameters:
model (cobra.Model) – target model.
- gempipe.interface.sanity.verify_egc(model, mid, escher=False, threshold=1e-05, verbose=True)[source]
Test the presence of energy-generating cycles (EGCs).
Can also output a model for Escher, with just the reactions composing the cycle.
- Parameters:
model (cobra.Model) – target model. Must be encoded with the BiGG notation.
mid (str) – metabolite ID for which the EGC must be checked. Warning: must be without compartment, so for example
atpinstead ofatp_c.escher (bool) – save a reduced
cobra.Modelin the current directory. To be loaded in Escher.threshold (float) – values below this treshold are considered as 0.
verbose (bool) – if True, show results of the test even if no EGC was detected.
- Returns:
Trueif an EGC is detected.- Return type:
bool
- gempipe.interface.sanity.verify_egc_all(model)[source]
Quickly check the presence of EGCs for the main metabolites.
Internally calls verify_egc() over a list of metabolite IDs.
- Parameters:
model (cobra.Model) – target model.
- gempipe.interface.sanity.check_sinks(model, verbose=True)[source]
Check presence of sink reactions.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of sink reactions found.
- Return type:
list
- gempipe.interface.sanity.check_demands(model, verbose=True)[source]
Check presence of demand reactions.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of demand reactions found.
- Return type:
list
- gempipe.interface.sanity.check_sinks_demands(model, verbose=True)[source]
Check presence of sink and demand reactions.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of sink/demand reactions found.
- Return type:
list
- gempipe.interface.sanity.check_exr_notation(model, verbose=True)[source]
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.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of EX_change reactions with bad ID.
- Return type:
list
- gempipe.interface.sanity.remove_EX_annots(model)[source]
Remove all annotations from EX_change reactions.
- Parameters:
model (cobra.Model) – target model.
- gempipe.interface.sanity.check_missing_charges(model, verbose=True)[source]
Check if all metabolites have a charge attribute.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of matabolites missing the charge attribute.
- Return type:
list
- gempipe.interface.sanity.check_missing_formulas(model, verbose=True)[source]
Check if all metabolites have a formula attribute.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of matabolites missing the formula attribute.
- Return type:
list
- gempipe.interface.sanity.check_artificial_atoms(model, preview=None, verbose=True)[source]
Check if artificial atoms like ‘R’ and ‘X’ are present.
- Parameters:
model (cobra.Model) – target model.
preview (int) – maximum number of metabolite IDs to show for each artificial atom. If
None, they will be all displayed.verbose (bool) – if
False, don’t print.
- Returns:
IDs of matabolites with artificial atoms.
- Return type:
list
- gempipe.interface.sanity.get_unconstrained_bounds(model)[source]
Get the minimum and maximum bounds used in the model.
Usually they correspond to the “unconstrained” negative and positive flux constants.
- Parameters:
model (cobra.Model) – target model.
- Returns:
min and max bounds.
- Return type:
tuple
- gempipe.interface.sanity.reset_unconstrained_bounds(model)[source]
Set the uncontrained flux constants to 1000.
- Parameters:
model (cobra.Model) – target model.
- gempipe.interface.sanity.check_constrained_metabolic(model, verbose=True)[source]
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.
- Parameters:
model (cobra.Model) – target model.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of reactions with constrained metabolic reactions.
- Return type:
list
- gempipe.interface.sanity.check_mass_unbalances(model, threshold=1e-05, verbose=True)[source]
Check the presence of mass-unbalaned reactions in the model.
EExchange, sink, demand, and biomass reactions are ignored.
- Parameters:
model (cobra.Model) – target model.
threshold (float) – values below this treshold are considered as 0.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of reactions with mass unbalanced.
- Return type:
list
- gempipe.interface.sanity.check_charge_unbalances(model, threshold=1e-05, verbose=True)[source]
Check the presence of charge-unbalaned reactions in the model.
Exchange, sink, demand, and biomass reactions are ignored.
- Parameters:
model (cobra.Model) – target model.
threshold (float) – values below this treshold are considered as 0.
verbose (bool) – if
False, don’t print.
- Returns:
IDs of reactions with charge unbalanced.
- Return type:
list
- gempipe.interface.sanity.search_biomass(model, show_reaction=False, verbose=True)[source]
Search for biomass reactions.
Simple function involving just an exact match of substrings: ‘biomass’, ‘growth’, ‘bof’.
- Parameters:
model (cobra.Model) – target model.
show_reaction (bool) – whether to show also the reaction string