next | previous | forward | backward | up | top | index | toc | Macaulay2 website
ReactionNetworks :: conservationEquations

conservationEquations -- creates the conservation equations of a reaction network

Description

Generate the conservation equations using the stoichiometric subspace. Before any equations can be created, you must invoke the createRing function, which creates the reaction network ring. If you do not create the ring, you will receive an error message.

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
i2 : R = createRing(N, QQ)

o2 = R

o2 : PolynomialRing
i3 : conservationEquations N

o3 = {2xx  + xx  - xx  + xx  - 2cc  - cc  + cc  - cc , - 2xx  - xx  + 2xx  +
         A     B     C     D      A     B     C     D       A     B      C  
     ------------------------------------------------------------------------
     xx  + 2cc  + cc  - 2cc  - cc }
       E      A     B      C     E

o3 : List

Obtain the conservation equations for a motif and display equations.

i4 : N = modificationOfTwoSubstratesI()

o4 = S_0+E-->X_1
     X_1-->S_0+E
     X_1-->E+S_1
     S_1+F-->Y_1
     Y_1-->S_1+F
     Y_1-->S_0+F
     E+P_0-->X_2
     X_2-->E+P_0
     X_2-->E+P_1
     F+P_1-->Y_2
     Y_2-->F+P_1
     Y_2-->F+P_0

o4 : ReactionNetwork
i5 : createRing(N,QQ)

o5 = QQ[xx   , xx , xx   , xx   , xx , xx   , xx   , xx   , xx   , xx   , cc   , cc , cc   , cc   , cc , cc   , cc   , cc   , cc   , cc   , kk      , kk      , kk      , kk      , kk      , kk      , kk      , kk      , kk      , kk       , kk       , kk        ]
          S_0    E    X_1    S_1    F    Y_1    P_0    X_2    P_1    Y_2    S_0    E    X_1    S_1    F    Y_1    P_0    X_2    P_1    Y_2    {0, 1}    {1, 0}    {1, 2}    {3, 4}    {4, 3}    {4, 5}    {6, 7}    {7, 6}    {7, 8}    {9, 10}    {10, 9}    {10, 11}

o5 : PolynomialRing
i6 : netList conservationEquations N

     +-------------------------------------------------------------------------------------+
o6 = |xx    + xx    + xx    + xx    - cc    - cc    - cc    - cc                           |
     |  S_0     X_1     S_1     Y_1     S_0     X_1     S_1     Y_1                        |
     +-------------------------------------------------------------------------------------+
     |xx  + xx    + xx    - cc  - cc    - cc                                               |
     |  E     X_1     X_2     E     X_1     X_2                                            |
     +-------------------------------------------------------------------------------------+
     |xx    - xx  + xx    - xx  + xx    + xx    - cc    + cc  - cc    + cc  - cc    - cc   |
     |  S_0     E     S_1     F     P_0     P_1     S_0     E     S_1     F     P_0     P_1|
     +-------------------------------------------------------------------------------------+
     |- xx    - xx    - xx    + xx  + xx    + cc    + cc    + cc    - cc  - cc             |
     |    S_0     X_1     S_1     F     Y_2     S_0     X_1     S_1     F     Y_2          |
     +-------------------------------------------------------------------------------------+

Generate the conservation equations in a specific ring.

i7 : N = twoLayerCascadeL()

o7 = S_0+E-->X_1
     X_1-->S_0+E
     X_1-->E+S_1
     S_1+P_0-->X_2
     X_2-->S_1+P_0
     X_2-->S_1+P_1
     E+P_0-->X_3
     X_3-->E+P_0
     X_3-->E+P_1
     S_1+F_1-->Y_1
     Y_1-->S_1+F_1
     Y_1-->S_0+F_1
     P_1+F_2-->Y_2
     Y_2-->P_1+F_2
     Y_2-->P_0+F_2

o7 : ReactionNetwork
i8 : R = createRing(N, ZZ/2)

o8 = R

o8 : PolynomialRing
i9 : G = conservationEquations(N, ZZ/2)

