SSA xSSA Home

Needs["xSSA`"];

Return Value

SSA[r, tmax, ic, rates, options] performs a simulation based on the Gillispie's Stochastic Simulation Algorithm, where:

r = list of reactions.

tmax = run duration

ic = initial conditions as a rule list, e.g, {A→100, B→ 10}

rates = list of parameter values as a rate list.

Options

"MaxSteps"→10^6 (maximum nuber of iteration steps).

Sample"→1 (default value) - number of iterations between output. The default value is to print or record at every calculation but this can rapidly create very large data structures or files. Increasing "Sample" to larger value such as 1000 significantly reduces this and significantly improves run speed.

"Mode"→"List" (default value) - return a list of the form

```{species→{{time,n}, {time,num},...}, species&rarr,...}
```
where all the species values are listed at each time point, e.g.,
```{e → {{0, 12}, {0.00127036, 11}, {0.00137912, 10}, {0.00367294, 9},
{0.00427345, 8}, {0.00992887, 7}, {0.0179237, 6}},
p → {{0, 0}, {0.00127036, 0}, {0.00137912, 0}, {0.00367294, 0},
{0.00427345, 0}, {0.00992887, 0}, {0.0179237, 0}},
s → {{0, 50}, {0.00127036, 49}, {0.00137912, 48}, {0.00367294, 47},
{0.00427345, 46}, {0.00992887, 45}, {0.0179237, 44}},
se → {{0, 0}, {0.00127036, 1}, {0.00137912, 2}, {0.00367294, 3},
{0.00427345, 4}, {0.00992887, 5}, {0.0179237, 6}}}
```

"Mode"→"SparseList" - sames as "List" except values are only listed at time points where the values change;

"Mode"→"Interpolation" - returns the same data as "SparseList" except that the result is formatted as a set of interpolation functions compatible with Plot or xlr8r`runPlot.

"Mode"→"Table" - returns a table of values, e.g.,

```{{"time", e, p, s, se},
{0, 12, 0, 50, 0},
{0.00178837, 11, 0, 49, 1},
{0.0041507, 10, 0, 48, 2},
{0.00611912, 9, 0, 47, 3},
{0.00781369, 8, 0, 46, 4},
{0.0117297, 7, 0, 45, 5}}

```

"Mode"→"TableFile" - returns two files:

SSA-yymmddThhmmss.dat - a tab separated file suitable for use with gnuplot or a spreadsheet;

```# time     e       p       s       se
0.0008164300176138756   11      0       49      1
0.0012466893378014923   10      0       48      2
0.0026112523018487523   9       0       47      3
0.002653193170691766    8       0       46      4
0.008227706038053171    7       0       45      5
0.008855521791119881    6       0       44      6
0.012873337019941995    5       0       43      7
```

SSA-yymmddThhmmss.p - a gnuplot script that can be used to plot the .dat file, and is set with the table data file and the max and min values of the simulation, e.g.,

```
# gnuplot script generated Sun 15 Mar 2009 14:12:45
#
set xlabel 'time'
set ylabel 'number of molecules'
set title 'SSA-090315T141245.dat'
set xrange [0:0.01]
set yrange [0:50]
plot 'SSA-090315T141245.dat' using 1:2 title 'e' with lines ,\
'SSA-090315T141245.dat' using 1:3 title 'p' with lines ,\
'SSA-090315T141245.dat' using 1:4 title 's' with lines ,\
'SSA-090315T141245.dat' using 1:5 title 'se' with lines
```

Example

Implementation Notes