eqnlist: Generate eqnlist object

Description Usage Arguments Details Value Examples

View source: R/classes.R

Description

The eqnlist object stores an ODE as a list of stoichiometric matrix, rate expressions, state names and compartment volumes.

Translates a reaction network, e.g. defined by a data.frame, into an equation list object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
eqnlist(
  smatrix = NULL,
  states = colnames(smatrix),
  rates = NULL,
  volumes = NULL,
  description = NULL
)

as.eqnlist(data, volumes)

## S3 method for class 'data.frame'
as.eqnlist(data, volumes = NULL)

is.eqnlist(x)

Arguments

smatrix

Matrix of class numeric. The stoichiometric matrix, one row per reaction/process and one column per state.

states

Character vector. Names of the states.

rates

Character vector. The rate expressions.

volumes

Named character, volume parameters for states. Names must be a subset of the states. Values can be either characters, e.g. "V1", or numeric values for the volume. If volumes is not NULL, missing entries are treated as 1.

description

Character vector. Description of the single processes.

data

data.frame with columns Description, Rate, and one colum for each state reflecting the stoichiometric matrix

x

object of class eqnlist

Details

If data is a data.frame, it must contain columns "Description" (character), "Rate" (character), and one column per ODE state with the state names. The state columns correspond to the stoichiometric matrix.

Value

An object of class eqnlist, basically a list.

Object of class eqnlist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Generate eqnlist from the constructor
S <- matrix(c(-1, 1, 1, -1), 
            nrow = 2, ncol = 2, 
            dimnames = list(NULL, c("A", "B")))

rates <- c("k1*A", "k2*B")
description <- c("forward", "backward")

f <- eqnlist(smatrix = S, rates = rates, description = description)
print(f)

# Convert to data.frame
fdata <- as.data.frame(f)
print(fdata)

# Generate eqnlist from data.frame and add volume parameter
f <- as.eqnlist(fdata, volumes = c(A = "Vcyt", B = "Vnuc"))
print(f)
print(as.eqnvec(f))
print(as.eqnvec(f, type = "amount"))

dMod documentation built on Jan. 27, 2021, 1:07 a.m.