6.1.1.4.1.2. pytfa.optim.constraints

Constraints declarations

6.1.1.4.1.2.1. Module Contents

6.1.1.4.1.2.1.1. Classes

GenericConstraint

Class to represent a generic constraint. The purpose is that the interface

ModelConstraint

Class to represent a variable attached to the model

GeneConstraint

Class to represent a variable attached to a enzyme

ReactionConstraint

Class to represent a variable attached to a reaction

MetaboliteConstraint

Class to represent a variable attached to a enzyme

NegativeDeltaG

Class to represent thermodynamics constraints.

ForwardDeltaGCoupling

Class to represent thermodynamics coupling: DeltaG of reactions has to be

BackwardDeltaGCoupling

Class to represent thermodynamics coupling: DeltaG of reactions has to be

ForwardDirectionCoupling

Class to represent a forward directionality coupling with thermodynamics on

BackwardDirectionCoupling

Class to represent a backward directionality coupling with thermodynamics on

SimultaneousUse

Class to represent a simultaneous use constraint on reaction variables

DisplacementCoupling

Class to represent the coupling to the thermodynamic displacement

ForbiddenProfile

Class to represent a forbidden net flux directionality profile

LinearizationConstraint

Class to represent a variable attached to a reaction

class pytfa.GenericConstraint(expr, id_='', model=None, hook=None, queue=False, **kwargs)
Class to represent a generic constraint. The purpose is that the interface

is instantiated on initialization, to follow the type of interface used by the problem, and avoid incompatibilities in optlang

Attributes:

id

Used for DictList comprehension. Usually points back at a

enzyme or reaction id for ease of linking. Should be unique given a constraint type. :name: Should be a concatenation of the id and a prefix that is specific to the variable type. will be used to address the constraint at the solver level, and hence should be unique in the whole cobra_model :expr: the expression of the constraint (sympy.Expression subtype) :cobra_model: the cobra_model hook. :constraint: links directly to the cobra_model representation of tbe constraint

prefix
property __attrname__(self)

Name the attribute the instances will have Example: GenericConstraint -> generic_constraint :return:

get_interface(self, expr, queue)

Called upon completion of __init__, initializes the value of self.var, which is returned upon call, and stores the actual interfaced variable.

Returns

instance of Variable from the problem

make_name(self)
Needs to be overridden by the subclass, concats the id with a

prefix

Returns

None

change_expr(self, new_expr, sloppy=False)
property expr(self)
property name(self)
property id(self)

for cobra.thermo.DictList compatibility :return:

property constraint(self)
property model(self)
__repr__(self)

Return repr(self).

class pytfa.ModelConstraint(model, expr, id_, **kwargs)

Bases: GenericConstraint

Class to represent a variable attached to the model

prefix = MODC_
class pytfa.GeneConstraint(gene, expr, **kwargs)

Bases: GenericConstraint

Class to represent a variable attached to a enzyme

prefix = GC_
property gene(self)
property id(self)

for cobra.thermo.DictList compatibility :return:

property model(self)
class pytfa.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.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.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.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.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.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.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.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.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.ForbiddenProfile(model, expr, id_, **kwargs)

Bases: GenericConstraint

Class to represent a forbidden net flux directionality profile Looks like: FU_rxn_1 + BU_rxn_2 + … + FU_rxn_n <= n-1

prefix = FP_
class pytfa.LinearizationConstraint(model, expr, id_, **kwargs)

Bases: ModelConstraint

Class to represent a variable attached to a reaction

prefix = LC_
static from_constraints(cons, model)