gempipe.interface.sanity

Module Contents

Functions

close_boundaries(model)

Set all the EX_change reactions to (0, 0).

verify_egc(model, mid[, escher, threshold, verbose])

Test the presence of energy-generating cycles (EGCs).

verify_egc_all(model)

Quickly check the presence of EGCs for the main metabolites.

check_sinks(model[, verbose])

Check presence of sink reactions.

check_demands(model[, verbose])

Check presence of demand reactions.

check_sinks_demands(model[, verbose])

Check presence of sink and demand reactions.

check_exr_notation(model[, verbose])

Check that every EX_change reaction ID begins with EX_.

remove_EX_annots(model)

Remove all annotations from EX_change reactions.

check_missing_charges(model[, verbose])

Check if all metabolites have a charge attribute.

check_missing_formulas(model[, verbose])

Check if all metabolites have a formula attribute.

check_artificial_atoms(model[, preview, verbose])

Check if artificial atoms like 'R' and 'X' are present.

get_unconstrained_bounds(model)

Get the minimum and maximum bounds used in the model.

reset_unconstrained_bounds(model)

Set the uncontrained flux constants to 1000.

check_constrained_metabolic(model[, verbose])

Check the presence of constrained metabolic reactions.

check_mass_unbalances(model[, threshold, verbose])

Check the presence of mass-unbalaned reactions in the model.

check_charge_unbalances(model[, threshold, verbose])

Check the presence of charge-unbalaned reactions in the model.

search_biomass(model[, show_reaction, verbose])

Search for biomass reactions.

sanity_report(model)

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 atp instead of atp_c.

  • escher (bool) – save a reduced cobra.Model in 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:

True if 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

gempipe.interface.sanity.sanity_report(model)[source]

Print a small sanity report.

Get a sanity report calling some of the gempipe.curate functions.

Parameters:

model (cobra.Model) – target model.