# FBA¶

changeObjective(model, rxnNameList, objectiveCoeff)[source]

Changes the objective function of a constraint-based model

Usage

model = changeObjective(model, rxnNameList, objectiveCoeff)

Inputs

• model – COBRA structure
• rxnNameList – List of reactions (cell array or string)

Optional input

• objectiveCoeff – Value of objective coefficient for each reaction (Default = 1)

Output

• model – COBRA model structure with new objective
changeRxnBounds(model, rxnNameList, value, boundType)[source]

Changes upper or lower bounds of a reaction or a set of reactions

Usage

model = changeRxnBounds(model, rxnNameList, value, boundType)

Inputs

• model – COBRA model structure
• rxnNameList – List of reactions (cell array or string)
• value – Bound values. Can either be a vector or a single scalar value if the same bound value is to be assinged to all reactions

Optional input

• boundType – ‘u’ - upper, ‘l’ - lower, ‘b’ - both (Default = ‘b’) Bound type can either be a cell array of strings or a string with as many letters as there are reactions in rxnNameList

Output

• model – COBRA model structure with modified reaction bounds
enumerateOptimalSolutions(model)[source]

Returns a set of optimal flux distributions spanning the optimal set

Usage

[solution] = enumerateOptimalSolution(model)

Input

• model – COBRA model structure

Output

• solution – solution structure
• fluxes - Flux distribution for each iteration
• nonzero - Boolean matrix denoting which fluxes are nonzero for each iteration
minimizeModelFlux(model, osenseStr, minNorm)[source]

This function finds the minimum flux through the network and returns the minimized flux and an irreversible model

Usage

[MinimizedFlux modelIrrev]= minimizeModelFlux(model)

Input

• model – COBRA model structure

Optional inputs

• osenseStr – Maximize (‘max’)/minimize (‘min’) (opt, default = ‘max’)

• minNorm – {(0), ‘one’, ‘zero’, > 0 , n x 1 vector}, where [m,n]=size(S); 0 - Default, normal LP, ‘one’ Minimise the Taxicab Norm using LP.

$\begin{split}min ~&~ |v| \\ s.t. ~&~ S v = b \\ ~&~ c^T v = f \\ ~&~ lb \leq v \leq ub\end{split}$

A LP solver is required. ‘zero’ Minimize the cardinality (zero-norm) of v

$\begin{split}min ~&~ ||v||_0 \\ s.t. ~&~ S v = b \\ ~&~ c^T v = f \\ ~&~ lb \leq v \leq ub\end{split}$

The zero-norm is approximated by a non-convex approximation Six approximations are available: capped-L1 norm, exponential function logarithmic function, SCAD function, L_p norm with p<0, L_p norm with 0<p<1 Note : capped-L1, exponential and logarithmic function often give the best result in term of sparsity.

The remaining options work only with a valid QP solver:

> 0 Minimises the Euclidean Norm of internal fluxes. Typically 1e-6 works well.

$\begin{split}min ~&~ ||v|| \\ s.t. ~&~ S v = b \\ ~&~ c^T v = f \\ ~&~ lb \leq v \leq ub\end{split}$

n x 1 Forms the diagonal of positive definiate matrix F in the quadratic program

$\begin{split}min ~&~ 0.5 v^T F v \\ s.t. ~&~ S v = b \\ ~&~ c^T v = f \\ ~&~ lb \leq v \leq ub\end{split}$

Outputs

• MinimizedFlux – minimum flux possible through the netwok
• modelIrrev – irreversible version of ‘model’
optimizeCbModel(model, osenseStr, minNorm, allowLoops, zeroNormApprox)[source]

Solves a flux balance analysis problem

Solves LP problems of the form

$\begin{split}max/min ~& c^T v \\ s.t. ~& S v = dxdt ~~~~~~~~~~~:y \\ ~& C v \leq d~~~~~~~~:y \\ ~& lb \leq v \leq ub~~~~:w\end{split}$

Usage

solution = optimizeCbModel(model, osenseStr, minNorm, allowLoops, zeroNormApprox)

Input

• model – (the following fields are required - others can be supplied)
• S - m x 1 Stoichiometric matrix
• c - n x 1 Linear objective coefficients
• lb - n x 1 Lower bounds
• ub - n x 1 Upper bounds

