# SAfSB Chapter 5

## Example 5.8 (Standard Modification)

The standard modification model is comprised of the two reactions U → W and W → U. Both reactions have mass action rate laws with propensity factors of 2. Open the file `examples/cain/SAfSB/Chapter5/Example-5_08-StdMod.xml`. In the methods list select TSAR, which has been defined to record times series with all reaction events. Click the launch button to generate a single trajectory. Next select the TSU method, which has been defined to record uniformly-spaced times series data. Since we are only interested in plotting U, deselect the W species in the recorder panel. In the launcher panel, set the number of trajectories to 1000 and then click the launch button. Finally, select the HTB method, which records histograms at t = 5. Again deselect W in the recorder and then click the launch button to generate 1000 trajectories.

Click the plot button to open the plot configuration window. Deselect the Show column for the W species. Then deselect the legend check box. Click the plot button to show the single trajectory with all reaction events. The plot configuration window and the trajectory plot are shown below.

Next we will plot the mean and standard deviation for the ensemble of 1000 trajectories that record times series data. In the plot configuration window, select the "Std Mod, TSU" output. in the second row of radio buttons, select Mean. Change the line color to black by right clicking on the "Line Color" column header. Then label the axes. Finally, click the "Plot" button to add the plot of the mean with standard deviation bars to the current plot of the single trajectory. The configuration window and the plot are shown below.

Next we will plot a histogram of the copy number of U at t = 5. Click the Histograms tab in the plot configuration window. Since there is only one species and one frame, namely t = 5, we don't have to worry about choosing between a multi-species or a multi-frame plot. Click the "Filled" checkbox in the configuration table. Uncheck the legend option and add axes labels. Finally click either of the plotting buttons. The configuration window and the plot are shown below.

Finally, we will examine the effect of changing the stochastic rate parameters. Clone the model "Std Mod" (by clicking the clone button in the models list) and name the result "Std Mod 1-3". In the reactions editor change the stochastic rate constants for the modification and de-modification reactions to 1 and 3, respectively.

Clone the TSU method and name the result TSU_101. In the method editor, change the number of frames (the number of times at which the state is recorded) to 101. Then clone TSU_101 and name the result TSD_101. In the method editor, change the output category to "Time Series, Deterministic". Using the modified model, generate 5 trajectories with the TSU_101 method and one trajectory with the TSD_101 method. Below we plot the stochastic trajectories and the deterministic solution together. Note the we have specified the Y axis limits in the plot configuration window.

## Example 5.8 (Heterodimerization)

Open the file `examples/cain/SAfSB/Chapter5/Example-5_08-HetDim.xml`. Generate one trajectory for the deterministic method (Det) and the stochastic method that records all reactions (All). Generate 1000 trajectories for the time series method (Stoch) and the histogram method (Hist). Note that the copy number of X1 is always the same as X2, so you may deselect X2 in the recorder panel before launching the simulations. Below we plot the deterministic solution in a dashed line, the single stochastic trajectory in colored lines, and the mean and standard deviations of the ensemble of 1000 stochastic trajectories in solid black lines.

Next we plot the histograms at t = 1.5.

## Example 5.9 (Lotka-Volterra)

Open the file `examples/cain/SAfSB/Chapter5/Example-5_09-LotVol.xml`. Generate a single trajectory. Below we plot the results. Note that we have used the "Legend Label" column in the plot configuration window to specify the names in the legend.

You may clone the model to try out different initial conditions. Note that you may not modify a model that has dependent simulation output. By cloning, you can compare the different outputs.

## Example 5.10 (Enzyme Kinetic Reaction)

Open the file `examples/cain/SAfSB/Chapter5/Example-5_10-EnzKin.xml`. The two models differ in the initial amounts of the species. The Large model has initial amounts of 500 and 200 for the species S and E, respectively. For the Small model, the corresponding initial amounts are 50 and 20. For the Large model, we will use the time interval 0..50, while for the Small model we will use 0..100. Generate five trajectories for the following model/method pairs: Large/Fine50 and Small/Fine100. Below we plot the results. We note that the small system is noticeably noisier.

Generate 10,000 trajectories for the Large and Small models using the Coarse50 and Coarse100 methods, respectively. Below we plot the means and standard deviations.

To collect histogram data at the end time, generate 10,000 trajectories for the Large and Small models using the Hist50 and Hist100 methods, respectively. Below we show the plot configuration windows and plot the histograms. We generate the plots by clicking the "Plot Together" button. Note that for the Small model the histograms overlap so we make them translucent by setting the Alpha value to 0.5.

## Example 2.12 (Schlogl)

We use the Schlogl model in the Plotting Histograms section of the Visualization and Analysis chapter. The stochastic rate constants differ, but the behavior is essentially the same.

## Example 2.13 (Gene Regulation)

Open the file `examples/cain/SAfSB/Chapter5/Example-5_13-GeneReg.xml`. Generate a single trajectory for each model using the All method. Then generate 1000 trajectories each using the Uniform method. Below we plot a single trajectory and the mean abundance for the default model, the model with decreased km, and the model with decreased km and increased kp.

To measure the noise in each model, generate a single trajectory for each using the Steady method. Here we record the state for a time interval of 10,000 seconds. For each simulation output, click the table button in the simulation output panel, then select the mean and standard deviation option. The resulting tables are shown below. Dividing the standard deviations by the means, we see that the second and third models are noisier than the first.