Notebook
We use this iPython notebook to illustrate the basics of StochPy.
Written by TR Maarleveld, Amsterdam, The Netherlands
E-mail: tmd200@users.sourceforge.net
Last Change: August 10, 2015
#######################################################################
# #
# Welcome to the interactive StochPy environment #
# #
#######################################################################
# StochPy: Stochastic modeling in Python #
# http://stochpy.sourceforge.net #
# Copyright(C) T.R Maarleveld, B.G. Olivier, F.J Bruggeman 2010-2015 #
# DOI: 10.1371/journal.pone.0079345 #
# Email: tmd200@users.sourceforge.net #
# VU University, Amsterdam, Netherlands #
# Centrum Wiskunde Informatica, Amsterdam, Netherlands #
# StochPy is distributed under the BSD licence. #
#######################################################################
Version 2.3.0
Output Directory: /home/timo/Stochpy
Model Directory: /home/timo/Stochpy/pscmodels
We start by using the direct method for basic simulation of the immigration-death model (the default model). The immigration-death model is a simplification of the birth-death model (a Markovian process) with a fixed birth rate.
We generate a complete and detailed history of all species in the model (mRNA), the propensities of the immigration and death reaction, and which reaction fires when. This allows us to determine the event waiting times for each event, i.e. reaction.
This is what we illustrate here.
Reaction Mean
R1 0.098
R2 0.101
StochPy also allows the user to export the data to a text file via the high-level function "Export2File".
By default, the species time series data is exported, whereas all types of data can be exported (if generated of course).
*** WARNING ***: Autocorrelations are not yet calculated. StochPy automatically calculates autocorrelations with pre-defined settings. You can use GetSpeciesAutocorrelations(species2calc=True,n_samples=51)
We again use to immigration-death model to:
- generate multiple realizations (trajectories)
- show how we can switch between the different generated trajectories within StochPy
- perform a simulation for 10**6 time steps to illustrate probability density functions of species copy numbers
3
Species Mean
mRNA 50.286
Species Standard Deviation
mRNA 6.773
Species Mean
mRNA 50.205
Species Standard Deviation
mRNA 6.109
Species Mean
mRNA 50.086
Species Standard Deviation
mRNA 7.123
StochPy provides many different stochastic simulation algorithms which we can divide in the following categories:
1) exact SSAs
2) inexact SSA
3) exact SSAs with delay
4) single molecule methods
The exact SSAs are most used, but suffer typically from extensive running times. Inexaxt SSAs (i.e. tau-leaping) can be an outcome when exact SSAs are too slow for the job. We illustrate this here for the "DecayingDimerizing" model. The simulation with an exact solver is about 50 times slower. Remember that using tau-leaping methods result in loss of information (e.g. waiting times cannot be calculated).
Exact SSAs with delay and single molecule methods are discussed in a different iPython notebook
StochPy supports e.g.
- models written in the PySCeS MDL (human readable) and SBML.
- assignments and events (time and species)
- modification of model parameters and species copy number amounts
In the upcoming examples, we illustrate each of these features in more detail.
Info: single compartment model: locating "Death" in default compartment
Info: single compartment model: locating "Birth" in default compartment
Writing file: /home/timo/Stochpy/pscmodels/dsmts-001-01.xml.psc
csymbol time defined as "t" in event
Info: single compartment model: locating "Dimerisation" in default compartment
Info: single compartment model: locating "Disassociation" in default compartment
Writing file: /home/timo/Stochpy/pscmodels/dsmts-003-03.xml.psc
*** WARNING ***: Species are given in concentrations and the compartment volume is unequal to one.
The species concentrations are multiplied by the compartment volume.
*** WARNING ***: Species are given in concentrations and the compartment volume is unequal to one.
The species concentrations are multiplied by the compartment volume.