This tutorial was generated from the file projects/CoGNaC/test/TestCancerCellColonizationOfaColonCryptLiteratePaper.hpp at revision r27518.
Note that the code is given in full at the bottom of the page.
In this test we show how Chaste can be used to simulate a model of a colon crypt
combining a center-based 2-D representation of cells at the spatial level and a
NRBN-based model underlying gene regulatory network.
Full details of the computational model can be found in
Rubinacci et al. (2015).
This class was used to produce Figure 5 and the differentiation tree
in Figure 4.
The next two headers are used to define a DifferentiationTree object.
The next header file defines a cell-cycle model which is based
on a DifferentiationTree object.
The next header file is used in order to visualise the simulation using Paraview.
The next header file defines a property named ‘Differentiation Colour’ used
for visualise distinct cellular types having different colours using Paraview.
The next header file defines a helper class for generating cells.
The next header file defines a proliferative type of the cells.
The next header file defines a helper class for generating a suitable mesh.
The next header file defines a fixed duration cell-cycle model class.
The next header file defines a CellPopulation class that uses a triangular mesh,
and allows for the inclusion of ‘ghost nodes’. These are nodes in the mesh that do
not correspond to cells; instead they help ensure that a sensible Delaunay triangulation
is generated at each timestep. This is because the triangulation algorithm requires a
convex hull.
The next header file defines the class that simulates the evolution of an off-lattice CellPopulation
The next header file defines a cell killer class, which implements sloughing of cells into
the lumen once they reach the top of the crypt.
The next header file defines a force law, based on a linear spring, for describing
the mechanical interactions between neighbouring cells in the crypt.
We create a new cell population boundary condition class to specify a fixed domain within which cells are constrained to lie.
For details, see this tutorial.
We define a boundary condition for a two-dimensional cell-based simulation, in which all cells are constrained to lie within
the domain given in Cartesian coordinates by 0 <= x <= 20 and y >= 0.
Starting from ‘fig4_atm.dat’ containing a description of the ATN
and the attractors lengths of the network, we calculate a differentiation tree using
the TES theory. Here we test the topological properties of the differentiation
tree and the differentiation probabilities computed.
We start instantiating a ThresholdErgodicSetDifferentiationTree
object from an ATN defined in the file networks_samples/fig4_atn.dat.
We get the differentiation tree of the network.
Test the topological properties of the tree.
We want also test the differentiation probabilities associated
to the root node.
We define an array of expected probabilities.
We also get the differentiation probabilities from the root node
and we test the size of the vector.
Convert the vector into an array.
Sort the array of probabilities in decreasing order.
Finally, we test that each probability has the correct
value.
Starting from ‘fig4_atm.dat’ containing a description of the ATN
and the attractors lengths, we calculate a differentiation tree using
the TES theory. Then, we use the differentiation tree to drive the
differentiation process during the simulation of a tissue built by
displaying 20 × 20 = 400 hexagonal stem cells at time t = 0
on a 2-D rectangular space with left-hand, right-hand and bottom
closed boundaries.
We start reseeding the RandomNumberGenerator. In
this case it is seeded with the seed zero, but if we
want to show distinct behaviours of the system, we need
to seed it using a random number.
Two ways are:
RandomNumberGenerator::Instance()->Reseed(time(NULL))
where time() returns the number of seconds since January 1970.
RandomNumberGenerator::Instance()->Reseed(getpid())
where getpid() returns the system’s process ID for the current program.
We instantiate a ThresholdErgodicSetDifferentiationTree
object from an ATN defined in the file networks_samples/fig4_atn.dat.
We get the differentiation tree of the network.
Save the differentiation tree in a .gml file, in order
to visualise it using graph visualisation tool (e.g. Cytoscape).
Figure 4 - Differentiation Tree.
Call a method (defined below) which associates a distinct colour to
each node in the tree (cell type).
We normalise the cell cycle length of each cell type using
the average cell cycle length. In our paper it is indicated
with \Lambda (a NRBN time step corresponds to 0.25 hours).
Next, we generate a mutable mesh. To create a
, we can use
the
. This generates a honeycomb-shaped mesh,
in which all nodes are equidistant. Here the first and second arguments
define the size of the mesh - we have chosen a mesh that is 20 nodes (i.e.
cells) wide, and 20 nodes high. The third argument defines the number of ghost nodes.
We only want to create cells to attach to real nodes, so we
use the method
to get the indices
of the real nodes in the mesh. This will be passed in to the
cell population later on.
Having created a mesh, we now create a
of
s.
To do this, we use the CellsGenerator helper class again. This time the second
argument is different and is the number of real nodes in the mesh.
All cells have
.
Now we need to associate each cell with a
and initialise it (each instance is different). So, for each cell we
initialise its cell cycle model and randomly set its birthtime.
Now we have a mesh and a set of cells to go with it, we can create a
.
In general, this class associates a collection of cells with a set of elements or a mesh.
For this test, because we have a
, and ghost nodes we use a particular type of
cell population called a
. The third
argument of the constructor takes a vector of the indices of the real nodes and should be the
same length as the vector of cell pointers.
Add writers used for visualise the simulation using Paraview.
We then pass in the cell population into an
,
and set the output directory and end time.
We create a force law, and pass it to the
. This
force law ensures that ghost nodes don’t exert forces on real nodes but real nodes
exert forces on ghost nodes.
Impose the boundary condition to the cell population object.
We also add a cell killer to the simulator. This object dictates under
what conditions cells die. For this test, we use a
,
which kills cells above a certain height (passed as an argument to the constructor).
To run the simulation, we call
. Please note that
in some cases the simulation could fail. The reason is that
cancer cells have a fast replication rate and this can cause
problems at the spatial level (managed by Chaste and not directly
by CoGNaC). In this case you can visualise the simulation until
the timestep which where the problem arise.
Release the memory.
This method associate a colour to each cell type in a differentiation tree,
marking the less probable to have the highest value (from the range [0,4]).
To visualize the results, we must first open Paraview. We open the folder containing our test output using the ‘file’ menu at
the top. The output will be located in
.
There will be a .vtu file generated for every timestep, which must all be opened at once to view the simulation. To do this,
simply select
. We should now see
in the pipeline browser. We click
in the properties tab
of the object inspector, and we should now see a visualization in the right hand window. (An alternative to opening the
file is to open all the time steps en masse where we open
and see
appear in the pipeline browser.)
At this stage, it will be necessary to refine how we wish to view this particular visualisation. The viewing styles can be edited using
the display tab of the object inspector. In particular, under
, the representation drop down menu allows us to view
the cells as a surface with edges, or as simply a wireframe. It is advisable at this point to familiarize ourselves with the different
viewing options, colour and size settings.
At this stage, the viewer is showing all cells in the simulation, including the ghost nodes. In order to view only real cells, we must
apply a threshold. This is achieved using the threshold button on the third toolbar (the icon is a cube with a green ‘T’ inside). Once you
click the threshold button, you will see a new threshold appear below your results in the pipeline browser. Go to the properties tab and
reset the lower threshold to be less than 0, and the upper threshold to be between 0 and 1, ensuring that the ‘Non-ghosts’ option is
selected in the ‘Scalars’ drop down menu. Once we have edited this, we click apply (we may need to click it twice), and the visualisation on the
right window will have changed to eliminate ghost nodes.
In order to view cells with different colours, we must click} in the drop down tab under