This tutorial is automatically generated from TestScratchAssayTutorial at revision 98e266d4.
Note that the code is given in full at the bottom of the page.
This tutorial is an example of modelling a scratch assay using a simple cellular automaton
representation of cells. It will cover the following techniques:
Setting up a regular mesh (or lattice)
Visualizing the mesh
Working with file-based output
Generating cells and adding them to the mesh
Simulating cell migration on the mesh
Real-time visualization of the cell population and plotting of population statistics
In this test we will create a scratch along the middle of a domain and quantify the migration
of cells into the region. Cells will migrate by random walk on the their regular mesh (lattice).
Chaste is based on the concept of Cells and Meshes. ‘Cells’ do not store their position in space,
or connectivity, these are managed by a Mesh. The first step in most Chaste simulations is to
set up a mesh, on which we can locate cells. A collection of Cells and a Mesh are a CellPopulation
in Chaste terminology. The most simple CellPopulation is the CaBasedCellPopulation which corresponds
to cells occupying discrete locations on a regular mesh (lattice). Our first step is to set up the mesh.
Here we set up a 2D lattice.
Note that we are using a PottsMeshGenerator2 to set up the grid and we are setting some terms to 0. Chaste
design is based on re-use of components, the PottsMeshGenerator can be used to set up other types of
cell population which require these extra terms. Note also the ‘2’ at the end of the class name. This
tells us that we are working in 2D. Most Chaste classes are specialized (templated) for spatial dimension,
so we need to make sure we are consistent in the dimensionality of the classes we are using.
Next we set up some cells. We create and empty container VectorSharedPtrCell (which will behave like a Python list)
and will fill it with cells of our chosen type. In Chaste cells can be assinged a number of proliferative types
(Default, Differentiated, Stem, Transit or User Defined). These types will define how cells behave in certain
simulations, for example whether they will proliferate. We just want our cells to migrate in this example, so
we set a DifferentiatedCellProliferativeType.
We are not interested in cell cycling so we specialize the generator to NoCellCycleModel.
We want two sets of cells, starting on opposite sides of the mesh. We use location_indices to map cells onto
locations (or Nodes) on the mesh. For our regular mesh the Node indices increase fastest in x, then y. We will
add four layers of cells to each side of the mesh.
Now we have a mesh and a set of cells to go with it, we can create a CellPopulation.
Next, we set up an OffLatticeSimulation which will manage the solver. We need to add some custom rules to
this solver to specify how we want the cells to migrate.
We must now create a rule for cell migration. We will use an existing diffusion type rule.
PyChaste can do simple 3D rendering with VTK. We set up a VtkScene so that we can see the population
evovle in real time.
We add the scene to the simulation for real-time updating using a VtkSceneModifier. Such
modifiers are called by the simulator at regular periods during the main time loop and
have access to the cell population. We will use a similar idea in a moment to record cell
positions for real time plotting.
Chaste and PyChaste use object oriented programming. This may require some background reading,
but allows for great flexibility in terms of modifying existing functionality. In
order to pull the data we want out of the simulation as it runs we will create our own
simulation modifier class and use it for real time plotting. This Python class over-rides
one of the built-in classes, giving us access to the quantities we want during the simulation.
Usually we would define such a class in a different module and import it, it is placed
here for the purposes of the tutorial.
To run the simulation, we call Solve() and optionally set up interactive plotting. We will see the cells
migrate and the population distribution gradually become more uniform.