Macaulay2 » Documentation
Packages » ReactionNetworks :: reactionNetwork
next | previous | forward | backward | up | index | toc

reactionNetwork -- creates a reaction network

Synopsis

Description

Create a reaction network from a string.

i1 : N = reactionNetwork "A <--> 2B, A + C <--> D, B + E --> A + C, D --> B+E"

o1 = A-->2B
     2B-->A
     A+C-->D
     D-->A+C
     D-->B+E
     B+E-->A+C

o1 : ReactionNetwork

Create a reaction network from a list.

i2 : N = reactionNetwork {"S_0+E <--> X_1", "X_1 --> S_1+E",
                          "S_1+E <--> X_2", "X_2 --> S_2+E",
                          "S_1+F <--> Y_1", "Y_1 --> S_0+F",
                          "S_2+F <--> Y_2", "Y_2 --> S_1+F"}

o2 = S_0+E-->X_1
     X_1-->S_0+E
     X_1-->E+S_1
     E+S_1-->X_2
     X_2-->E+S_1
     X_2-->E+S_2
     S_1+F-->Y_1
     Y_1-->S_1+F
     Y_1-->S_0+F
     S_2+F-->Y_2
     Y_2-->S_1+F
     Y_2-->S_2+F

o2 : ReactionNetwork

Create a reaction network including the empty set.

i3 : N = reactionNetwork ({"A --> 0", "0 --> A"}, NullSymbol => "0")

o3 = A-->0
     0-->A

o3 : ReactionNetwork

The user may view specific information stored in the reaction network, such as species, complexes, etc.

i4 : N = reactionNetwork "A <--> 2B, A + C <--> D, B + E --> A + C, D --> B+E"

o4 = A-->2B
     2B-->A
     A+C-->D
     D-->A+C
     D-->B+E
     B+E-->A+C

o4 : ReactionNetwork
i5 : N.Species

o5 = {A, B, C, D, E}

o5 : List
i6 : N.Complexes

o6 = {| 1 0 0 0 0 |, | 0 2 0 0 0 |, | 1 0 1 0 0 |, | 0 0 0 1 0 |, | 0 1 0 0 1
     ------------------------------------------------------------------------
     |}

o6 : List
i7 : N.ReactionGraph

o7 = Digraph{0 => {1}   }
             1 => {0}
             2 => {3}
             3 => {2, 4}
             4 => {2}

o7 : Digraph

Or the user may view all stored information about a reaction network:

i8 : N = reactionNetwork "A <--> 2B, A + C <--> D, B + E --> A + C, D --> B + E"

o8 = A-->2B
     2B-->A
     A+C-->D
     D-->A+C
     D-->B+E
     B+E-->A+C

o8 : ReactionNetwork
i9 : peek N

o9 = ReactionNetwork{Complexes => {| 1 0 0 0 0 |, | 0 2 0 0 0 |, | 1 0 1 0 0 |, | 0 0 0 1 0 |, | 0 1 0 0 1 |}}
                     ConcentrationRates => null
                     InitialValues => null
                     NullIndex => -1
                     NullSymbol => 
                     ReactionGraph => Digraph{0 => {1}   }
                                              1 => {0}
                                              2 => {3}
                                              3 => {2, 4}
                                              4 => {2}
                     ReactionRates => null
                     ReactionRing => null
                     Species => {A, B, C, D, E}

Create a reaction network from a negative Laplacian matrix (or adjacency matrix) and the complexes.

i10 : L = matrix{{-1,1,0,0,0},{1,-1,0,0,0},{0,0,-1,1,0},{0,0,1,-2,1},{0,0,1,0,-1}}

o10 = | -1 1  0  0  0  |
      | 1  -1 0  0  0  |
      | 0  0  -1 1  0  |
      | 0  0  1  -2 1  |
      | 0  0  1  0  -1 |

               5       5
o10 : Matrix ZZ  <-- ZZ
i11 : Comp = transpose matrix{{1,0,0,0,0},{0,2,0,0,0},{1,0,1,0,0},{0,0,0,1,0},{0,1,0,0,1}}

