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