Optional inputs

• model

• dxdt - m x 1 change in concentration with time
• csense - m x 1 character array with entries in {L,E,G} (The code is 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 n Right hand side of C*v <= d
• dsense - k x 1 character array with entries in {L,E,G}
• osenseStr – Maximize (‘max’)/minimize (‘min’) (opt, default = ‘max’)

• minNorm – {(0), ‘one’, ‘zero’, > 0 , n x 1 vector}, where [m,n]=size(S); 0 - Default, normal LP ‘one’ Minimise the Taxicab Norm using LP.

$\begin{split}min ~& |v| \\ s.t. ~& S v = dxdt \\ ~& c^T v = f \\ ~& lb \leq v \leq ub\end{split}$

A LP solver is required. ‘zero’ Minimize the cardinality (zero-norm) of v

$\begin{split}min ~& ||v||_0 \\ s.t. ~& S v = dxdt \\ ~& c^T v = f \\ ~& lb \leq v \leq ub\end{split}$

The zero-norm is approximated by a non-convex approximation Six approximations are available: capped-L1 norm, exponential function logarithmic function, SCAD function, L_p norm with p<0, L_p norm with 0<p<1 Note : capped-L1, exponential and logarithmic function often give the best result in term of sparsity.

The remaining options work only with a valid QP solver:

> 0 Minimises the squared Euclidean Norm of internal fluxes. Typically 1e-6 works well.

$\begin{split}min ~& 1/2 v'*v \\ s.t. ~& S v = dxdt \\ ~& c^T v = f \\ ~& lb \leq v \leq ub\end{split}$

n x 1 Forms the diagonal of positive definiate matrix F in the quadratic program

$\begin{split}min ~& 0.5 v^T F v \\ s.t. ~& S v = dxdt \\ ~& c^T v = f \\ ~& lb \leq v \leq ub\end{split}$
• allowLoops – {0,(1)} If false, then instead of a conventional FBA, the solver will run an MILP version which does not allow loops in the final solution. Default is true. Runs much slower when set to false. See addLoopLawConstraints.m to for more info.

• zeroNormApprox – appoximation type of zero-norm (only available when minNorm=’zero’) (default = ‘cappedL1’)

• ‘cappedL1’ : Capped-L1 norm
• ‘exp’ : Exponential function
• ‘log’ : Logarithmic function
• ‘lp-‘ : L_p norm with p<0
• ‘lp+’ : L_p norm with 0<p<1
• ‘all’ : try all approximations and return the best result

Output

• solution – solution object:

• f - Objective value
• v - Reaction rates (Optimal primal variable, legacy FBAsolution.x)
• y - Dual for the metabolites
• w - Reduced costs of the reactions
• s - Slacks of the metabolites
• stat - Solver status in standardized form:
• -1 - No solution reported (timelimit, numerical problem etc)
• 1 - Optimal solution
• 2 - Unbounded solution
• 0 - Infeasible
• origStat - Original status returned by the specific solver

If the input model contains C the following fields are added to the solution:

• ctrs_y - the duals for the constraints from C
• ctrs_slack - Slacks of the additional constraints

If the model contains the E field, the following fields are added to the solution:

• vars_v - The optimal primal values of the variables
• vars_w - The reduced costs of the additional variables from E

Note

solution.stat is either 1, 2, 0 or -1, and is a translation from solution.origStat, which is returned by each solver in a solver specific way. That is, not all solvers return the same type of solution.origStat and because the cobra toolbox can use many solvers, we need to return to the user of optimizeCbModel.m a standard representation, which is what solution.stat is.

When running optimizeCbModel.m, unless solution.stat = 1, then no solution is returned. This means that it is up to the person calling optimizeCbModel to adapt their code to the case when no solution is returned, by checking the value of solution.stat first.

randomObjFBASol(model, initArgs)[source]

Solves an FBA problem with a random objective function

Usage

x0 = randomObjSol(model, initArgs)

Inputs

• model – COBRA model structure
• initArgs – Cell array containing the following data:
1. osenseStr - Maximize (‘max’) / minimize (‘min’)
2. minObjFrac - Minimum initial objective fraction
3. minObjValue - Minimum initial objective value (opt) (Default = minObjFrac*sol.f)

Output

• x0 – solution of FBA problem