Skip to content

Commit

Permalink
Merge pull request #1353 from StochSS/develop
Browse files Browse the repository at this point in the history
Release v2.4.10
  • Loading branch information
BryanRumsey authored Aug 19, 2022
2 parents 16c468c + a47f9d5 commit 59b3bf9
Show file tree
Hide file tree
Showing 102 changed files with 5,700 additions and 6,284 deletions.
2 changes: 1 addition & 1 deletion __version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @website https://github.com/stochss/stochss
# =============================================================================

__version__ = '2.4.9'
__version__ = '2.4.10'
__title__ = 'StochSS'
__description__ = 'StochSS is an integrated development environment (IDE) \
for simulation of biochemical networks.'
Expand Down
2 changes: 1 addition & 1 deletion client/model-view/model-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = View.extend({
this.setReadOnlyMode("model-mode");
this.setReadOnlyMode("system-volume");
}else {
if(this.model.defaultMode === ""){
if(this.model.defaultMode === "" && !this.model.is_spatial){
if(this.model.is_spatial) {
this.model.defaultMode = "discrete";
$(this.queryByHook("spatial-discrete")).prop('checked', true);
Expand Down
1 change: 1 addition & 0 deletions public_models/3D-Cylinder.proj/3D-Cylinder.domn

Large diffs are not rendered by default.

199 changes: 199 additions & 0 deletions public_models/3D-Cylinder.proj/3D_cylinder.wkgp/3D_cylinder.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 3D Cylinder Demo\n",
"***\n",
"This is an example of a 3D reaction diffusion system.\n",
"\n",
"- The domain is a cylinder\n",
"- Species A is created at the right end of the cylinder\n",
"- Species B is created at the left end of the cylinder\n",
"- Diffusion occurs throughout the volume of the cylinder\n",
"- A and B are destroyed on contact\n",
"- Deterministic and Stochastic simulations are run\n",
"\n",
"This example allows us to check if reaction diffusion dynamics are accurate.\n",
"***\n",
"## Setup the Environment\n",
"***"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import spatialpy"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"## Create the 3D Cylinder Model\n",
"***"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def create_3D_cylinder():\n",
" model = spatialpy.Model(\"3D_cylinder\")\n",
" \n",
" # Define Domain Type IDs as constants of the Model\n",
" model.MIDDLE = 'Middle'\n",
" model.EDGE1 = 'Edge1'\n",
" model.EDGE2 = 'Edge2'\n",
" \n",
" # Domain\n",
" domain = spatialpy.Domain.read_stochss_domain('3D_cylinder.smdl')\n",
" model.add_domain(domain)\n",
"\n",
" model.staticDomain = True\n",
"\n",
" # Variables\n",
" A = spatialpy.Species(name=\"A\", diffusion_coefficient=0.1, restrict_to=[model.MIDDLE, model.EDGE1])\n",
" B = spatialpy.Species(name=\"B\", diffusion_coefficient=0.1, restrict_to=[model.MIDDLE, model.EDGE2])\n",
" model.add_species([A, B])\n",
"\n",
" # Parameters\n",
" k_react = spatialpy.Parameter(name=\"k_react\", expression=\"1\")\n",
" k_creat1 = spatialpy.Parameter(name=\"k_creat1\", expression=\"100\")\n",
" k_creat2 = spatialpy.Parameter(name=\"k_creat2\", expression=\"100\")\n",
" left = spatialpy.Parameter(name=\"left\", expression=\"0.5092013833059308\")\n",
" right = spatialpy.Parameter(name=\"right\", expression=\"0.505804729089437\")\n",
" model.add_parameter([k_react, k_creat1, k_creat2, left, right])\n",
"\n",
" # Reactions\n",
" r1 = spatialpy.Reaction(\n",
" name=\"r1\", restrict_to=[model.EDGE1],\n",
" reactants={}, products={'A': 1},\n",
" propensity_function=\"k_creat1 / left * vol\",\n",
" ode_propensity_function=\"k_creat1\"\n",
" )\n",
" r2 = spatialpy.Reaction(\n",
" name=\"r2\", restrict_to=[model.EDGE2],\n",
" reactants={}, products={'B': 1},\n",
" propensity_function=\"k_creat2 / right * vol\",\n",
" ode_propensity_function=\"k_creat2\"\n",
" )\n",
" r3 = spatialpy.Reaction(\n",
" name=\"r3\", rate=\"k_react\",\n",
" reactants={'A': 1, 'B': 1}, products={}\n",
" )\n",
" model.add_reaction([r1, r2, r3])\n",
"\n",
" # Timespan\n",
"# tspan = spatialpy.TimeSpan.arange(1, t=500, timestep_size=1e-3)\n",
" tspan = spatialpy.TimeSpan.arange(1, t=500, timestep_size=1)\n",
" model.timespan(tspan)\n",
" return model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Instantiate the Model"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model = create_3D_cylinder()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"## Simulation Parameters\n",
"***"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def configure_simulation():\n",
" kwargs = {\n",
" # \"number_of_trajectories\":1,\n",
" # \"seed\":None,\n",
" }\n",
" return kwargs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"## Run the Simulation\n",
"***"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"kwargs = configure_simulation()\n",
"results = model.run(**kwargs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"***\n",
"## Visualization\n",
"***"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"results.plot_species('A', animated=True, width=None, height=None)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public_models/3D_Cylinder/3D_cylinder.domn

This file was deleted.

1 change: 0 additions & 1 deletion public_models/3D_Cylinder/3D_cylinder.ipynb

This file was deleted.

1 change: 0 additions & 1 deletion public_models/3D_Cylinder/3D_cylinder.smdl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2">
<model name="Brusselator">
<listOfCompartments>
<compartment id="c" spatialDimensions="3" size="1" constant="true"/>
<compartment id="vol" spatialDimensions="3" size="1000" constant="true"/>
</listOfCompartments>
<listOfSpecies>
<species id="A" compartment="c" initialAmount="100000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="B" compartment="c" initialAmount="100000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="C" compartment="c" initialAmount="0" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="D" compartment="c" initialAmount="0" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="X" compartment="c" initialAmount="2000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="Y" compartment="c" initialAmount="1000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="A" compartment="vol" initialAmount="100000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="B" compartment="vol" initialAmount="100000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="C" compartment="vol" initialAmount="0" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="D" compartment="vol" initialAmount="0" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="X" compartment="vol" initialAmount="2000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
<species id="Y" compartment="vol" initialAmount="1000" substanceUnits="mole" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
</listOfSpecies>
<listOfParameters>
<parameter id="rate1" value="5000" constant="true"/>
Expand Down
Loading

0 comments on commit 59b3bf9

Please sign in to comment.