Code Monkey home page Code Monkey logo

schnakenberg_sim's Introduction

Schnakenberg_Sim

License: MIT BCH compliance

This package generates a basic Turing Pattern model using the Schnakenberg System [1], as part of a group project for the SABS DTC Mathematical Biology Course.

Schnakenberg System

We consider a trimolecular reaction that may display limit cycle behaviour:

2A + B ⇌ 3A
A ⇌ M
N → B

M and N are in sufficient excess that their concentration is effectively constant. In addition, the reverse direction in the first reaction occurs far more slowly than the forwards direction, so a simplifying assumption tha tthe reaction in one-directional is taken. We may consider these reactions to be equivalent to standard formation and decay reactions:

2A + B → 3A, ∅ → A, A → ∅, ∅ → B

Which occur with respective rates k1, k2, k3, k4.

This can be represented by the non-dimensional system of ODEs:

ODES model

Parameter Description Corresponding Stochastic Parameter
μ Birth rate of A molcules k_2
β Birth rate of B molecules k_4
κ Rate of 2A + B → 3A reaction k_1
α Death rate of A molcules k_3

β > 0 controls the rate of tranmission, κ > 0 the rate at which exposed individuals become infectious, and γ > 0 the rate at which individuals recover. The model also requires initial conditions for each compartment: S(0), E(0), I(0), and R(0), which represent the initial number of people in each category.

This autocatalytic system is similar to a 'Brusselator', in which B is instead formed from A (at some rate kA ).

Spatial Variation

In order to see any patterning, a spatial component must be taken into account. Turing patterns are driven by an instability causing diffusion mechanism, which needs to be incorporated into the model.

The ODE system therefore becomes the PDE system:

PES model

Diffusive terms can be added into the stochastic model by partitioning the domain into boxes of side length h. In this model we consider a pseudo-2D domain so arrange our boxes on a 2D rectangular lattice, and index these boxes by i,j. Diffusion events are modelled as "reactions" between adjoining boxes:

Code Structure

Running files have 'main' in the file name (such as ode_main.py), and can be used to run simulations and generate visualisations of the system, based on functions defined in the other files. The functionality of each of these files is as follows:

  • ode_main.py - Solve ODE model with no spatial dependance
  • spatial_main.py - Solve ODE model with spatial dependance in 1D
  • spatial_main_2d.py - Solve ODE model with spatial dependance in 2D
  • fd_main.py - Solve ODE model with spatial dependance in 2D, using finite difference method

Further scripts are provided as Jupyter Notebooks (.ipynb) in the Examples/ directory, and used to generate all other figures in the Images/ directory.

Example Results

Deterministic PDE Simulations

Deterministic Turing Pattern Formation (gif)

This figure displays the formation of a Turing Pattern from a uniform state, with an additional uniform noise distribution. The simulation is nondimensionalised, and so both time and position are in arbitrary units scaled by the rate and diffusion constants.

Stochastic Simulations

import workflow as wf

# workflow.py uses sim.py for simulation and vis.py for visualization

sim_1 = wf.Simulation("sim_1")  # initializes with parameters from sim_1.txt
sim_1.go()  # runs the simulation
sim_1.visualize()  # creates gifs

Compare final A and B populations

Population A Population B

CT scan visualization

Sim 4 Catscan X_A

References

[1] Schnakenberg, J. (1979). Simple chemical reaction systems with limit cycle behaviour. In Journal of Theoretical Biology (Vol. 81, Issue 3, pp. 389–400). Elsevier BV. https://doi.org/10.1016/0022-5193(79)90042-0

schnakenberg_sim's People

Contributors

kcgallagher avatar jessebmurray avatar elizabeth-hayman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.