Run and Tumble

Introduction

This example models a single cell that moves according to a Lévy walk: a random walk with occassional occurrence of long straight walks.

Modeling cell movements as a Lévy walk.

Model description

The model defines a CPM cell that has two properties:

  • A PropertyVector that gives the direction of movement and
  • a Property that defines the time when this direction of movement is changed.

The change in direction is using a VectorRule. In this case, it specifies a new random direction for each of the three $x$, $y$, $z$ coordinates separately: move_dir = sin(angle), cos(angle), 0 where angle = rand_uni(0, 2*pi).

This is calculated with an Event. Upon triggering, this sets the new direction and a waiting time until the next change of direction. To model a superdiffusive Lévy walk, this waiting time is chosen from an exponential distribution: change_time = time + 20 * rand_gamma(0.5, 5).

Finally, the cell is made to move in the chosen direction using DirectedMotion that takes the PropertyVector as input.

Model

In Morpheus GUI: Examples 🠒 CPM 🠒 RunAndTumble.xml.

<?xml version='1.0' encoding='UTF-8'?>
<MorpheusModel version="4">
    <Description>
        <Title>Example-RunAndTumble</Title>
        <Details>Models a Levy walk - a random walk strategy that is superior for searching due to it's high spatial coverage.

Shows how to manipulate PropertyVectors (x,z,y) using the VectorRule. An expression for each of the three coordinates must be given, separated by a comma ",".</Details>
    </Description>
    <Global>
        <Constant symbol="tumble.run_duration" value="0"/>
    </Global>
    <Space>
        <Lattice class="hexagonal">
            <Size symbol="size" value="300 300 0"/>
            <Neighborhood>
                <Order>1</Order>
            </Neighborhood>
            <BoundaryConditions>
                <Condition boundary="x" type="periodic"/>
                <Condition boundary="y" type="periodic"/>
            </BoundaryConditions>
        </Lattice>
        <SpaceSymbol symbol="space"/>
    </Space>
    <Time>
        <StartTime value="0"/>
        <StopTime value="10000"/>
        <TimeSymbol symbol="time"/>
    </Time>
    <CellTypes>
        <CellType class="biological" name="amoeba">
            <VolumeConstraint target="200" strength="1"/>
            <ConnectivityConstraint/>
            <PropertyVector symbol="move_dir" value="0.0, 0.0, 0.0"/>
            <Property symbol="tumble.run_duration" value="0.0" name="run duration"/>
            <Property symbol="tumble.last" value="0" name="last tumble event"/>
            <Function symbol="tumble.time_left" name="time left">
                <Expression>tumble.last + tumble.run_duration - time</Expression>
            </Function>
            <DirectedMotion direction="move_dir" strength="0.2"/>
            <Event trigger="when true" time-step="5">
                <Condition>time >= tumble.last + tumble.run_duration</Condition>
                <Rule symbol-ref="tumble.last">
                    <Expression>time</Expression>
                </Rule>
                <Rule symbol-ref="tumble.run_duration" name="new update time">
                    <Expression>20 * rand_gamma(0.5, 5)</Expression>
                </Rule>
                <Intermediate symbol="angle" value="rand_uni(0, 2*pi)"/>
                <VectorRule symbol-ref="move_dir" spherical="true">
                    <Expression>angle, 0 , 1</Expression>
                </VectorRule>
            </Event>
        </CellType>
        <CellType class="medium" name="medium"/>
    </CellTypes>
    <CPM>
        <Interaction>
            <Contact type1="amoeba" type2="medium" value="4"/>
        </Interaction>
        <MonteCarloSampler stepper="edgelist">
            <MCSDuration value="1"/>
            <Neighborhood>
                <Order>1</Order>
            </Neighborhood>
            <MetropolisKinetics temperature="0.6"/>
        </MonteCarloSampler>
        <ShapeSurface scaling="norm">
            <Neighborhood>
                <Distance>2.5</Distance>
            </Neighborhood>
        </ShapeSurface>
    </CPM>
    <CellPopulations>
        <Population size="1" type="amoeba">
            <Cell id="1" name="1">
                <Nodes>50,100,0</Nodes>
            </Cell>
        </Population>
    </CellPopulations>
    <Analysis>
        <Gnuplotter time-step="200" decorate="false">
            <Terminal name="png"/>
            <Plot>
                <Cells min="0.0">
                    <ColorMap>
                        <Color value="0" color="red"/>
                        <Color value="2" color="blue"/>
                    </ColorMap>
                </Cells>
                <CellArrows orientation="5 * move_dir"/>
            </Plot>
        </Gnuplotter>
        <Logger time-step="20">
            <Input>
                <Symbol symbol-ref="cell.center.x"/>
                <Symbol symbol-ref="cell.center.y"/>
            </Input>
            <Output>
                <TextOutput/>
            </Output>
            <Plots>
                <Plot time-step="5000">
                    <Style style="lines" line-width="2.0"/>
                    <Terminal terminal="png"/>
                    <X-axis>
                        <Symbol symbol-ref="cell.center.x"/>
                    </X-axis>
                    <Y-axis>
                        <Symbol symbol-ref="cell.center.y"/>
                    </Y-axis>
                    <Color-bar>
                        <Symbol symbol-ref="tumble.run_duration"/>
                    </Color-bar>
                </Plot>
            </Plots>
        </Logger>
    </Analysis>
</MorpheusModel>

Previous
Next