Example 3: expression of a signalling genes in a chamber - cellmodeller/CellModeller GitHub Wiki
Overview
The model we will use in this example is 'ex3_simpleSignal.py'. This model simulates constitutive production of a molecule x0 (displayed in red) which can also diffuse from the cell. In addition, the model also includes two physical boundaries that confine colony growth in a narrow chamber. The output of the simulation should look like the following:

Explanation
Below, we will show you how to create these files by modifying from our second example (ex2_constGene.py) and introduce you along the way to additional CellModeller functionalities.
1. Setup an integrator and diffusion grid for solving PDE of chemical species inside the cell and extracellular signalling.
1.1) Import integrator and diffusion grid packages. Specifically, in python import package section, add:
from CellModeller.Integration.CLCrankNicIntegrator import CLCrankNicIntegrator
from CellModeller.Signalling.GridDiffusion import GridDiffusion
You may remove the line importing 'CLEulerIntegrator' as 'CLCrankNicIntegrator' can handle the dynamic of both intracellular species and extracellular diffusion.
1.2) Define diffusion grid
In global variable section, add:
grid_size = (4, 4, 4) #grid size
grid_dim = (64, 8, 12) #dimension of diffusion space, unit = number of grid
grid_orig = (-128, -14, -8) #where to place the diffusion space onto simulation space
These three variables will later be used for specifying the space we simulate the diffusion of extracellular signalling.
1.3) Add integrator, diffusion grid and diffusion renderer to simulation setup.
Under 'setup(sim)', add signal object and change integrator object to the following:
sig = GridDiffusion(sim, 1, grid_dim, grid_size, grid_orig, [10.0])
integ = CLCrankNicIntegrator(sim, 1, 5, max_cells, sig, boundcond='reflect')
Include integrator and signaling objects to the simulator. Specifically, under 'setup(sim)', change 'sim.init' to the following:
sim.init(biophys, regul, sig, integ)
1.4) Add grid renderer so that we can visualise a diffusing signal. Specifically, under 'setup(sim)' add the following:
sigrend = Renderers.GLGridRenderer(sig, integ)
sim.addRenderer(sigrend)
**2. Setup the dynamics of intracellular reaction and extracellular reaction-diffusion.
2.1) Specify initial condition:
For this example, we have one extracellular signalling molecule with initial concentration = 0. To setup, add the following under 'initial(cell)':
cell.signals[:] = [0]
2.2) Specify differential equations for the dynamics of intracellular chemical species.
The differential equations for this example are similar to that of 'ex2_constGene.py' but also has with an additional term for x0 diffusing in or out of the cell. The variable 'x0_sig' represents outside the cell. Diffusion coefficient is D1 = 0.1. To implement this, change specification of differential equations under 'specRateCL()' to
'''return
const float D1 = 0.1f;
const float k1 = 0.1f;
float x0 = species[0];
float x0_sig = signals[0];
rates[0] = k1 + D1*(x0_sig-x0)*area/gridVolume;'''
2.3) Specify differential equations for the dynamics of extracellular signalling molecules.
For this model, the only source of 'x0_sig' is diffusion of 'x0' produced from cells. We can implement this by adding this new function:
def sigRateCL():
return '''
const float D1=0.1f;
float x0 = species[0];
float x0_sig = signals[0];
rates[0] = -D1*(x0_sig-x0)*area/gridVolume;'''
3. Define the boundary of the growth chamber
You can define a plane using three parameters specifying 1) location, 2) direction, 3) stiffness. Here we will add two planes at location (0,-16,0) and (0, 16,0). The normal vectors of these planes are (0, 1, 0) and (0, -1, 0). These location and direct will limit the colony to only grow inside the simulated diffusion area.The stiffness of both plane is 1 which mean cell cannot push/penetrate the planes. To implement this, we use a method 'addPlane' of 'biophys' object under 'setup(sim) as the following:
biophys.addPlane((0,-16,0), (0,1,0), 1)
biophys.addPlane((0,16,0), (0,-1,0), 1)
4. Save, open GUI, load and run
You should see a growing colony starting from a black cell which gradually turns red over time while the region around the cells also gradually turns red. The dark grey band in the middle of the window represent both the grid area we simulate diffusion and the locations of our physical boundary. Thus, neither diffusing signals nor cells can go outside this dark grey band.