6.1.1.6.1.6. pytfa.thermo.utils

Some tools around COBRApy models used by pyTFA

6.1.1.6.1.6.1. Module Contents

6.1.1.6.1.6.1.1. Functions

check_reaction_balance(reaction, proton=None)

Check the balance of a reaction, and eventually add protons to balance

find_transported_mets(reaction)

Get a list of the transported metabolites of the reaction.

check_transport_reaction(reaction)

Check if a reaction is a transport reaction

is_same_stoichiometry(this_reaction, that_reaction)

is_exchange(rxn)

get_reaction_compartment(reaction)

Get the compartment of a reaction to then prepare it for conversion.

6.1.1.6.1.6.1.2. Attributes

Formula_regex

pytfa.Formula_regex
pytfa.check_reaction_balance(reaction, proton=None)

Check the balance of a reaction, and eventually add protons to balance it

Parameters
  • reaction (cobra.thermo.reaction.Reaction) – The reaction to check the balance of.

  • proton (cobra.thermo.metabolite.Metabolite) – Optional The proton to add to the reaction to balance it.

Returns

The balance of the reaction :

  • drain flux

  • missing structures

  • balanced

  • N protons added to reactants with N a float

  • N protons added to products with N a float

  • missing atoms

Return type

str

If proton is provided, this function will try to balance the equation with it, and return the result.

If no proton is provided, this function will not try to balance the equation.

Warning

This function does not verify if proton is in the correct compartment, so make sure you provide the proton belonging to the correct compartment !

pytfa.find_transported_mets(reaction)

Get a list of the transported metabolites of the reaction.

Parameters

reaction (cobra.thermo.reaction.Reaction) – The reaction to get the transported metabolites of

Returns

A dictionnary of the transported metabolites. The index corresponds to the seed_id of the transported enzyme

The value is a dictionnairy with the following values:

  • coeff (float):

    The stoechiomectric coefficient of the enzyme

  • reactant (cobra.thermo.enzyme.Metabolite):

    The reactant of the reaction corresponding to the transported enzyme

  • product (cobra.thermo.enzyme.Metabolite):

    The product of the reaction corresponding to the transported enzyme

A transported enzyme is defined as a enzyme which is a product and a reactant of a reaction. We can distinguish them thanks to their seed_ids.

pytfa.check_transport_reaction(reaction)

Check if a reaction is a transport reaction

Parameters

reaction (cobra.thermo.reaction.Reaction) – The reaction to check

Returns

Whether the reaction is a transport reaction or not

Return type

bool

A transport reaction is defined as a reaction that has the same compound as a reactant and a product. We can distinguish them thanks to their seed_ids. If they have one If not, use met_ids and check if they are the same, minus compartment

pytfa.is_same_stoichiometry(this_reaction, that_reaction)
pytfa.is_exchange(rxn)
pytfa.get_reaction_compartment(reaction)

Get the compartment of a reaction to then prepare it for conversion.