Relaxedfba¶
- plotRelaxedFBA(sol, model, tol)[source]¶
Print a summary of a relaxedFBA solution, reporting which steady state constraints and which reaction bounds were relaxed to make the model feasible
- USAGE:
plotRelaxedFBA (sol, model, tol)
- INPUTS:
sol – relaxedFBA solution structure with fields:
.stat - solution status (1 if relaxedFBA solved successfully)
.v - reaction rate
.r - relaxation on the steady state constraints S*v = b
.p - relaxation on the lower bounds of reactions
.q - relaxation on the upper bounds of reactions
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.b - m x 1 right hand side of S*v = b
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.rxns - n x 1 reaction identifiers
.mets - m x 1 metabolite identifiers
.SIntRxnBool - n x 1 boolean, true for internal reactions
- OPTIONAL INPUTS:
tol – tolerance below which a relaxation is treated as zero (default: 100 * LP feasTol)
- relaxFBA_cappedL1(model, param)[source]¶
Finds the mimimal set of relaxations on bounds and steady state constraints to make the FBA problem feasible. The zero-norm is appproximated by capped-L1 norm
- USAGE:
[solution] = relaxFBA_cappedL1 (model, param)
- INPUTS:
model – COBRA model structure with fields:
.S - m x n stoichiometric matrix
.b - m x 1 right hand side of S*v = b
.c - n x 1 linear objective coefficients
.lb - n x 1 lower flux bounds
.ub - n x 1 upper flux bounds
.csense - m x 1 constraint sense for each row of S (E, L or G)
.C - additional inequality constraint matrix (C*v <= d)
.d - right hand side of the C*v <= d constraints
.dsense - constraint sense for each row of C
param – structure containing the relaxation options:
.excludedReactions - bool vector of size n, reactions excluded from relaxation
.excludedReactionLB - n x 1 bool vector, reactions whose lower bound is excluded from relaxation
.excludedReactionUB - n x 1 bool vector, reactions whose upper bound is excluded from relaxation
.excludedMetabolites - bool vector of size m, metabolites excluded from relaxation
.toBeUnblockedReactions - n x 1 vector indicating reactions to be unblocked
.nbMaxIteration - stopping criterion, maximum number of iterations
.epsilon - stopping criterion tolerance
.theta - parameter of the capped-L1 approximation
.maxUB - maximum finite upper bound used when relaxing bounds
.minLB - minimum finite lower bound used when relaxing bounds
.maxRelaxR - maximum relaxation of any bound or equality constraint permitted
.printLevel - verbosity of the progress output
.gamma0 - zero-norm weight on the reaction rate
.gamma1 - one-norm weight on the reaction rate
.lambda0 - zero-norm weight on relaxation of steady state constraints
.lambda1 - one-norm weight on relaxation of steady state constraints
.alpha0 - zero-norm weight on relaxation of reaction bounds
.alpha1 - one-norm weight on relaxation of reaction bounds
- OUTPUT:
solution – Structure containing the following fields:
stat - status
1 = Solution found
0 = Infeasible
-1 = Invalid input
r - relaxation on steady state constraints \(S*v = b\)
p - relaxation on lower bound of reactions
q - relaxation on upper bound of reactions
v - reaction rate
\[\begin{split}min ~&~ c^T v + \gamma_1 ||v||_1 + \gamma_0 ||v||_0 + \lambda_1 ||r||_1 + \lambda_0 ||r||_0 \\ ~&~ + \alpha_1 (||p||_1 + ||q||_1) + \alpha_0 (||p||_0 + ||q||_0) \\ s.t. ~&~ S v + r = b \\ ~&~ l - p \leq v \leq u + q \\ ~&~ r \in R^m \\ ~&~ p,q \in R_+^n\end{split}\]m - number of metabolites, n - number of reactions
- relaxedFBA(model, param)[source]¶
Finds the mimimal set of relaxations on bounds and steady state constraints to make the FBA problem feasible. The optional parameters, excludedReactions and excludedMetabolites override all other relaxation options.
\[\begin{split}min ~&~ c^T v + \gamma ||v||_0 + \lambda ||r||_0 + \alpha (||p||_0 + ||q||_0) \\ s.t ~&~ S v + r \leq, =, \geq b \\ ~&~ l - p \leq v \leq u + q \\ ~&~ r \in R^nMets \\ ~&~ p,q \in R_+^nRxns\end{split}\]nMets - number of metabolites, nRxns - number of reactions
- USAGE:
[solution] = relaxedFBA (model, param)
- INPUTS:
model – COBRA model structure with the fields: * .S * .b * .lb * .ub * .mets (required if model.SIntRxnBool absent) * .rxns (required if model.SIntRxnBool absent)
- OPTIONAL INPUTS:
model – COBRA model structure with the fields * .csense * .C * .d * .dsense * .SIntRxnBool * .c - linear objective coefficients * .A - constraint matrix used in place of .S for a generic LP problem * .rxnNames - reaction descriptions * .metNames - metabolite descriptions * .SConsistentRxnBool - boolean, true for stoichiometrically consistent reactions * .SExtRxnBool - boolean, true for external reactions * .evars - extra variable identifiers * .evarlb - lower bounds on extra variables * .evarub - upper bounds on extra variables * .evarc - objective coefficients on extra variables * .ctrs - additional constraint identifiers
param –
Structure optionally containing the relaxation parameters:
.internalRelax: * 0 = do not allow to relax bounds on internal reactions * 1 = do not allow to relax bounds on internal reactions with finite bounds * {2} = allow to relax bounds on all internal reactions
.exchangeRelax: * 0 = do not allow to relax bounds on exchange reactions * 1 = do not allow to relax bounds on exchange reactions of the type [0,0] * {2} = allow to relax bounds on all exchange reactions
.steadyStateRelax: * 0 = do not allow to relax the steady state constraint S*v = b * {1} = allow to relax the steady state constraint S*v = b
.extraVarRelax: * 0 = do not allow to relax bounds on extra variables * 1 = do not allow to relax bounds on extra variables with finite bounds * {2} = allow to relax bounds on all extra variables
.extraConstraintRelax: * 0 = do not allow to relax extra constraints * {1} = allow to relax extra constraints
.toBeUnblockedReactions - nRxns x 1 vector indicating the reactions to be unblocked * toBeUnblockedReactions(i) = 1 : impose v(i) to be positive * toBeUnblockedReactions(i) = -1 : impose v(i) to be negative * toBeUnblockedReactions(i) = 0 : do not add any constraint (default)
.excludedReactions - nRxns x 1 bool vector indicating the reactions to be excluded from relaxation * excludedReactions(i) = false : allow to relax bounds on reaction i (default) * excludedReactions(i) = true : do not allow to relax bounds on reaction i
.excludedReactionLB - nRxns x 1 bool vector indicating
the reactions with lower bounds to be excluded from relaxation (overridden by excludedReactions)
excludedReactionLB(i) = false : allow to relax lower bounds on reaction i (default)
excludedReactionLB(i) = true : do not allow to relax lower bounds on reaction i
.excludedReactionUB - nRxns x 1 bool vector indicating
- the reactions with upper bounds to be excluded from relaxation (overridden by excludedReactions)
excludedReactionUB(i) = false : allow to relax upper bounds on reaction i (default)
excludedReactionUB(i) = true : do not allow to relax upper bounds on reaction i
.excludedMetabolites - nMets x 1 bool vector indicating the metabolites to be excluded from relaxation * excludedMetabolites(i) = false : allow to relax steady state constraint on metabolite i (default) * excludedMetabolites(i) = true : do not allow to relax steady state constraint on metabolite i
.toBeUnblockedEvars - nEvars x 1 vector indicating the extra variables to be unblocked * toBeUnblockedEvars(i) = 1 : impose vEvar(i) to be positive * toBeUnblockedEvars(i) = -1 : impose vEvar(i) to be negative * toBeUnblockedEvars(i) = 0 : do not add any constraint (default)
.excludedEvars - nEvars x 1 bool vector indicating the extra variables to be excluded from relaxation * excludedEvars(i) = false : allow to relax bounds on extra variable i (default) * excludedEvars(i) = true : do not allow to relax bounds on extra variable i
.excludedEvarLB - nEvars x 1 bool vector indicating
the extra variables with lower bounds to be excluded from relaxation (overridden by excludedEvars)
excludedEvarLB(i) = false : allow to relax lower bounds on extra variablen i (default)
excludedEvarLB(i) = true : do not allow to relax lower bounds on extra variable i
.excludedEvarUB - nEvars x 1 bool vector indicating
- the extra variables with upper bounds to be excluded from relaxation (overridden by excludedEvars)
excludedEvarUB(i) = false : allow to relax upper bounds on extra variable i (default)
excludedEvarUB(i) = true : do not allow to relax upper bounds on extra variable i
.excludedCtrs - nCtrs x 1 bool vector indicating the extra constraints to be excluded from relaxation * excludedCtrs(i) = false : allow to relax steady state constraint on extra constraints i (default) * excludedCtrs(i) = true : do not allow to relax steady state constraint on extra constraints i
.lambda - weighting on relaxation of relaxation on steady state constraints S*v = b
.alpha - weighting on relaxation of reaction bounds
.gamma - weighting on zero norm of fluxes
.alpha0 - zero-norm weight on relaxation of reaction bounds
.alpha1 - one-norm weight on relaxation of reaction bounds
.lambda0 - zero-norm weight on relaxation of steady state constraints
.lambda1 - one-norm weight on relaxation of steady state constraints
.gamma0 - zero-norm weight on the reaction rate
.gamma1 - one-norm weight on the reaction rate
.maxUB - maximum finite upper bound used when relaxing bounds
.minLB - minimum finite lower bound used when relaxing bounds
.nbMaxIteration - stopping criteria - number maximal of iteration (Default value = 100)
.epsilon - stopping criteria - (Default value = 1e-6)
- .theta - initial parameter of the approximation (Default value = 0.5)
Theoretically, the greater the value of step parameter, the better the approximation of a step function. However, practically, a greater inital value, will tend to optimise toward a local minima of the approximate cardinality optimisation problem.
.printLevel (Default = 0) Printing the progress of
the algorithm is useful when trying different values of theta to start with the appropriate parameter giving the lowest cardinality solution. * .relaxedPrintLevel (Default = 0) Printing information on relaxed reaction bounds and steady state constraints * .maxRelaxR (Default = 1e4), maximum relaxation of any bound or equality constraint permitted
- OUTPUT:
solution – Structure containing the following fields:
stat - status
1 = Solution found
0 = Infeasible
-1 = Invalid input
r - relaxation on steady state constraints S*v = b
p - relaxation on lower bound of reactions
q - relaxation on upper bound of reactions
v - reaction rate
vEvar - extra variable value
pEvar - relaxation on lower bound of extra
variables * qEvar - relaxation on upper bound of extra variables * rCtrs - relaxation on steady state of extra constraints
relaxedModel – model structure that admits a flux balance solution
Fleming RMT, Haraldsdottir HS, Le HM, Vuong PT, Hankemeier T, Thiele I. Cardinality optimisation in constraint-based modelling: Application to human metabolism, 2022 (submitted).
April 2026: expanded to deal with extra variables and constraints (model.C,
model.D, model.E) - Tania Barata