scrnn returns a closure around gsl_odeiv2_CRNN()
scrnn.Rdthe returned value is a function of a variable p that encodes the CRNN in some way. Three user supplied functions are used to extract the three components of a CRNN:
Usage
scrnn(
experiments,
modelName,
parMap = function(p) p$l,
stoichiometry = function(p) p$nu,
modifiers = function(p) p$m,
method = 0
)Arguments
- experiments
list of experiments (inputs are ignored).
- modelName
scalar string, can indicate a shared library with an attached comment attribute.
- parMap
(function) extracts kinetic rate coefficients from its argument.
- stoichiometry
(function) extracts the stoichiometry matrix from its argument.
- modifiers
(function) extracts the modifier matrix from its argument.
- method
(integer) integration method key (0:10) corresponds to these GSL methods: msbdf, msadams, bsimp, rk4imp, rk2imp, rk1imp, rk8pd, rkck, rkf45, rk4, rk2
Details
kinetic rate coefficients (in log-space):
l <- parMap(p)stoichiometric matrix:
nu <- stoichiometry(p)modifier matrix:
m <- modifiers(p)
these three components (one numeric vector, and two matrices) are passed to the simulation procedure. The vector l can be a matrix with M columns. In that case, one simulation per column is performed. The stoichiometry and modifiers remain unchanged throughout.
Examples
# \donttest{
f <- uqsa_example("AKAR4")
m <- model_from_tsv(f)
ex <- experiments(m,as_ode(m,cla=FALSE))
nu <- stoichiometric_matrix(m)
l <- matrix(c(log(values(m$Parameter)),0),2,2,dimnames=list(rownames(m$Reaction),c("fwd","bwd")))
C <- CRNN(NCOL(nu),initialValues=values(m$Compound),funcValues=formulae(m$Output))
c.file <- tempfile("AKAR4_CRNN_",fileext=".c")
cat(C,file=c.file,sep='\n')
modelName <- "AKAR4"
comment(modelName) <- shlib(c.file,model.name="AKAR4")
#> Error in shlib(c.file, model.name = "AKAR4"): unused argument (model.name = "AKAR4")
s <- scrnn(ex, modelName)
p <- list(l=l,nu=nu,m=nu*0)
y <- s(p)
#> looking for ./AKAR4.so
#> Warning: [gsl_odeiv2_CRNN] for model name «AKAR4», file «./AKAR4.so» not found.
#> Error in gsl_odeiv2_CRNN(modelName, experiments, l, nu, m, method = 0): [dlopen] ./AKAR4.so: cannot open shared object file: No such file or directory.
# }