Exercise PDF

Spatiotemporal Modeling and Simulation
Summer 2015
Prof. Dr. I. F. Sbalzarini
TU Dresden & MPICBG,
D-01307 Dresden
Exercise 5
Release: 26.05.2015
Due: 02.06.2015
The following exercises will be mostly implementation of data structures that are useful
for upcoming exercises. Therefore, choose now a programming language that suits you
best and stick to it through the rest of the course (I suggest Matlab). Write the code in a
modular, re-usable manner.
Question 1: Cell and Verlet Lists
In the lecture you have been introduced to particle methods and their fundamental difference to ”classical” numerical methods like Finite Differences and Finite Volumes. One
key prerequisite to evaluate Particle-Particle (PP) interactions efficiently is obviously fast
access to neighboring particles for each particle. Two data structures are presented in the
script on pp. 35–36: Cell lists and Verlet lists.
a) Implement first a routine that creates cell lists from a set of particles in 1D/2D without
symmetry. The function could read like this:
%%%%%%%%%%%%%%%%%%%%%%%%
% Code f o r E x e r c i s e 5 − C r e a t i o n o f c e l l l i s t s
%%%%%%%%%%%%%%%%%%%%%%%%
% Input
% p a r t i c l e P o s : ( n u m P a r t i c l e s x dim)−Matrix o f p a r t i c l e p o s i t i o n s
% lBounds :
S c a l a r l o w e r bound on a l l p a r t i c l e p o s i t i o n s
% uBounds :
S c a l a r upper bound on a l l p a r t i c l e p o s i t i o n s
% cellSide :
S c a l a r v a l u e o f th e c e l l ’ s s i d e l e n g t h
%
% Output
% p a r t i c l e M a t : ( n u m P a r t i c l e s x dim+1)−Matrix t h a t c o n t a i n s t h e
% p a r t i c l e p o s i t i o n s and th e c e l l i n d e x i t b e l o n g s t o
% cellList :
Matlab c e l l s t r u c t u r e o f l e n g t h number o f o v e r a l l
% c e l l s ( prod ( numCells ) )
% numCells :
( dim x 1)− Vector t h a t c o n t a i n s t he number o f c e l l s
% p e r dimension
f u n c t i o n [ p a r t i c l e M a t , c e l l L i s t , numCells ] =
c r e a t e C e l l L i s t ( p a r t i c l e P o s , lBounds , uBounds , c e l l S i d e )
1
Each cell should get a unique integer ID. Use the built-in functions sub2ind and ind2sub
for this unique assignment. The output matrix particleMat consists of the particle
positions and the ID of the cell it is contained in. The cell list should be an Octave cell
data type where each element is a vector of arbitrary length.
b) Given your cell list implementation, it is now possible to tackle Verlet lists. Implement
a routine that creates Verlet lists for particle distributions in 1D/2D. The function
should read like this:
%%%%%%%%%%%%%%%%%%%%%%%%
% Code f o r E x e r c i s e 5 − C r e a t i o n o f V e r l e t l i s t s without symmetry
%%%%%%%%%%%%%%%%%%%%%%%%
% Input
% p a r t i c l e M a t : ( n u m P a r t i c l e s x dim+1)−Matrix o f p a r t i c l e p o s i t i o n s
%
and c e l l i n d e x
% cellList :
Matlab c e l l s t r u c t u r e o f l e n g t h prod ( numCells )
%
( number o f c e l l s )
% numCells :
( dim x 1)− Vector t h a t c o n t a i n s t he number o f c e l l s
%
pe r dimension
%
% cutoff :
Scalar distance c u t o f f that d e f i n e s
%
th e neighborhood . I t s h o u l d be
%
e q u i v a l e n t t o t he s i d e l e n g t h o f a c e l l
%
% Output
% verletList :
Matlab c e l l s t r u c t u r e o f l e n g t h n u m P a r t i c l e s .
%Each element c o n t a i n s t h e i n d i c e s o f th e p a r t i c l e s ,
%i . e . th e row numbers i n t h e p a r t i c l e M a t matrix
%
function verletList =
c r e a t e V e r l e t L i s t ( p a r t i c l e M a t , c e l l L i s t , numCells , c u t o f f )
The cutoff input argument should be equivalent to the cell side length that has been
used to create the cell list. The output Verlet list should be a Matlab cell data type
where each element is a vector of arbitrary length.
c) The next task is dedicated to visually verifying your implementation. Write a program
that creates 10,000 particles in 2D uniformly at random in the unit box. Create a cell
list and a Verlet list with cell side length (cutoff) 0.05. Create a figure and plot all
particles in blue. Choose a random cell index and color all particles that are contained
in this cell in green. Color the particles in adjacent cells in yellow. Pick a random
particle of the randomly chosen cell and color its Verlet neighbors in red.
2
Question 2: Neighbor lists and Quorum Sensing
The phenomenon of Quorum (= critical density) sensing (QS) is a type of decision-making
process used by many bacteria. Bacteria use QS to coordinate certain behaviors based on
the local density of the bacterial population. The luminescence of the bacterium Vibrio
fischeri (see Fig. 2) that lives in symbiosis with deep-sea animals (e.g. squids) is probably
the most striking example of QS.
PERSPECTIVES
such as a cocktail of hydrolytic enzymes
positive feedback of
than QS and DS. Interestingly, the function
for the breakdown of polymeric organic
shelters communica
of positive feedback might be to speed up
material, but only one type of autoinducer
(BOX 1). The fewer an
the upregulation of cells in the vicinity or
might suffice.
are, the more they w
at the periphery
of a cluster,
enabling a
• Find molecule
a parameter
setting where all the previous
points
are fulfilled.
The ES concept combines a unifying
ence from other aut
synchronized response, even for irregularly
autoinducer-degrad
hypothesis of what cells measure (cell
located cells.
For simplicity
one
can startproperties
the simulation
0nM
concentration
ofoften
AHL everywhere
and other eukaryote
density,
mass-transfer
and spatial with
Note
that autoinducer
sensing is
except inside
the activated
cells. hypothesis
potential for cross-t
distribution)
with a unifying
connected with switching from one life
of overlapping sets o
of why they measure it (to estimate the
strategy to another (for example, from
rhizosphere35–38,40–44
efficiency of producing extracellular effecnon-virulent to virulent), which involves
distribution of strai
tors and react accordingly). This function of the autoinducer simultaneously upregulat1.2 Spatial
patterns
opportunities for cr
ES does not, on purpose, stipulate that the
ing one set of genes and downregulating
the extent that biofi
extracellular effectors are produced coopanother86. Some of these genes might be
Given a chosen
parameterization
one the
cancase
start involved
the simulation
with and
thetherefore
different
AHL as bu
in effector release
ES, initial
microcolonies
eratively
because this is not always
Figure 1: Microscopy
image
of
glowing
V. fischeri
colony.
whereas others
might not.
Therefore,
theis 0nM
holds
true for biofil
(cellsinside
could
be
alone
yet a
produce
concentration
and
outside
theautoinduccells. A reasonable
choice
to start
with
outside
ity or other forms o
ers and effectors). Nevertheless, cooperative expression of genes that are not involved in
the cell, 75nM
for activated cells (over the threshold!),
and 25nM for all non-activated
cells
effector release can indirectly depend on ES
can spread motile st
and coordinated production of effectors
threshold!).
certain
computational
domain
play e.g. witharound
different
because
of their
coupled
regulation.
and over no
emerges linked
in manyChoose
situations
which density
neighV. fischeri’s ability to (below
glow isthe
directly
to theainlocal
of neighbors.
Ifand
a bacterium
bringing them into
bours with the
same
autoinducer system
spatial
distributions
of
cells:
senses a critical number of neighbors
around itself, it starts glowing.
Using this coupling,
Clonal microcolo
Microcolonies — avoiding problems
are present. ES therefore encompasses
the bacterium ensures that the cooperative
host provides
enough situafood for Microcolonies
the colony.are clusters of cells. In soil
interference but also
and non-cooperative
• Uniform
distribution
of that
cells
a many
certain
of cooperation by av
otherdensity
habitats in which bacteria
tions.spatial
The evolutionary
hypothesis
ES withand
Imagine now that you have given
the
exact
positions
of 5,000
bacterialattached
cells tobut
you interest, as discusse
grow predominantly
surfaces,
evolved
because
of the2D
direct
fitness benefits
• Inhomogeneous
(spatially
clustered)
with
a certain
stable spatial structu
typically
arise be
fromdensity
the find
of optimized effector
production
the distribution
don’t know whether a given
bacterium
is
glowing
orfornot.
A these
firstclusters
guess
could
to
als in a microcolony
growth and cell division of a progenitor
individual and because of group benefits of
areas with high density of
bacteria.
In effector
these
areas, also
theencombacteria
will
most
likely essentially
glow. In interactions are with
2); they
are therefore
cell (FIG.
cooperative
production
• Different
degrees
of inhomogeneous
distribution
The more the cells areshows
clustered to planktonic bacter
passes
QS and DSthis
concepts.
As direct
an approximate manner, we can
achieve
with
cell and
lists. clonal
Fig.45,87–89
2 . schematically
together
the sooner
the threshold for induc- mixing promotes co
group
benefits
work
in
the
same
direction,
•
Different
densities,
initial
conditions
and
boundary
conditions
this approach. An exact approach
usesevolve
Verlet
each bacterium,
one together
can efficiently
tion is reached. This,
with the usual fact the very reason
ES would
underlists.
broader For
conditions
diversity of bacteria
determine the number of neighbors it has.
growth
therefore pr
a Random
b Clustered
between clusters an
such as interference
est. Ironically, altho
sensing has been stu
mixed liquid cultur
studied could not h
conditions — DS be
sense in bulk liquid
evolutionarily stable
cheaters are mixed.
Conclusions and f
QS proposes that ce
ing to measure their
poses that they mea
Figure 4 | Spatial distribution and cell density. Both panels contain 100 cells in a domain of the
same size, so the cell density is the same. a | A random spatial distribution of cells (random numbers properties of their e
Figure
1:cell
Different
QSin which
cell (dots).
distributions
(taken
[1]).
frombacterial
a uniform
probability
distribution,
all positions The
are equally
likely),from
is shown.
that we have shown that
Figure 2: Schematic view of the
population
bacterium
inNotethe
positioning cells randomly will result in some clusters, which are probably not clonal. This situation of autoinducer-prod
shaded cell, e.g., is isolated andcould
willrepresent
probably
not
glow.
a snapshot
of a mixed
liquid culture or cells that disperse after cell division. b | Shows cells can have a stro
distribution
of clusters that
have beenIf
growing
exponentially
at a uniform
rate forof
a randomly
autoinducer concen
Report youra random
results
in a concise
manner.
possible,
produce
movies
your simulations.
chosen time interval (limited to four divisions or 16 cells). Within each cluster, the cells are located experiences than th
Comment
on
the
example
they
give
in
Box
1
in
[1].
Is
it
possible
to
re-cover
their
results
a) We have prepared a text filerandomly
QSBacterialPos.dat
that
the represent
2D positions
offounded
5,000by we have
in a box of 5% of the domain size.
Thisstores
situation could
microcolonies
shown that
single
cells in random locations and at random times. Now consider replacing population-scale cell autoinducer sensing
(see
Figure
2)?
bacteria in the [0,10] box into
a
matrix
particlePos.
Write
a
script
(e.g.
QS
detect.m
in
density (the density of cells in liquid culture or in a biofilm) by cellular-scale cell density, defined over in autoinducer prod
(b). of
As a
a small file.
reference
volume,
such as
the volume
elements
demarcated
by the grid
(a) and
MATLAB) that loads the data
Use
a cell
side
length
of 0.5
to create
a incell
list
upregulation of cell
consequence, such a small-scale density, for example, the density of 1 cell per unit volume in the green
box in (a), does not account for the presence or absence of cells in the neighbouring volume elements, their vicinity.
As the three key
which clearly affect the
3autoinducer concentration in the focal volume element (BOX 1). Even within
a cluster, the peripheral cells sense a different autoinducer concentration than the central cells. autoinducer concen
Therefore, autoinducer sensing in clustered cells cannot be simplified as the measurement of cell mass-transfer prope
density on the small scale of the cluster volume.
tribution of cells) ca
the bacterial positions. Find all cell indices that contain at least a critical density of 80
(20 bacteria/cell). Plot all bacteria in blue, and color the bacteria in the high-density
cells in red.
Create a Verlet list using the constructed cell list and a cutoff of 0.5. Find all bacteria
that have at least 50 neighbors within the cutoff. Create a new figure and plot again
all bacteria and mark the high-density bacteria red. Compare the two plots. Report
also the bacteria that have the most neighbors within the prescribed cutoff. How many
neighbors do they have?
b) (Optional) Enhance the Verlet list code using intermediate cell lists and symmetry in
3D.
4