-
Notifications
You must be signed in to change notification settings - Fork 50
Example 1: Simple cell growth
1. Open CellModeller GUI
Launch the CellModeller user interface by running cmgui
.
Now you should see cellmodeller GUI like this:
2. Load and run example1 model from GUI
2.1) On the GUI, click 'Load' button, go to 'Examples' folder inside cellmodeller main folder and open 'ex1_simpleGrowth.py'
Now you should see a rod shape representing a cell in the middle of your GUI space:
2.2) On the GUI, click 'Run' button to start the simulation. To stop the simulation, you can simply close the GUI window.
- On the GUI when the simulation is running, you should see green cell(s) grows and divides into a colony. Note that you have to to hover your mouse cursor above the GUI to see the updated simulation result. Here is an example of a screen shot:
-
In the terminal when the simulation is running, you should see line-by-line printed out simulation result. For each line, the three columns are time point in the simulation, the total number of cells, and the total number of contacts between cells.
-
In the 'data' folder inside cellmodeller main folder, you should see a new folder name ex1_simpleGrowth-. Inside this folder you should see a series of *.pickle file which contain simulation output data from each different time pout.
3. Learn about the structure of a simple model.
Open 'ex1_simpleGrowth.py' in a text editor (We use emacs here). You should see the python code inside 'ex1_simpleGrowth.py'. The code can be divided into the following components
a) Package import. The first several lines on the top are for importing relevant python packages for the simulation. We will explain how these packages work later.
b) Global variables. Here you will only see 'max_cells' which specifies the maximal number of simulated cells.
c) 'setup(sim)'. This part is to setup basic model parameters. For now, we will just look at the part that says 'sim.addCell' which would allow you specify the initial numbers of cell types and their locations. For this particular example, you should only see a single line below saying that the model will start with only one cell of type 0 at the position (0,0,0).
sim.addCell(cellType=0, pos = (0,0,0))
d) 'init(cell)'. This part specifies the size of initial cell(s) and cell growth rates. You should see two lines of codes below saying that initial cells should have average size = 2.5 with variability uniformly distributed from 0 to 0.5 and that cells should grow at the rate 2.0
cell.targetVol = 2.5 + random.uniform(0.0,0.5)
cell.growthRate = 2.0
e) 'numSignals()'. This part specifies cell-cell signalling. We don't have this implemented in our simple cell growth simulation so this part is left empty. --what does this actually do? TJR: This is not actually used any longer so can be taken out of the examples.
f) 'numSpecies()'. This part specifies intracellular gene network. We don't have this implemented in our simple cell growth simulation so this part is left empty. --what does this actually do? TJR: This is not actually used any longer so can be taken out of the examples.
g) 'update(cells)' This part iterates through each cell and update cell states. For this example, the model only updates cell color and cell division status. Here, cell color depends only on cell type and thus remains the same throughout the simulation. Recall that we only have cell type 0 so cell color would be [0.1, 1, 0.3] ([red, green, blue]). This is why you see all cells on GUI in bright green color. The code below also checks whether a cell volume reaches the target volume. If so, the cell is flagged for division. 'cell.asym' specifies that cell division should be symmetric.
for (id, cell) in cells.iteritems():
cell.color = [cell.cellType*0.6+0.1, 1.0-cell.cellType*0.6, 0.3]
if cell.volume > cell.targetVol:
a = 1
cell.asymm = [a,1]
cell.divideFlag = True
h) 'divide(parent, d1, d2)'. This part specifies the target cell size that would trigger cell division. In this example, the target size has average = 2.5 with variability uniformly distributed from 0 to 0.5 -- You should see--why there are two separated specification for d1 and d2?
d1.targetVol = 2.5 + random.uniform(0.0,0.5)
d2.targetVol = 2.5 + random.uniform(0.0,0.5)
4. Experiment on different variants of the simple model through the following exercises:
a) Simulate 2D growth pattern starting from two cells of different types
To do this, go to 'sim.addCell' part of 'setup(sim)' section. Change 'sim.addCell(cellType=0, pos = (0,0,0))' to the code below. This will initiate the model with two different cell types located at (-10,0,0) and (10,0,0).
sim.addCell(cellType=0, pos = (-10,0,0))
sim.addCell(cellType=1, pos = (10,0,0))
The new model file should look like 'ex1a_simpleGrowth2Types.py' we provide in ~/cellmodeller/Examples folder. If you restart GUI, load and run this file, you should see result like the following:
b) Simulate 2D growth pattern with spherical cell
To do this, go to 'divide(parent, d1, d2)' part and change the target average cell size (i.e length) from 2.5 to a smaller number, say, 1. The new model should look like 'ex1b_simpleGrowthRoundCell.py' we provide in ~/cellmodeller/Examples folder. If you restart GUI, load and run this file, you should see result like the following: