Skip to content

Commit 7dac12c

Browse files
committed
Initial code commit: version 2.3
1 parent 9998f96 commit 7dac12c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+43812
-4
lines changed

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include stochpy/lib/*
2+
include stochpy/pscmodels/*
3+
include stochpy/modules/*
4+
recursive-include documentation *
5+

README.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.test.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.txt

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
StochPy Stochastic modeling in Python
2+
=====================================
3+
4+
Copyright (c) 2011-2015, Timo R. Maarleveld, Brett G. Olivier, and Frank J. Bruggeman
5+
All rights reserved.
6+
7+
StochPy is distributed under a BSD style licence.
8+
9+
Author information
10+
------------------
11+
12+
Timo R. Maarleveld, Brett G. Olivier, and Frank J. Bruggeman
13+
Centrum Wiskunde en Informatica, Amsterdam, Netherlands
14+
VU University, Amsterdam, Netherlands
15+
16+
17+
web: http://sourceforge.net/projects/stochpy/
18+
19+
Documentation can be found in the user guide (see Documentation directory or http://stochpy.sourceforge.net/html/userguide.html)
20+
21+
Installation
22+
------------
23+
The following software is required before installling StochPy (see user guide for more details):
24+
25+
- Python 2.6+ or Python 3.4+
26+
- NumPy 1.x+
27+
- Matplotlib (optional)
28+
- libsbml (optional)
29+
- libxml2 (optional)
30+
- mpmath (optional)
31+
32+
Linux/MAC OS/Cygwin
33+
~~~~~~~~~~~~~~~~~~~
34+
35+
1) cd to directory StochPy-2.1.0
36+
2) sudo python setup.py install
37+
38+
Windows
39+
~~~~~~~
40+
Use the available windows installer or the setup file
41+
42+
Usage
43+
-----
44+
45+
import stochpy
46+
smod = stochpy.SSA()
47+
48+
# 1: Basic Simulation with the Direct method
49+
smod.DoStochSim(IsTrackPropensities=True)
50+
smod.data_stochsim.simulation_endtime
51+
smod.data_stochsim.simulation_timesteps
52+
smod.GetWaitingtimes()
53+
smod.PrintWaitingtimesMeans()
54+
# 2: Do some Plotting
55+
smod.PlotSpeciesTimeSeries()
56+
smod.PlotWaitingtimesDistributions()
57+
smod.PlotPropensitiesTimeSeries()
58+
# 3: Write data to a text file
59+
smod.Export2File()
60+
smod.Export2File(analysis='distribution')
61+
smod.Export2File(analysis='distribution',datatype='species')
62+
smod.Export2File(analysis='mean',datatype='species')
63+
smod.Export2File(analysis='std',datatype='species')
64+
smod.Export2File(analysis='autocorrelation',datatype='species')
65+
# 4: Show the means from the data of 3-th trajectory
66+
smod.DoStochSim(trajectories=3) # multiple trajectories
67+
smod.data_stochsim.simulation_trajectory
68+
smod.PrintSpeciesMeans()
69+
smod.PrintSpeciesStandardDeviations()
70+
# 5: Switch to data from trajectory 1 and show the means of each species
71+
smod.GetTrajectoryData(1)
72+
smod.PrintSpeciesMeans()
73+
smod.PrintSpeciesStandardDeviations()
74+
# 6: Do one long simulation
75+
smod.DoStochSim(trajectories=1,end=1000000,mode='steps')
76+
smod.PrintSpeciesMeans()
77+
smod.PrintSpeciesStandardDeviations()
78+
# 7: Plot the PDF for different bin sizes
79+
smod.PlotSpeciesDistributions()
80+
smod.PlotSpeciesDistributions(bin_size=5) # larger bin size
81+
smod.PlotSpeciesDistributions(bin_size=10) # again a larger bin size
82+
smod.Export2File(analysis='distribution',datatype='species')
83+
84+
# 8: Usage of the Reload Function: Ksyn = 20, kdeg = 0.2
85+
smod.ChangeParameter('Ksyn',20.0)
86+
smod.ChangeParameter('Kdeg',0.2)
87+
smod.DoStochSim()
88+
smod.PrintSpeciesMeans() # should be ~Ksyn/Kdeg
89+
90+
# 9: Use another model to show the Interpolation features
91+
smod.Model('dsmts-001-01.xml.psc')
92+
smod.DoStochSim(trajectories=1000,end=50,mode='time')
93+
smod.GetRegularGrid(npoints=51)
94+
smod.PlotAverageSpeciesTimeSeries()
95+
smod.PrintAverageSpeciesTimeSeries()
96+
smod.Export2File(datatype='species',analysis='timeseries',IsAverage=True)
97+
98+
# 9: Test each method for different models:
99+
smod.Model('Autoreg.psc')
100+
smod.DoStochSim(trajectories=1,end=1000,mode='steps')
101+
smod.Method('NextReactionMethod')
102+
smod.DoStochSim(trajectories=1,end=1000,mode='steps')
103+
smod.data_stochsim.species
104+
smod.PlotWaitingtimesDistributions()
105+
smod.Method('FirstReactionMethod')
106+
smod.DoStochSim(trajectories=1,end=1000,mode='steps')
107+
smod.Method('TauLeaping')
108+
smod.DoStochSim(trajectories=1,end=1000,mode='steps')
109+
110+
smod.Model('DecayingDimerizing.psc')
111+
smod.DoStochSim(method = 'Direct',trajectories=1,end=50,mode='time')
112+
smod.DoStochSim(method = 'NextReactionMethod',trajectories=1,end=50,mode='time')
113+
smod.DoStochSim(method = 'FirstReactionMethod',trajectories=1,end=50,mode='time')
114+
smod.PlotWaitingtimesDistributions()
115+
smod.DoStochSim(method = 'TauLeaping',trajectories=1,end=50,mode='time',epsilon=0.03) # Should outperform all other implementations
116+
smod.PlotSpeciesTimeSeries()
117+
#smod.PlotWaitingtimesDistributions() # Should give an error
118+
119+
smod.Model('chain500.psc')
120+
smod.DoStochSim(method = 'Direct',trajectories=1,end=10000,mode='steps')
121+
smod.DoStochSim(method = 'NextReactionMethod',trajectories=1,end=10000,mode='steps') # should outperform the direct method and all other implementations
122+
123+
# 10: Use the Next Reaction Method to test a model with a time event
124+
smod.Model('dsmts-003-03.xml.psc')
125+
smod.DoStochSim(method = 'NextReactionMethod')
126+
smod.DoTestsuite()
127+
128+
# 11: Use the First Reaction method to test a model with a concentration event
129+
smod.Model('dsmts-003-04.xml.psc')
130+
smod.DoStochSim(method = 'FirstReactionMethod')
131+
smod.DoTestsuite()
132+
133+
# 12: Volume Models
134+
smod.Model('dsmts-001-11.xml.psc')
135+
smod.DoStochSim(method = 'Direct',trajectories=1000,end=50,mode ='time')
136+
smod.PrintAverageSpeciesTimeSeries()

0 commit comments

Comments
 (0)