6.1.1.6. pytfa.thermo
¶
Thermodynamic analysis for Flux-Based Analysis
6.1.1.6.1. Submodules¶
6.1.1.6.2. Package Contents¶
6.1.1.6.2.1. Classes¶
A class representing the thermodynamic values of a enzyme |
|
Class to represent a simultaneous use constraint on reaction variables |
|
Class to represent thermodynamics constraints. |
|
Class to represent thermodynamics coupling: DeltaG of reactions has to be |
|
Class to represent thermodynamics coupling: DeltaG of reactions has to be |
|
Class to represent a backward directionality coupling with thermodynamics on |
|
Class to represent a forward directionality coupling with thermodynamics on |
|
Class to represent a variable attached to a reaction |
|
Class to represent a variable attached to a enzyme |
|
Class to represent the coupling to the thermodynamic displacement |
|
Class to represent the thermodynamic displacement of a reaction |
|
Class to represent a DeltaG^o (naught) - standard conditions |
|
Class to represent a DeltaG |
|
Class to represent a forward use variable, a type of binary variable used to |
|
Class to represent a backward use variable, a type of binary variable used |
|
Class to represent a log concentration of a enzyme |
|
Class to represent a variable attached to a reaction |
|
Class to represent a variable attached to a enzyme |
|
A class representing a cobra_model with thermodynamics information |
|
A class representing the thermodynamic values of a enzyme |
6.1.1.6.2.2. Functions¶
|
Calculates the RHS of the deltaG constraint, i.e. the sum of the |
|
Calculates the deltaG reaction and error of the reaction using the |
The Debye-Huckel A and B do depend on the temperature |
|
|
Check the balance of a reaction, and eventually add protons to balance |
|
Check if a reaction is a transport reaction |
|
Get a list of the transported metabolites of the reaction. |
|
Get the compartment of a reaction to then prepare it for conversion. |
|
Sets up a logger that outputs INFO+ messages on stdout and DEBUG+ messages |
6.1.1.6.2.3. Attributes¶
- class pytfa.thermo.MetaboliteThermo(metData, pH, ionicStr, temperature=std.TEMPERATURE_0, min_ph=std.MIN_PH, max_ph=std.MAX_PH, debye_huckel_b=std.DEBYE_HUCKEL_B_0, thermo_unit='kJ/mol', debug=False)¶
A class representing the thermodynamic values of a enzyme
- Parameters
metData (dict) – A dictionary containing the values for the enzyme, from the thermodynamic database
pH (float) – The pH of the enzyme’s compartment
ionicStr (float) – The ionic strength of the enzyme’s compartment
temperature –
min_ph –
max_ph –
debye_huckel_b –
thermo_unit (string) – The unit used in metData’s values
debug (bool) – Optional If set to
True
, some debugging values will be printed. This is only useful for development or debugging purposes.
Note
The values are automatically computed on class creation. Usually you don’t have to call any methods defined by this class, but only to access the attributes you need.
The available attributes are :
Since the reactions expose similar values through a dictionnary, it is better to access the attributes aforementionned of this class as if it was a dictionnary :
enzyme.thermo['pH']
.- __getitem__(self, key)¶
- __repr__(self)¶
Return repr(self).
- keys(self)¶
- values(self)¶
- items(self)¶
- __cmp__(self, dict_)¶
- __contains__(self, item)¶
- __iter__(self)¶
- __unicode__(self)¶
- calcDGis(self)¶
Calculate the transformed Gibbs energy of formation of specie with given pH and ionic strength using formula given by Goldberg and Tewari, 1991
Equation 4.5-6 in Alberty’s book
- Returns
DG_is for the enzyme
- Return type
- calcDGsp(self)¶
Calculate the transformed Gibbs energy of formation of specie with given pH and ionic strength using formula given by Goldberg and Tewari, 1991
Equation 4.4-10 in Alberty’s book
- Returns
DG_sp for the enzyme
- Return type
- calc_potential(self)¶
Calculate the binding polynomial of a specie, with pK values
- Returns
The potential of the enzyme
- Return type
- _calc_pka(self, pka, sigmanusq)¶
- calcDGspA(self)¶
Calculates deltaGf, charge and nH of the specie when it is at least protonated state based on MFAToolkit compound data for the pKa values within the range considered (MIN_pH to MAX_pH).
These values are used as the starting point for Alberty’s calculations.
- pytfa.thermo.calcDGtpt_rhs(reaction, compartmentsData, thermo_units)¶
Calculates the RHS of the deltaG constraint, i.e. the sum of the non-concentration terms
- Parameters
- Returns
deltaG_tpt and the breakdown of deltaG_tpt
- Return type
- Example:
ATP Synthase reaction:
reaction = cpd00008 + 4 cpd00067 + cpd00009 <=> cpd00002 + 3 cpd00067 + cpd00001 compartments = 'c' 'e' 'c' 'c' 'c' 'c'
- If there are any metabolites with unknown energies then returns
(0, None)
.
- pytfa.thermo.calcDGR_cues(reaction, reaction_cues_data)¶
Calculates the deltaG reaction and error of the reaction using the constituent structural cues changes and returns also the error if any.
- Parameters
reaction (cobra.thermo.reaction.Reaction) – The reaction to compute deltaG for
reaction_cues_data (dict) –
- Returns
deltaGR, error on deltaGR, the cues in the reaction (keys of the dictionnary) and their indices (values of the dictionnary), and the error code if any.
If everything went right, the error code is an empty string
- Return type
- pytfa.thermo.get_debye_huckel_b(T)¶
The Debye-Huckel A and B do depend on the temperature As for now though they are returned as a constant (value at 298.15K)
- Parameters
T – Temperature in Kelvin
- Returns
Debye_Huckel_B
- pytfa.thermo.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 :
- Return type
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 theproton
belonging to the correct compartment !
- pytfa.thermo.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
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.thermo.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
- coeff (
- reactant (
cobra.thermo.enzyme.Metabolite
): The reactant of the reaction corresponding to the transported enzyme
- reactant (
- product (
cobra.thermo.enzyme.Metabolite
): The product of the reaction corresponding to the transported enzyme
- product (
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.thermo.get_reaction_compartment(reaction)¶
Get the compartment of a reaction to then prepare it for conversion.
- class pytfa.thermo.SimultaneousUse(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent a simultaneous use constraint on reaction variables Looks like: SU_rxn: FU_rxn + BU_rxn <= 1
- prefix = SU_¶
- class pytfa.thermo.NegativeDeltaG(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent thermodynamics constraints.
- G: - DGR_rxn + DGoRerr_Rxn + RT * StoichCoefProd1 * LC_prod1
RT * StoichCoefProd2 * LC_prod2
RT * StoichCoefSub1 * LC_subs1
RT * StoichCoefSub2 * LC_subs2
…
= 0
- prefix = G_¶
- class pytfa.thermo.BackwardDeltaGCoupling(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent thermodynamics coupling: DeltaG of reactions has to be DGR > 0 for the reaction to proceed backwards Looks like: BU_rxn: 1000 BU_rxn - DGR_rxn < 1000
- prefix = BU_¶
- class pytfa.thermo.ForwardDeltaGCoupling(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent thermodynamics coupling: DeltaG of reactions has to be DGR < 0 for the reaction to proceed forwards Looks like: FU_rxn: 1000 FU_rxn + DGR_rxn < 1000
- prefix = FU_¶
- class pytfa.thermo.BackwardDirectionCoupling(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent a backward directionality coupling with thermodynamics on reaction variables Looks like : UR_rxn: R_rxn - M RU_rxn < 0
- prefix = UR_¶
- class pytfa.thermo.ForwardDirectionCoupling(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent a forward directionality coupling with thermodynamics on reaction variables Looks like : UF_rxn: F_rxn - M FU_rxn < 0
- prefix = UF_¶
- class pytfa.thermo.ReactionConstraint(reaction, expr, **kwargs)¶
Bases:
GenericConstraint
Class to represent a variable attached to a reaction
- prefix = RC_¶
- property reaction(self)¶
- property id(self)¶
for cobra.thermo.DictList compatibility :return:
- property model(self)¶
- class pytfa.thermo.MetaboliteConstraint(metabolite, expr, **kwargs)¶
Bases:
GenericConstraint
Class to represent a variable attached to a enzyme
- prefix = MC_¶
- property metabolite(self)¶
- property id(self)¶
for cobra.thermo.DictList compatibility :return:
- property model(self)¶
- class pytfa.thermo.DisplacementCoupling(reaction, expr, **kwargs)¶
Bases:
ReactionConstraint
Class to represent the coupling to the thermodynamic displacement Looks like: Ln(Gamma) - (1/RT)*DGR_rxn = 0
- prefix = DC_¶
- class pytfa.thermo.ThermoDisplacement(reaction, **kwargs)¶
Bases:
ReactionVariable
Class to represent the thermodynamic displacement of a reaction Gamma = -DeltaG/RT
- prefix = LnGamma_¶
- class pytfa.thermo.DeltaGstd(reaction, **kwargs)¶
Bases:
ReactionVariable
Class to represent a DeltaG^o (naught) - standard conditions
- prefix = DGo_¶
- class pytfa.thermo.DeltaG(reaction, **kwargs)¶
Bases:
ReactionVariable
Class to represent a DeltaG
- prefix = DG_¶
- class pytfa.thermo.ForwardUseVariable(reaction, **kwargs)¶
Bases:
ReactionVariable
,BinaryVariable
Class to represent a forward use variable, a type of binary variable used to enforce forward directionality in reaction net fluxes
- prefix = FU_¶
- class pytfa.thermo.BackwardUseVariable(reaction, **kwargs)¶
Bases:
ReactionVariable
,BinaryVariable
Class to represent a backward use variable, a type of binary variable used to enforce backward directionality in reaction net fluxes
- prefix = BU_¶
- class pytfa.thermo.LogConcentration(metabolite, **kwargs)¶
Bases:
MetaboliteVariable
Class to represent a log concentration of a enzyme
- prefix = LC_¶
- class pytfa.thermo.ReactionVariable(reaction, **kwargs)¶
Bases:
GenericVariable
Class to represent a variable attached to a reaction
- prefix = RV_¶
- property reaction(self)¶
- property id(self)¶
for cobra.thermo.DictList compatibility :return:
- property model(self)¶
- class pytfa.thermo.MetaboliteVariable(metabolite, **kwargs)¶
Bases:
GenericVariable
Class to represent a variable attached to a enzyme
- prefix = MV_¶
- property metabolite(self)¶
- property id(self)¶
for cobra.thermo.DictList compatibility :return:
- property model(self)¶
- pytfa.thermo.get_bistream_logger(name)¶
Sets up a logger that outputs INFO+ messages on stdout and DEBUG+ messages in the log file
- Parameters
name – a class __name__ attribute
- Returns
- class pytfa.thermo.ThermoModel(thermo_data=None, model=Model(), name=None, temperature=std.TEMPERATURE_0, min_ph=std.MIN_PH, max_ph=std.MAX_PH)[source]¶
Bases:
pytfa.core.model.LCSBModel
,cobra.Model
A class representing a cobra_model with thermodynamics information
- _init_thermo(self)¶
- normalize_reactions(self)¶
Find reactions with important stoichiometry and normalizes them :return:
- _prepare_metabolite(self, met)¶
- Parameters
met –
- Returns
- _prepare_reaction(self, reaction, null_error_override=2)¶
- Parameters
reaction –
null_error_override – overrides DeltaG when it is 0 to allow flexibility. 2kcal/mol is standard in estimation frameworks like GCM.
- Returns
- prepare(self, null_error_override=2)¶
Prepares a COBRA toolbox cobra_model for TFBA analysis by doing the following:
checks if a reaction is a transport reaction
checks the ReactionDB for Gibbs energies of formation of metabolites
computes the Gibbs energies of reactions
- Parameters
null_error_override – overrides DeltaG when it is 0 to allow flexibility. 2kcal/mol is standard in estimation frameworks like GCM.
- _convert_metabolite(self, met, add_potentials, verbose)¶
Given a enzyme, proceeds to create the necessary variables and constraints for thermodynamics-based modeling
- Parameters
met –
- Returns
- _convert_reaction(self, rxn, add_potentials, add_displacement, verbose)¶
- Parameters
rxn –
add_potentials –
add_displacement –
verbose –
- Returns
- convert(self, add_potentials=False, add_displacement=False, verbose=True)¶
Converts a cobra_model into a tFBA ready cobra_model by adding the thermodynamic constraints required
Warning
This function requires you to have already called
prepare()
, otherwise it will raise an Exception !
- print_info(self, specific=False)¶
Print information and counts for the cobra_model :return:
- __deepcopy__(self, memo)¶
- Parameters
memo –
- Returns
- copy(self)¶
Needs to be reimplemented, as our objects have complicated hierarchy :return:
- class pytfa.thermo.MetaboliteThermo(metData, pH, ionicStr, temperature=std.TEMPERATURE_0, min_ph=std.MIN_PH, max_ph=std.MAX_PH, debye_huckel_b=std.DEBYE_HUCKEL_B_0, thermo_unit='kJ/mol', debug=False)¶
A class representing the thermodynamic values of a enzyme
- Parameters
metData (dict) – A dictionary containing the values for the enzyme, from the thermodynamic database
pH (float) – The pH of the enzyme’s compartment
ionicStr (float) – The ionic strength of the enzyme’s compartment
temperature –
min_ph –
max_ph –
debye_huckel_b –
thermo_unit (string) – The unit used in metData’s values
debug (bool) – Optional If set to
True
, some debugging values will be printed. This is only useful for development or debugging purposes.
Note
The values are automatically computed on class creation. Usually you don’t have to call any methods defined by this class, but only to access the attributes you need.
The available attributes are :
Since the reactions expose similar values through a dictionnary, it is better to access the attributes aforementionned of this class as if it was a dictionnary :
enzyme.thermo['pH']
.- __getitem__(self, key)¶
- __repr__(self)¶
Return repr(self).
- keys(self)¶
- values(self)¶
- items(self)¶
- __cmp__(self, dict_)¶
- __contains__(self, item)¶
- __iter__(self)¶
- __unicode__(self)¶
- calcDGis(self)¶
Calculate the transformed Gibbs energy of formation of specie with given pH and ionic strength using formula given by Goldberg and Tewari, 1991
Equation 4.5-6 in Alberty’s book
- Returns
DG_is for the enzyme
- Return type
- calcDGsp(self)¶
Calculate the transformed Gibbs energy of formation of specie with given pH and ionic strength using formula given by Goldberg and Tewari, 1991
Equation 4.4-10 in Alberty’s book
- Returns
DG_sp for the enzyme
- Return type
- calc_potential(self)¶
Calculate the binding polynomial of a specie, with pK values
- Returns
The potential of the enzyme
- Return type
- _calc_pka(self, pka, sigmanusq)¶
- calcDGspA(self)¶
Calculates deltaGf, charge and nH of the specie when it is at least protonated state based on MFAToolkit compound data for the pKa values within the range considered (MIN_pH to MAX_pH).
These values are used as the starting point for Alberty’s calculations.