Tutorial: Making interactive CPMs in the browser with Artistoo

3. Migrating cell

Please open 3-ActCPM.html in a text editor and your browser. In the text editor, you should see similar functions as in the last example.

In the browser, you should see that this simulation contains a cell but that it is not actively moving. To add motility, we can add the Act-CPM term to the Hamiltonian via the ActivityConstraint. We now also need a PerimeterConstraint because otherwise, the forces on the cell may cause it to break.

Exercise
Similar to the previous exercise, adapt the setup() function to extend this model with a perimeter term and the Act-CPM in its Hamiltonian. Use: λP = 2, Ptarget = 260, λact = 500, maxact = 30, and a geometric mean for computing activities.

After your changes and refreshing the html page in the browser, you should see that this cell moves, but this visualization is not very insightful yet.

Exercise
See if you can adapt the draw() function to color the activity gradient in the cell.

(Hint: check out the "Method summary" in the Canvas API.)

You can compare your solution to that in 3-ActCPM-answer.html.

A note on random numbers

If you refresh the page a couple of times, you may notice that the cell starts in a different spot every time, but "evolves" in the exact same way. This is because the CPM C has its own random number generator (which uses a random seed), but the seedCell() function currently uses the standard Math.random() which does not use a random seed.

Optional exercise
Can you change seedCell() so that it also uses the CPM's random seed?

When you are done, click "Next" to make this simulation interactive.