o11 = | 1 0 1 0 0 |
      | 0 2 0 0 1 |
      | 0 0 1 0 0 |
      | 0 0 0 1 0 |
      | 0 0 0 0 1 |

               5       5
o11 : Matrix ZZ  <-- ZZ
i12 : N = reactionNetwork({Comp,L},Input=>"Laplacian")

o12 = X_1-->2X_2
      2X_2-->X_1
      X_1+X_3-->X_4
      X_4-->X_1+X_3
      X_4-->X_2+X_5
      X_2+X_5-->X_1+X_3

o12 : ReactionNetwork
i13 : peek N

o13 = ReactionNetwork{Complexes => {| 1 0 0 0 0 |, | 0 2 0 0 0 |, | 1 0 1 0 0 |, | 0 0 0 1 0 |, | 0 1 0 0 1 |}}
                      ConcentrationRates => null
                      InitialValues => null
                      NullIndex => -1
                      NullSymbol => 
                      ReactionGraph => Digraph{0 => {1}   }
                                               1 => {0}
                                               2 => {3}
                                               3 => {2, 4}
                                               4 => {2}
                      ReactionRates => null
                      ReactionRing => null
                      Species => {X_1, X_2, X_3, X_4, X_5}

The input can also be a weighted negative Laplacian matrix (or weighted adjacency matrix) and the complexes.

i14 : R = QQ[k_1..k_6,x_1..x_5]

o14 = R

o14 : PolynomialRing
i15 : A = matrix{{-k_1,k_1,0,0,0},{k_2,-k_2,0,0,0},{0,0,-k_3,k_3,0},{0,0,k_4,-k_4-k_5,k_5},{0,0,k_6,0,-k_6}}

o15 = | -k_1 k_1  0    0        0    |
      | k_2  -k_2 0    0        0    |
      | 0    0    -k_3 k_3      0    |
      | 0    0    k_4  -k_4-k_5 k_5  |
      | 0    0    k_6  0        -k_6 |

              5      5
o15 : Matrix R  <-- R
i16 : Comp = transpose matrix{{1,0,0,0,0},{0,2,0,0,0},{1,0,1,0,0},{0,0,0,1,0},{0,1,0,0,1}}

o16 = | 1 0 1 0 0 |
      | 0 2 0 0 1 |
      | 0 0 1 0 0 |
      | 0 0 0 1 0 |
      | 0 0 0 0 1 |

               5       5
o16 : Matrix ZZ  <-- ZZ
i17 : N = reactionNetwork({Comp,A},Input=>"Laplacian")

o17 = X_1-->2X_2
      2X_2-->X_1
      X_1+X_3-->X_4
      X_4-->X_1+X_3
      X_4-->X_2+X_5
      X_2+X_5-->X_1+X_3

o17 : ReactionNetwork
i18 : peek N

o18 = ReactionNetwork{Complexes => {| 1 0 0 0 0 |, | 0 2 0 0 0 |, | 1 0 1 0 0 |, | 0 0 0 1 0 |, | 0 1 0 0 1 |}}
                      ConcentrationRates => null
                      InitialValues => null
                      NullIndex => -1
                      NullSymbol => 
                      ReactionGraph => Digraph{0 => {1}   }
                                               1 => {0}
                                               2 => {3}
                                               3 => {2, 4}
                                               4 => {2}
                      ReactionRates => null
                      ReactionRing => null
                      Species => {X_1, X_2, X_3, X_4, X_5}

Create a reaction network from a stoichiometric matrix and a flux vector.

i19 : R = QQ[k_1..k_6,x_1..x_5]

o19 = R

o19 : PolynomialRing
i20 : StoichM = matrix{{-1,1,-1,1,0,1},{2,-2,0,0,1,-1},{0,0,-1,1,0,1},{0,0,1,-1,-1,0},{0,0,0,0,1,-1}}

