Thermoqp¶
- driver_testThermoQP[source]¶
Driver script that exercises thermoQP on the E. coli core model, setting up the objective and stoichiometric-consistency information before solving.
- thermoFlux2QNty(model, solution, param)[source]¶
Given a steady state thermodynamically feasible flux vector, v, such that
S*v = b
l <= v <= u
Compute q and g = N’*y such that
N*diag(q)*g = b - B*w
where the stoichiometric matrix and flux vector are split into internal and external components: S = [N B] and v = [z; w],
- USAGE:
[q, g, solutionQP] = thermoFlux2QNty (model, solution, param)
- INPUTS:
model – COBRA model with fields:
.S - m x n stoichiometric matrix
.K - matrix whose transpose is used to construct the thermodynamic QP
.SConsistentMetBool - m x 1 boolean, stoichiometrically consistent metabolites
.SConsistentRxnBool - n x 1 boolean, stoichiometrically consistent reactions
.SIntMetBool - m x 1 boolean, true for internal metabolites
.SIntRxnBool - n x 1 boolean, true for internal reactions
solution – a solution structure providing the steady-state flux vector (.v)
- OPTIONAL INPUT:
param – a structure containing the parameters for the function:
.SConsistentMethod - method used to identify the stoichiometrically consistent subset if not already present (‘findSExRxnInd’ or ‘findStoichConsistentSubset’)
.printLevel - verbose level controlling printed output
.bigNum - large positive number used as a bound in the QP (Default: 1)
- OUTPUTS:
q – n x 1 vector of thermodynamic quantities per reaction
g – n x 1 vector g = N’*y satisfying N*diag(q)*g = b - B*w
solutionQP – the QP solution structure returned by solveCobraQP
- thermoQP(model, q, param)[source]¶
Compute an approximately thermodynamically feasible flux by minimising the Euclidean norm, weighted by the conductances provided in q.
- USAGE:
sol = thermoQP (model, q, param)
- INPUTS:
model – COBRA model with the following required fields (others can be supplied):
.S - m x n stoichiometric matrix
.c - n x 1 linear objective coefficients
.lb - n x 1 lower bounds
.ub - n x 1 upper bounds
.b - m x 1 accumulation (right hand side of S*v = b)
.osense - objective sense as a number (-1 maximise, +1 minimise)
.osenseStr - objective sense as a string (‘max’ or ‘min’; default ‘max’)
.SConsistentRxnBool - n x 1 boolean, stoichiometrically consistent reactions
.SIntRxnBool - n x 1 boolean, true for internal reactions
q – n x 1 vector of reaction conductances
- OPTIONAL INPUTS:
model – the following optional fields are also used:
.dxdt - m x 1 change in concentration with time
.csense - m x 1 character array with entries in {L,E,G} (backward compatible with an m + k x 1 csense vector, where k is the number of coupling constraints)
.C - k x n left hand side of C*v <= d
.d - k x 1 right hand side of C*v <= d
.dsense - k x 1 character array with entries in {L,E,G}
param – a structure containing the parameters for the function:
.printLevel - verbose level controlling printed output
.fbaOptimal - if true, first solve an FBA to define the external flux
.param - nested parameter sub-structure read by the function (e.g. .param.printLevel)
- OUTPUT:
sol – solution object with fields:
.f - objective value
.v - reaction rates (optimal primal variable, legacy FBAsolution.x)
.y - dual variables
.w - reduced costs
.s - slacks
.stat - solver status in standardized form