Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build model update #797

Merged
merged 15 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ GillesPy2 provides simple object-oriented abstractions for defining a model of a
1. Create a `GillesPy2.Model` containing molecular species, parameters, and reactions (or import it from an [SBML](http://sbml.org) file)
2. Invoke the model's `.run()` method.

The `run()` method can be customized using keyword arguments to select different solvers, random seed, data return type and more. For more detailed examples on how to use GillesPy2, please see the [Getting Started](https://github.com/StochSS/GillesPy2/tree/main/examples/StartHere.ipynb) Jupyter notebook contained in the [examples](https://github.com/StochSS/GillesPy2/tree/main/examples) subdirectory.
The `run()` method can be customized using keyword arguments to select different solvers, random seed, data return type and more. For more detailed examples on how to use GillesPy2, please see the [Getting Started](https://github.com/StochSS/GillesPy2/tree/main/examples/Start_Here.ipynb) Jupyter notebook contained in the [examples](https://github.com/StochSS/GillesPy2/tree/main/examples) subdirectory.

### _Simple example to illustrate the use of GillesPy2_

Expand All @@ -85,36 +85,37 @@ The `run()` method can be customized using keyword arguments to select different
In GillesPy2, a model is expressed as an object having the parent class `Model`. Components of the model, such as the reactions, molecular species, and characteristics such as the time span for simulation, are all defined within the subclass definition. The following Python code represents our dimerization model using GillesPy2's facility:

```python
class Dimerization(gillespy2.Model):
def __init__(self, parameter_values=None):
# First call the gillespy2.Model initializer.
gillespy2.Model.__init__(self, name='Dimerization')

# Define parameters for the rates of creation and dissociation.
k_c = gillespy2.Parameter(name='k_c', expression=0.005)
k_d = gillespy2.Parameter(name='k_d', expression=0.08)
self.add_parameter([k_c, k_d])

# Define variables for the molecular species representing M and D.
m = gillespy2.Species(name='monomer', initial_value=30)
d = gillespy2.Species(name='dimer', initial_value=0)
self.add_species([m, d])

# The list of reactants and products for a Reaction object are each a
# Python dictionary in which the dictionary keys are Species objects
# and the values are stoichiometries of the species in the reaction.
r_c = gillespy2.Reaction(name="r_creation", rate=k_c, reactants={m:2}, products={d:1})
r_d = gillespy2.Reaction(name="r_dissociation", rate=k_d, reactants={d:1}, products={m:2})
self.add_reaction([r_c, r_d])

# Set the timespan for the simulation.
self.timespan(numpy.linspace(0, 100, 101))
def create_dimerization(parameter_values=None):
# First call the gillespy2.Model initializer.
model = gillespy2.model(name='Dimerization')

# Define parameters for the rates of creation and dissociation.
k_c = gillespy2.Parameter(name='k_c', expression=0.005)
k_d = gillespy2.Parameter(name='k_d', expression=0.08)
model.add_parameter([k_c, k_d])

# Define variables for the molecular species representing M and D.
m = gillespy2.Species(name='monomer', initial_value=30)
d = gillespy2.Species(name='dimer', initial_value=0)
model.add_species([m, d])

# The list of reactants and products for a Reaction object are each a
# Python dictionary in which the dictionary keys are Species objects
# and the values are stoichiometries of the species in the reaction.
r_c = gillespy2.Reaction(name="r_creation", rate=k_c, reactants={m:2}, products={d:1})
r_d = gillespy2.Reaction(name="r_dissociation", rate=k_d, reactants={d:1}, products={m:2})
model.add_reaction([r_c, r_d])

# Set the timespan for the simulation.
tspan = gillespy2.TimeSpan.linspace(t=100, num_points=101)
model.timespan(tspan)
return model
```

Given the class definition above, the model can be simulated by first instantiating the class object, and then invoking the `run()` method on the object. The following code will run the model 10 times to produce 10 sample trajectories:

```python
model = Dimerization()
model = create_dimerization()
results = model.run(number_of_trajectories=10)
```

Expand Down
618 changes: 0 additions & 618 deletions examples/AdvancedFeatures/CLE_examples_convergence.ipynb

This file was deleted.

221 changes: 0 additions & 221 deletions examples/AdvancedFeatures/Events.ipynb

This file was deleted.

265 changes: 0 additions & 265 deletions examples/AdvancedFeatures/Live Output with C Solver.ipynb

This file was deleted.

273 changes: 0 additions & 273 deletions examples/AdvancedFeatures/Live Output with Python Solvers.ipynb

This file was deleted.

169 changes: 0 additions & 169 deletions examples/AdvancedFeatures/Model_Pre_Compilation.ipynb

This file was deleted.

157 changes: 0 additions & 157 deletions examples/AdvancedFeatures/Negative Timespan Example.ipynb

This file was deleted.

Loading