Learn R Programming

sybil (version 1.1.2)

simpleFBA: Flux Balance Analysis with a Given Model

Description

Finds an optimal flux distribution and optimal value for the objective function for a model.

Usage

simpleFBA(model, react = NA, lb = NA, ub = NA, gene = NA,
            lpdir = SYBIL_SETTINGS("OPT_DIRECTION"),
            minTotalFlux = FALSE, minDist = FALSE, wtFluxes = NA,
            solver = SYBIL_SETTINGS("SOLVER"),
            method = SYBIL_SETTINGS("METHOD"),
            fld = FALSE, retOptSol = FALSE,
            prCmd = NA, poCmd = NA, prCil = NA, poCil = NA, ...)

Arguments

model
An object of class modelorg or of class optObj.
react
An object of class reactId, character or integer. Specifies the fluxes (variables) for which to change the upper and lower bound (see also arguments lb and ub). Default: NA
lb
Numeric vector, must have the same length as react. Contains the new values for the lower bounds of fluxes (variables) mentioned in react. If set to NA, lower bounds for variables in react will
ub
Same functionality as lb, but for upper bounds. Default: NA.
gene
A character or integer vector containing gene id's or indices of gene id's in allGenes(model). If arguments lb and/or ub are additionally used (not NA), upper
lpdir
Character value, direction of optimization. Can be set to "min" or "max". This parameter is used only if argument model is of class modelorg. Default: SYBIL_SETT
minTotalFlux
Boolean, find a flux distribution with minimal total flux leading to an optimal value for the objective function (see Details below). Default: FALSE.
minDist
Boolean, find a flux distribution with a minimal manhattan distance to a given flux (see Details below). Default: FALSE.
wtFluxes
A single numeric value, or a numeric vector of length equal to the number of fluxes (variables) in the model (see Details below). Default: NA.
solver
Single character value. The solver to use. See SYBIL_SETTINGS for possible values. This parameter is used only if argument model is of class modelorg
method
Single character value. The optimization algorithm to use. Possible values depend on the setting in solver. See SYBIL_SETTINGS for possible values. This parameter is used only
fld
Boolean. Save the resulting flux distribution. Default: FALSE.
retOptSol
Boolean. Return an object of class optsol_optimizeProb or just a list containing the results. Default: FALSE.
prCmd
A list of preprocessing commands. See Details below. Default: NA.
poCmd
A list of postprocessing commands. See Details below. Default: NA.
prCil
Can be used if simpleFBA is called several times (like in optimizer). The argument prCil gets the value of the loop variable and passes it to the preprocessing function.
poCil
Same as prCil, but for postprocessing. Default: NA.
...
Further arguments passed to prepProbObj. Argument solverParm is a good candidate.

Value

  • SimpleFBA returns either an object of class optsol_optimizeProb if argument retOptSol is set to TRUE, or simply a list containing the results of the optimization:
  • okReturn value of the optimizer (e.g. solution process was successful or time limit exceeded).
  • statStatus value of the optimization (e.g. solution is optimal or no feasible solution exists).
  • fluxesThe resulting flux distribution.
  • prePAn object of class ppProc if a preprocessing command was given.
  • postPAn object of class ppProc if a postprocessing command was given.

encoding

utf8

Details

The function simpleFBA performs a flux balance analysis (FBA) with a given model, which is basically the solution of a linear programming problem $$\begin{array}{rll} \max & \mbox{\boldmath$c$\unboldmath}^{\mathrm{T}} \mbox{\boldmath$v$\unboldmath} \[1ex] \mathrm{s.\,t.} & \mbox{\boldmath$Sv$\unboldmath} = 0 \[1ex] & \alpha_i \leq v_i \leq \beta_i & \quad \forall i \in {1, \ldots, n} \[1ex] \end{array}$$ with $\bold{S}$ beeing the stoichiometric matrix, $\alpha_i$ and $\beta_i$ beeing the lower and upper bounds for flux (variable) $i$. The total number of variables of the optimization problem is denoted by $n$. The solution of the optimization is a flux distribution maximizing the objective function $\mbox{\boldmath$c$\unboldmath}^{\mathrm{T}} \mbox{\boldmath$v$\unboldmath}$ under the a given environment and the assumption of steady state. The result of the optimization is returned as list or object of class optsol_optimizeProb containing the optimal value of the objective function and return and status values returned by the solver. When the argument minTotalFlux is set to TRUE, a second optimization will be performed in order to minimize the sum of the absolute values of the fluxes $$\begin{array}{rll} \min & \begin{minipage}[b]{2.5em} \[ \sum_{i=1}^n v_i \] \end{minipage} \[2em] \mathrm{s.\,t.} & \mbox{\boldmath$Sv$\unboldmath} = 0 \[1ex] & \alpha_i \leq v_i \leq \beta_i & \quad \forall i \in {1, \ldots, n} \[1ex] & \mbox{\boldmath$c$\unboldmath}_{\mathrm{wt}} \geq \mbox{\boldmath$c$\unboldmath}^{\mathrm{T}} \mbox{\boldmath$v$\unboldmath}_{\mathrm{wt}} \[1ex] \end{array}$$ with $\mbox{\boldmath$c$\unboldmath}^{\mathrm{T}} \mbox{\boldmath$v$\unboldmath}_{\mathrm{wt}}$ beeing the optimized value of the objective function of the first optimization (wild type solution). The argument wtFluxes can be used to set a value for a wild type objective function. In that case, only one optimization will be performed. If wtFluxes is NA, a value for the wild type will be calculated via FBA. When the argument minDist is set to TRUE, a flux distribution leading to an optimal solution as close as possible to a wild type solution will be calculated $$\begin{array}{rll} \min & \begin{minipage}[b]{5em} \[ \sum_{i,j=1}^n \bigl|v_{j,\mathrm{del}} - v_{i,\mathrm{wt}}\bigr| \] \end{minipage} \[2em] \mathrm{s.\,t.} & \mbox{\boldmath$Sv$\unboldmath}_{\mathrm{del}} = 0 \[1ex] & v_i = v_{i,\mathrm{wt}} & \quad \forall i \in {1, \ldots, n} \[1ex] & \alpha_j \leq v_{j,\mathrm{del}} \leq \beta_j & \quad \forall j \in {1, \ldots, n} \[1ex] \end{array}$$ Here, $\mbox{\boldmath$v$\unboldmath}^{\mathrm{wt}}$ is the wild type flux distribution. This can be set via the argument wtFluxes. If wtFluxes is NA (the default), the wild type flux distribution will be calculated by FBA. If we need to calculate a wild type flux distribution and the argument react is not NA, react will only be applied to the second optimization.

