addReaction: Add reaction to reaction table

Description Usage Arguments Value Examples

View source: R/eqnClass.R

Description

Add reaction to reaction table

Usage

1
addReaction(eqnlist, from, to, rate, description = names(rate))

Arguments

eqnlist

equation list, see eqnlist

from

character with the left hand side of the reaction, e.g. "2*A + B"

to

character with the right hand side of the reaction, e.g. "C + 2*D"

rate

character. The rate associated with the reaction. The name is employed as a description of the reaction.

description

Optional description instead of names(rate).

Value

An 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
f <- eqnlist()
f <- addReaction(f, "2*A+B", "C + 2*D", "k1*B*A^2")
f <- addReaction(f, "C + A", "B + A", "k2*C*A")



  # Write your example here. You can also add more Start..End blocks if needed.
  # Please mask all output such as print() with the special tag
  #    
  # such that the test is not littered. Statements guarded by  are enabled
  # in the example file which is extracted from this test file. To extract the
  # example run
  #    extractExamples()
  # on the R command line.
    
    ## Generate another equation list
    eq <- eqnlist()
    eq <- addReaction(eq, "A", "pA", "act_A * A * stimulus", "Phosphorylation of A")
    eq <- addReaction(eq, "pA", "A", "deact_A * pA", "Deposphorylation of pA")
    eq <- addReaction(eq, "2*pA", "pA_pA", "form_complex_pA * pA^2", "Complex formation of pA")
    eq <- addReaction(eq, "B", "pB", "act_B * B * pA_pA", "Phosphorylation of B")
    eq <- addReaction(eq, "pB", "B", "deact_B * pB", "Deposphorylation of pB")
    
    ## Extract data.frame of reactions
    reactions <- getReactions(eq)
     print(reactions)
    
    ## Get conserved quantities
    cq <- conservedQuantities(eq$smatrix)
     print(cq)
    
    ## Get fluxes
    fluxes <- getFluxes(eq)
     print(fluxes)
    
    ## Subsetting of equation list
    subeq1 <- subset(eq, "pB" %in% Product)
     print(subeq1)
    subeq2 <- subset(eq, grepl("not_available", Description))
     print(subeq2)
    
    ## Time derivatives of observables
    observables <- eqnvec(pA_obs = "s1*pA", tA_obs = "s2*(A + pA)")
    dobs <- dot(observables, eq)
    
    ## Combined equation vector for ODE and observables
    f <- c(as.eqnvec(eq), dobs)
     print(f)
    
    
  

Example output

Loading required package: cOde

Attaching package:dModThe following object is masked frompackage:stats:

    profile

  Check Educt -> Product                   Rate             Description
1           A ->      pA   act_A * A * stimulus    Phosphorylation of A
2          pA ->       A           deact_A * pA  Deposphorylation of pA
3        2*pA ->   pA_pA form_complex_pA * pA^2 Complex formation of pA
4           B ->      pB      act_B * B * pA_pA    Phosphorylation of B
5          pB ->       B           deact_B * pB  Deposphorylation of pB
  Conserved quantities: 2
1    0.5*A+0.5*pA+1*pA_pA
2                1*B+1*pB
$A
       Phosphorylation of A      Deposphorylation of pA 
"-1*(act_A * A * stimulus)"         "+1*(deact_A * pA)" 

$pA
         Phosphorylation of A        Deposphorylation of pA 
   "1*(act_A * A * stimulus)"           "-1*(deact_A * pA)" 
      Complex formation of pA 
"-2*(form_complex_pA * pA^2)" 

$pA_pA
     Complex formation of pA 
"1*(form_complex_pA * pA^2)" 

$B
    Phosphorylation of B   Deposphorylation of pB 
"-1*(act_B * B * pA_pA)"      "+1*(deact_B * pB)" 

$pB
   Phosphorylation of B  Deposphorylation of pB 
"1*(act_B * B * pA_pA)"     "-1*(deact_B * pB)" 

  Conserved quantities: 1
1                1*B+1*pB

  Check Educt -> Product              Rate          Description
1           B ->      pB act_B * B * pA_pA Phosphorylation of B
NULL
Idx  Inner <- Outer
  1      A <- -1*(act_A*A*stimulus)+1*(deact_A*pA)
  4      B <- -1*(act_B*B*pA_pA)+1*(deact_B*pB)
  2     pA <- 1*(act_A*A*stimulus)-1*(deact_A*pA)-2*(form_complex_pA*pA^2)
  6 pA_obs <- (s1)*(1*(act_A*A*stimulus)-1*(deact_A*pA)-2*(form_complex_pA*pA^2))
  3  pA_pA <- 1*(form_complex_pA*pA^2)
  5     pB <- 1*(act_B*B*pA_pA)-1*(deact_B*pB)
  7 tA_obs <- (s2)*(1*(act_A*A*stimulus)-1*(deact_A*pA)-2*(form_complex_pA*pA^2))+(s2)*(-1*(act_A*A*stimulus)+1*(deact_A*pA))

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