o20 = | -1 1  -1 1  0  1  |
      | 2  -2 0  0  1  -1 |
      | 0  0  -1 1  0  1  |
      | 0  0  1  -1 -1 0  |
      | 0  0  0  0  1  -1 |

               5       6
o20 : Matrix ZZ  <-- ZZ
i21 : FluxV = transpose matrix{{k_1*x_1,k_2*x_2^2,k_3*x_1*x_3,k_4*x_4,k_5*x_4,k_6*x_2*x_5}}

o21 = {-2} | k_1x_1    |
      {-3} | k_2x_2^2  |
      {-3} | k_3x_1x_3 |
      {-2} | k_4x_4    |
      {-2} | k_5x_4    |
      {-3} | k_6x_2x_5 |

              6      1
o21 : Matrix R  <-- R
i22 : N = reactionNetwork({StoichM,FluxV},Input=>"Stoichiometric")

o22 = X_1-->2X_2
      2X_2-->X_1
      X_1+X_3-->X_4
      X_4-->X_1+X_3
      X_4-->X_2+X_5
      X_2+X_5-->X_1+X_3

o22 : ReactionNetwork
i23 : peek N

o23 = ReactionNetwork{Complexes => {| 0 1 0 0 1 |, | 0 0 0 1 0 |, | 1 0 1 0 0 |, | 1 0 0 0 0 |, | 0 2 0 0 0 |}}
                      ConcentrationRates => null
                      InitialValues => null
                      NullIndex => -1
                      NullSymbol => 
                      ReactionGraph => Digraph{0 => {2}   }
                                               1 => {2, 0}
                                               2 => {1}
                                               3 => {4}
                                               4 => {3}
                      ReactionRates => null
                      ReactionRing => null
                      Species => {X_1, X_2, X_3, X_4, X_5}

Create a reaction network from a steady state ideal in R =QQ[k_1..k_m,x_1..x_n]. Note that the ideal needs to be unreduced with generator coming from a mass action dynamical system.

i24 : R = QQ[k_1..k_6,x_1..x_5]

o24 = R

o24 : PolynomialRing
i25 : I = ideal(k_2*x_2^2-k_3*x_1*x_3+k_6*x_2*x_5-k_1*x_1+k_4*x_4,
          -2*k_2*x_2^2-k_6*x_2*x_5+2*k_1*x_1+k_5*x_4,
          -k_3*x_1*x_3+k_6*x_2*x_5+k_4*x_4,
          k_3*x_1*x_3-k_4*x_4-k_5*x_4,
          -k_6*x_2*x_5+k_5*x_4)

                2                                        2
o25 = ideal (k x  - k x x  + k x x  - k x  + k x , - 2k x  - k x x  + 2k x  +
              2 2    3 1 3    6 2 5    1 1    4 4      2 2    6 2 5     1 1  
      -----------------------------------------------------------------------
      k x , - k x x  + k x x  + k x , k x x  - k x  - k x , - k x x  + k x )
       5 4     3 1 3    6 2 5    4 4   3 1 3    4 4    5 4     6 2 5    5 4

o25 : Ideal of R
i26 : N = reactionNetwork I

o26 = 2X_2-->X_1
      X_1-->2X_2
      X_1+X_3-->X_4
      X_4-->X_1+X_3
      X_4-->X_2+X_5
      X_2+X_5-->X_1+X_3

o26 : ReactionNetwork
i27 : peek N

o27 = ReactionNetwork{Complexes => {| 0 0 0 1 0 |, | 1 0 0 0 0 |, | 0 1 0 0 1 |, | 1 0 1 0 0 |, | 0 2 0 0 0 |}}
                      ConcentrationRates => null
                      InitialValues => null
                      NullIndex => -1
                      NullSymbol => 
                      ReactionGraph => Digraph{0 => {3, 2}}
                                               1 => {4}
                                               2 => {3}
                                               3 => {0}
                                               4 => {1}
                      ReactionRates => null
                      ReactionRing => null
                      Species => {X_1, X_2, X_3, X_4, X_5}

See also

Ways to use reactionNetwork :

For the programmer

The object reactionNetwork is a method function with options.