The arguments prCmd and poCmd can be used to execute Rcommands working on the problem object. All commands in prCmd are executed immediately before solving the problem; all commands in poCmd are executed after the problem has been solved. In all other aspects, the arguments work the same. The value of prCmd or poCmd are lists of character vectors (each list element is one command). Each command is a character vector and should be built as follows:

  • The first element is the name of the function to call.
  • All other elements are arguments to the function named in the first element.
  • If any argument is character, enclose it in single quotes' '.
  • Use the keywordLP_PROBin order to refer to the variable name of the problem object (object of classoptObj).
  • If the length of the character vector is one, it is treated as a function call with the problem object (object of classoptObj) as single argument.
The result will be an object of class ppProc. A few examples for arguments prCmd or poCmd (all arguments must be lists, see examples section below): sensitivityAnalysis will be translated to the command sensitivityAnalysis(LP_PROB) with LP_PROB beeing the placeholder for the variable name of the problem object. The vector c("writeProb", "LP_PROB", "'lp'", "'Ec_core.lp'") will be translated to the command writeProb(LP_PROB, 'lp', 'Ec_core.lp') The first element will be the function name and the others the arguments to that function. The list of commands list("sensitivityAnalysis", c("getDjCPLEX", "LP_PROB@oobj$env", "LP_PROB@oobj$lp", "0", "react_num(Ec_core)-1" ) ) will be translated to the commands sensitivityAnalysis(LP_PROB) getDjCPLEX(LP_PROB@oobj$env, LP_PROB@oobj$lp, 0, react_num(Ec_core)-1) For more information on the usage of prCmd and poCmd, see the examples section below.

The paramters solver, method and lpdir are only used if argument model is of class modelorg. If model is of class optObj, a previous call to prepProbObj to generate an object of class optObj is assumed. This object already knows about this parameters.

References

Edwards, J. S., Covert, M and Palsson, B. Ø. (2002) Metabolic modelling of microbes: the flux-balance approach. Environ Microbiol 4, 133--140. Edwards, J. S., Ibarra, R. U. and Palsson, B. Ø. (2001) In silico predictions of Escherichia coli metabolic capabilities are consistent with experimental data. Nat Biotechnol 19, 125--130.

See Also

modelorg, optsol_optimizeProb, prepProbObj, checkReactId, SYBIL_SETTINGS and ppProc.

Examples

Run this code
## The examples here require the package glpkAPI to be
## installed. If that package is not available, you have to set
## the argument 'solver' (the default is: solver = "glpkAPI").

## load the example data set
data(Ec_core)

## run simpleFBA(), Ec_sf will be a list
Ec_sf <- simpleFBA(Ec_core)

## run simpleFBA(), Ec_sf will be an object of
## class optsol_optimizeProb
Ec_sf <- simpleFBA(Ec_core, retOptSol = TRUE)

## do FBA, change the upper and lower bounds for the reactions
## "ATPM" and "PFK". Return also the resulting flux distribution
simpleFBA(Ec_core, react = c("ATPM", "PFK"),
          lb = c(3, -3), ub = c(5, 6), fld = TRUE)
          
## do FBA, perform s sensitivity analysis after optimization
simpleFBA(Ec_core, poCmd = list("sensitivityAnalysis"))

## do FBA, write the problem object to file in lp-format
simpleFBA(Ec_core, poCmd = list(c("writeProb", "LP_PROB",
                                  "'lp'", "'Ec_core.lp'"))
)

## do FBA, use "cplexAPI" as lp solver. Get all upper bounds before
## solving the problem. After solving, perform a sensitivity
## analysis and retrieve the reduced costs
simpleFBA(Ec_core, solver = "cplexAPI",
               prCmd = list(c("getColsUppBnds", "LP_PROB", "1:77")),
               poCmd = list("sensitivityAnalysis",
                            c("getDjCPLEX",
                              "LP_PROB@oobj@env",
                              "LP_PROB@oobj@lp",
                              "0", "react_num(Ec_core)-1"
                            )
                       )
)

Run the code above in your browser using DataLab