Chemotaxis

From Biocellion
Revision as of 05:03, 16 December 2016 by DJ (talk | contribs)

Jump to: navigation, search

This tutorial will guide you through the steps of adding a chemotactic force to the cells in your simulation. Existing requirements for chemotaxis include a population of agents, a diffusing chemical field to spread a chemoattractant, and a method of adding/changing chemoattractant concentrations throughout the field (such as secretion and decay). The agents will move along the chemical gradient toward the chemoattractant.

This page focuses on the approach and implementation specific to the chemotactic force, which samples the chemical field for its chemoattractant concentrations.

Method

In this example, a simple method is used to calculate the chemotactic force on a particle which responds to a chemoattractant , as follows:

  1. Create a random unit vector , as a potential chemotactic force acting on .
  2. In the direction of , sample ahead of , as , and behind , as .
  3. Calculate the chemotactic force using:
  4. If , then apply the force as:

Here, is a constant scaling parameter that represents the strength of the chemotactic force along the chemical gradient. In code, this parameter will be defined as a global constant value.

Implementation

The following code implements the method described above. The code is broken into individual snippets in order to illustrate the steps, but the code may be viewed in whole here. This code is part of the ModelRoutine::adjustSpAgent() method within model_routine_agent.cpp.


Calculate a random, normalized forward vector, and a backward vector in the opposite direction. In code, fwdDir represents , and bckDir represents .

/* forward and backward direction vectors */
VReal fwdDir;
VReal bckDir;
REAL mag = 0.0;

/* calculate a random forward vector, and its magnitude */
for (S32 dim = 0; dim < DIMENSION; dim++) {
  fwdDir[dim] = -0.5 + Util::getModelRand(MODEL_RNG_UNIFORM);
  mag += fwdDir[dim] * fwdDir[dim];
}
mag = sqrt(mag);

/* normalize the forward vector, and set the backward vector */
for (S32 dim = 0; dim < DIMENSION; dim++) {
  fwdDir[dim] /= mag; // normalize
  bckDir[dim] = -fwdDir[dim];
}


Determine which two neighbor boxes (of the 26 neighbors) intersect with the forward and backward vectors, and then read the forward and backward chemoattractant values. In code, fwdVal represents , and bckVal represents .

/* find the nearest neighbor interface (x, y, or z) in both the
   forward and backward directions (using a separate function) */
S32 fwdInt = findNearestInterface(vOffset, fwdDir);
S32 bckInt = findNearestInterface(vOffset, bckDir);

/* calculate the offset ([-1,0,1] in all dimensions) for each of the two neighbors */
VIdx fwdOffset;
VIdx bckOffset;
for (S32 dim = 0; dim < DIMENSION; dim++) {
  fwdOffset[dim] = dim == fwdInt ? (fwdDir[fwdInt] > 0 ? 1 : -1) : 0;
  bckOffset[dim] = dim == bckInt ? (bckDir[bckInt] > 0 ? 1 : -1) : 0;
}

/* read the chemoattractant values from each of the two neighbors */
NbrBox<REAL> nbr = v_gridPhiNbrBox[DIFFUSIBLE_ELEM_CHEMOATTRACTANT];
REAL fwdVal = 0.0;
REAL bckVal = 0.0;
if (nbr.getValidFlag(fwdOffset)) {
  fwdVal = nbr.getVal(fwdOffset);
}
if (nbr.getValidFlag(bckOffset)) {
  bckVal = nbr.getVal(bckOffset);
}


Calculate the chemotactic force, apply it (if it's positive), and finally limit the force if it would move the particle more than the width of a single box. In code, chemForce represents , and A_CELL_CHEMOTAXIS_FORCE_STRENGTH represents .

/* calculate the chemotactic force, and apply it if positive */
disp = mechIntrctData.force;
REAL chemForce = A_CELL_CHEMOTAXIS_FORCE_STRENGTH[state.getType()] * (fwdVal - bckVal);
if (chemForce > 0) {
  for (S32 dim = 0; dim < DIMENSION; dim++) {
    disp[dim] += fwdDir[dim] * chemForce;
  }
}

/* limit the maximum displacement within a single time step */
for( S32 dim = 0 ; dim < DIMENSION ; dim++ ) {
  if( disp[dim] > IF_GRID_SPACING ) {
    disp[dim] = IF_GRID_SPACING;
  }
  else if( disp[dim] < ( IF_GRID_SPACING * -1.0 ) ) {
    disp[dim] = IF_GRID_SPACING * -1.0;
  }
}

Steps

A reference implementation of the following steps (including the prerequisite steps) can be found here.

Prerequisites

  1. Supply a population of agents which will exhibit chemotactic forces (and possibly other biomechanical forces). See the ModelRoutine::addSpAgents() method within model_routine_agent.cpp.
  2. Introduce a chemical field that allows for the diffusing and decay of a chemoattractant. See the methods within model_routine_grid.cpp.
  3. Provide a method to allow for production of a chemoattractant within the field, such as cell secretion. See the ModelRoutine::updateIfGridVar() method within model_routine_grid.cpp.

Chemotaxis

  1. Parameters
  2. adjustSpAgent