o9 = {xx  + xx    + xx    + cc  + cc    + cc   , xx    + xx    + xx    +
        E     X_1     X_3     E     X_1     X_3    S_0     X_1     S_1  
     ------------------------------------------------------------------------
     xx    + xx    + cc    + cc    + cc    + cc    + cc   , xx    + xx    +
       X_2     F_1     S_0     X_1     S_1     X_2     F_1    S_0     X_1  
     ------------------------------------------------------------------------
     xx    + xx    + xx    + cc    + cc    + cc    + cc    + cc   , xx  +
       S_1     X_2     Y_1     S_0     X_1     S_1     X_2     Y_1    E  
     ------------------------------------------------------------------------
     xx    + xx    + xx    + xx    + xx    + cc  + cc    + cc    + cc    +
       X_1     P_0     X_2     P_1     F_2     E     X_1     P_0     X_2  
     ------------------------------------------------------------------------
     cc    + cc   , xx  + xx    + xx    + xx    + xx    + xx    + cc  + cc   
       P_1     F_2    E     X_1     P_0     X_2     P_1     Y_2     E     X_1
     ------------------------------------------------------------------------
     + cc    + cc    + cc    + cc   }
         P_0     X_2     P_1     Y_2

o9 : List

The conservation equations describe a linear subspace going through the origin. To translate the subspace, the user may choose to use random values for the parameters, or enter specific values, such as initial conditions.

i10 : N = twoLayerCascadeL()

o10 = S_0+E-->X_1
      X_1-->S_0+E
      X_1-->E+S_1
      S_1+P_0-->X_2
      X_2-->S_1+P_0
      X_2-->S_1+P_1
      E+P_0-->X_3
      X_3-->E+P_0
      X_3-->E+P_1
      S_1+F_1-->Y_1
      Y_1-->S_1+F_1
      Y_1-->S_0+F_1
      P_1+F_2-->Y_2
      Y_2-->P_1+F_2
      Y_2-->P_0+F_2

o10 : ReactionNetwork
i11 : N.Species

o11 = {S_0, E, X_1, S_1, P_0, X_2, P_1, X_3, F_1, Y_1, F_2, Y_2}

o11 : List
i12 : R = createRing(N,QQ)

o12 = R

o12 : PolynomialRing
i13 : G = conservationEquations(N, QQ)

o13 = {xx  + xx    + xx    - cc  - cc    - cc   , - xx    - xx    - xx    -
         E     X_1     X_3     E     X_1     X_3      S_0     X_1     S_1  
      -----------------------------------------------------------------------
      xx    + xx    + cc    + cc    + cc    + cc    - cc   , xx    + xx    +
        X_2     F_1     S_0     X_1     S_1     X_2     F_1    S_0     X_1  
      -----------------------------------------------------------------------
      xx    + xx    + xx    - cc    - cc    - cc    - cc    - cc   , xx  +
        S_1     X_2     Y_1     S_0     X_1     S_1     X_2     Y_1    E  
      -----------------------------------------------------------------------
      xx    - xx    - xx    - xx    + xx    - cc  - cc    + cc    + cc    +
        X_1     P_0     X_2     P_1     F_2     E     X_1     P_0     X_2  
      -----------------------------------------------------------------------
      cc    - cc   , - xx  - xx    + xx    + xx    + xx    + xx    + cc  +
        P_1     F_2      E     X_1     P_0     X_2     P_1     Y_2     E  
      -----------------------------------------------------------------------
      cc    - cc    - cc    - cc    - cc   }
        X_1     P_0     X_2     P_1     Y_2

o13 : List

Substitute InitialValues

The example below demonstrates how to substitute specific values for the initial values in a reaction network. The list of desired values must be input in the order of the initial values; for that order use N.InitialValues, where N is the name of the reaction network. To substitute random values refer to the example at the end of steadyStateEquations.

i14 : N = reactionNetwork("A --> 2B, A + C --> D, D --> 0", NullSymbol => "0")

o14 = A-->2B
      A+C-->D
      D-->0

o14 : ReactionNetwork
i15 : R = createRing N

o15 = R

o15 : PolynomialRing
i16 : CE = conservationEquations N

o16 = {- 2xx  - xx  + 2xx  + 2cc  + cc  - 2cc }
            A     B      C      A     B      C

o16 : List
i17 : L = {1,2,3,4}

o17 = {1, 2, 3, 4}

o17 : List
i18 : Iv = toList(apply(0..length N.InitialValues-1, i-> value(N.InitialValues#i)))

o18 = {cc , cc , cc , cc }
         A    B    C    D

o18 : List
i19 : S=toList(apply(0..length Iv-1, i-> Iv#i=>L#i))

o19 = {cc  => 1, cc  => 2, cc  => 3, cc  => 4}
         A         B         C         D

o19 : List
i20 : toList apply(0..length CE-1, i-> sub(CE#i,S))

o20 = {- 2xx  - xx  + 2xx  - 2}
            A     B      C

o20 : List

See also

Ways to use conservationEquations :

For the programmer

The object conservationEquations is a method function.