Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sybil
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
general
ccb
sybil
Commits
5b2ab491
Commit
5b2ab491
authored
9 years ago
by
Claus Jonathan Fritzemeier
Browse files
Options
Downloads
Patches
Plain Diff
easyconstraint documentation and implementation
parent
897e307f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
DESCRIPTION
+6
-4
6 additions, 4 deletions
DESCRIPTION
R/sysBiolAlg_fbaEasyConstraintClass.R
+42
-13
42 additions, 13 deletions
R/sysBiolAlg_fbaEasyConstraintClass.R
man/sysBiolAlg_fbaEasyConstraint-class.Rd
+152
-0
152 additions, 0 deletions
man/sysBiolAlg_fbaEasyConstraint-class.Rd
with
200 additions
and
17 deletions
DESCRIPTION
+
6
−
4
View file @
5b2ab491
Package: sybil
Type: Package
Title: Efficient Constrained Based Modelling in R
Version: 1.3.
1
Date: 2015-0
6
-1
7
Version: 1.3.
2
Date: 2015-
1
0-1
9
Authors@R: c(
person(c("C.", "Jonathan"), "Fritzemeier", role = c("cre", "ctb"), email = "clausjonathan.fritzemeier@uni-duesseldorf.de"),
person("Gabriel", "Gelius-Dietrich", role = c("aut")),
...
...
@@ -48,9 +48,11 @@ Collate: generics.R validmodelorg.R validoptsol.R validreactId.R
optsol_optimizeProbClass.R optsol_fluxVarClass.R
optsol_fluxdelClass.R optsol_robAnaClass.R optsol_phppClass.R
optsol_genedelClass.R checksolClass.R summaryOptsolClass.R
sysBiolAlgClass.R sysBiolAlg_fbaClass.R sysBiolAlg_fvClass.R
sysBiolAlgClass.R sysBiolAlg_fbaClass.R
sysBiolAlg_fbaEasyConstraintClass.R sysBiolAlg_fvClass.R
sysBiolAlg_lmomaClass.R sysBiolAlg_momaClass.R
sysBiolAlg_mtfClass.R sysBiolAlg_roomClass.R sybilLogClass.R
sysBiolAlg_mtfClass.R sysBiolAlg_mtfEasyConstraintClass.R
sysBiolAlg_roomClass.R sybilLogClass.R
Packaged: 2014-11-19 20:39:37 UTC; gabriel
Author: C. Jonathan Fritzemeier [cre, ctb],
Gabriel Gelius-Dietrich [aut],
...
...
This diff is collapsed.
Click to expand it.
R/sysBiolAlg_fbaEasyConstraintClass.R
+
42
−
13
View file @
5b2ab491
...
...
@@ -100,28 +100,57 @@ setMethod(f = "initialize",
mat
<-
S
(
model
)
rtype
<-
rep
(
"E"
,
nRows
)
rlb
<-
rep
(
0
,
nRows
)
rub
<-
rep
(
0
,
nRows
)
#add easyConstraints:
if
(
!
is.null
(
easyConstraint
)){
if
(
length
(
easyConstraint
$
nz
)
==
length
(
easyConstraint
$
x
)
|
length
(
easyConstraint
$
nz
)
==
length
(
easyConstraint
$
rtype
)){
if
(
length
(
easyConstraint
$
react
)
!=
length
(
easyConstraint
$
x
)
|
length
(
easyConstraint
$
react
)
!=
length
(
easyConstraint
$
rtype
)
){
stop
(
"easyConstraint elements have to have equal lengths"
)
}
stopifnot
(
is.list
(
easyConstraints
$
nz
))
stopifnot
(
is.list
(
easyConstraints
$
x
))
stopifnot
(
all
(
easyConstraints
$
rtype
%in%
c
(
"F"
,
"L"
,
"U"
,
"D"
,
"E"
)))
stopifnot
(
is.list
(
easyConstraint
$
react
))
stopifnot
(
is.list
(
easyConstraint
$
x
))
stopifnot
(
all
(
easyConstraint
$
rtype
%in%
c
(
"F"
,
"L"
,
"U"
,
"D"
,
"E"
)))
# setting and checking rlb
if
(
is.null
(
easyConstraint
$
lb
)){
rlb
<-
c
(
rlb
,
rep
(
0
,
length
(
easyConstraint
$
react
)))
}
else
{
if
(
length
(
easyConstraint
$
react
)
!=
length
(
easyConstraint
$
lb
)){
stop
(
"easyConstraint$lb length has to match length of react argument"
)
}
else
{
stopifnot
(
is.numeric
(
easyConstraint
$
lb
))
rlb
<-
c
(
rlb
,
easyConstraint
$
lb
)
}
}
# setting and checking rub
if
(
is.null
(
easyConstraint
$
ub
)){
rub
<-
c
(
rub
,
rep
(
0
,
length
(
easyConstraint
$
react
)))
}
else
{
if
(
length
(
easyConstraint
$
react
)
!=
length
(
easyConstraint
$
ub
)){
stop
(
"easyConstraint$ub length has to match length of react argument"
)
}
else
{
stopifnot
(
is.numeric
(
easyConstraint
$
ub
))
rub
<-
c
(
rub
,
easyConstraint
$
ub
)
}
}
browser
()
m
<-
Matrix
(
0
,
ncol
=
nCols
,
nrow
=
length
(
easyConstraint
))
m
<-
Matrix
(
0
,
ncol
=
nCols
,
nrow
=
length
(
easyConstraint
$
react
))
for
(
i
in
1
:
length
(
easyConstraint
)){
m
[
i
,
easyConstraint
$
nz
]
<-
easyConstraint
$
x
for
(
i
in
1
:
length
(
easyConstraint
$
react
)){
m
[
i
,
easyConstraint
$
react
[[
i
]]
]
<-
easyConstraint
$
x
[[
i
]]
}
mat
<-
rbind2
(
mat
,
m
)
rtype
<-
c
(
rtype
,
easyConstraint
$
rtype
)
nRow
<-
nRow
+
length
(
easyConstraint
)
nRow
s
<-
nRow
s
+
length
(
easyConstraint
$
react
)
if
(
!
is.null
(
rowNames
)){
c
(
rowNames
,
paste0
(
"easyConstraint"
,
1
:
length
(
easyConstraint
)))
c
(
rowNames
,
paste0
(
"easyConstraint"
,
1
:
length
(
easyConstraint
$
react
)))
}
}
...
...
@@ -138,10 +167,10 @@ setMethod(f = "initialize",
ub
=
uppbnd
(
model
),
lb
=
lowbnd
(
model
),
obj
=
obj_coef
(
model
),
rlb
=
r
ep
(
0
,
nRows
)
,
rlb
=
r
lb
,
rtype
=
rtype
,
lpdir
=
lpdir
,
rub
=
NULL
,
rub
=
rub
,
ctype
=
NULL
,
cnames
=
colNames
,
rnames
=
rowNames
,
...
...
This diff is collapsed.
Click to expand it.
man/sysBiolAlg_fbaEasyConstraint-class.Rd
0 → 100644
+
152
−
0
View file @
5b2ab491
\name{sysBiolAlg_fba-class}
\Rdversion{1.1}
\encoding{utf8}
\docType{class}
\alias{sysBiolAlg_fbaEasyConstraint-class}
\alias{sysBiolAlg_fbaEasyConstraint}
\alias{sysBiolAlg_mtfEasyConstraint-class}
\alias{sysBiolAlg_mtfEasyConstraint}
\alias{mtfEasyConstraint}
\alias{fbaEasyConstraint}
\title{Class \code{"sysBiolAlg_fbaEasyConstraint"} and \code{"sysBiolAlg_mtfEasyConstraint"}}
\description{
The classes \code{sysBiolAlg_fbaEasyConstraint} \code{sysBiolAlg_mtfEasyConstraint} hold an object of class
\code{\linkS4class{optObj}} which is generated to meet the
requirements of the FBA/MTF algorithm. \cr
In Addition to this, it is very easy to add
additional linear constraints to that linear problem. Each constraints is
defined by the affected reaction, the coefficient, lower and upper bounds, and
the constraint type.
}
\section{Objects from the Class}{
Objects can be created by calls of the form
\code{sysBiolAlg(model, algorithm = "fba", ...)}.
Arguments to \code{...} which are passed to method \code{initialize} of class
\code{sysBiolAlg_fba} are described in the Details section.
}
\section{Slots}{
\describe{
Slots are the same as in the original MTF/FBA classes.
In addition, this slot is implemented:
\item{\code{easyConstraint}:}{
List holding the information for the constraints (see details):
\itemize{
\item{\code{react}}{
List of numeric vectors. Values indicate, to which reaction the
constraint applys.
}
\item{\code{x}}{
List of numeric vectors. Values indicate coefficients of the
constraint. Lengths have to be equal to \code{react}-field.
}
\item{\code{lb}}{
Numeric vector of lower bounds for constraints. If not given, a
default bound of 0 will be used.
}
\item{\code{ub}}{
Numeric vector of lower bounds for constraints. If not given, a
default bound of 0 will be used. Only needed for constraints,
that need two bounds.
}
\item{\code{rtype}}{
Character vector defining the type of constraint.
\tabular{lll}{
\code{"F"}: \tab free constraint (GLPK only) \tab \eqn{-\infty < x < \infty}{-INF < x < INF} \cr
\code{"L"}: \tab constraint with lower bound \tab \eqn{\mathrm{lb} \leq x < \infty}{lb <= x < INF} \cr
\code{"U"}: \tab constraint with upper bound \tab \eqn{-\infty < x \leq \mathrm{ub}}{-INF < x <= ub} \cr
\code{"D"}: \tab double-bounded (ranged) constraint \tab \eqn{\mathrm{lb} \leq x \leq \mathrm{ub}}{lb <= x <= ub} \cr
\code{"E"}: \tab fixed (equality) constraint \tab \eqn{\mathrm{lb} = x = \mathrm{ub}}{lb = x = ub} \cr
}
If \code{rtype[i]} is not one of \code{"F"}, \code{"L"}, \code{"U"},
\code{"D"} or \code{"E"}, the value of \code{rtype[i]} will be set to
\code{"E"}. See Details of \code{\link{loadLPprob}}.
}
}
}
}
}
\section{Extends}{
Class \code{"\linkS4class{sysBiolAlg}"}, directly.
}
\section{Methods}{
No methods defined with class "sysBiolAlg_fbaEasyConstraint" in the signature.
}
\details{
The problem object is built to be capable to perform flux balance analysis
(FBA) with a given model, which is basically the solution of a linear
programming problem
\deqn{%
\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}%
}{
max c^T v
s.t. Sv = 0
a_i <= v_i <= b_i for i = 1, ..., n
}
with \eqn{\bold{S}}{S} being the stoichiometric matrix, \eqn{\alpha_i}{a_i}
and \eqn{\beta_i}{b_i} being the lower and upper bounds for flux (variable)
\eqn{i} respectively. The total number of variables of the optimization
problem is denoted by \eqn{n}. The solution of the optimization is a flux
distribution maximizing the objective function
\eqn{
\mbox{\boldmath$c$\unboldmath}^{\mathrm{T}}
\mbox{\boldmath$v$\unboldmath}
}{c^T v} under the a given environment and the assumption of steady state.
The optimization can be executed by using \code{\link{optimizeProb}}.
The additional i-th EasyConstraint will be added as follows to the problem: \emph{to be checked.}
\deqn{
\begin{array}{l}%
\code{lb} <= v_\code{react\[\[i\]\]} * (x_i)^T <= \code{ub}
\end{array}%
}{
\code{lb} <= v_{\code{react\[\[i\]\]}} * (x_i)^T <= \code{ub}
}
}
\references{
Edwards, J. S., Covert, M and Palsson, B. Ø. (2002) Metabolic modelling of
microbes: the flux-balance approach. \emph{Environ Microbiol} \bold{4},
133--140.
Edwards, J. S., Ibarra, R. U. and Palsson, B. Ø. (2001) In silico predictions
of \emph{Escherichia coli} metabolic capabilities are consistent with
experimental data. \emph{Nat Biotechnol} \bold{19}, 125--130.
}
\author{
Claus Jonathan Fritzemeier <clausjonathan.fritzemeier@uni-duesseldorf.de>
}
\seealso{
Constructor function \code{\link{sysBiolAlg}} and
superclass \code{\linkS4class{sysBiolAlg}}.
}
\examples{
showClass("sysBiolAlg_fba")
}
\keyword{classes}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment