Space-time maps & tracking colony size with OpenCV in Python

One of the things that the Department of Integrated Mathematical Oncology at the Moffitt Cancer Center is doing very well, is creating an atmosphere that combines mathematics and experiment in cancer. Fellow TheEGG blogger, Robert Vander Velde is one of the new generation of cancer researchers who are combining mathematics and experiment. Since I left Tampa, I’ve had less opportunity to keep up with the work at the IMO, but occasionally I catch up on Slack.

A couple of years ago, Robert had a computer science question. One at the data analysis and visualization stage of the relationship between computer science and cancer. Given that I haven’t posted code on TheEGG in a long time, I thought I’d share some visualizations I wrote to address Robert’s question.

There are many ways to measure the size of populations in biology. Given that we use it in our game assay, I’ve written a lot about using time-lapse microscopy of evolving populations. But this isn’t the only — or most popular — approach. It is much more common to dillute populations heavily and then count colony forming units (CFUs). I’ve discussed this briefly in the context of measuring stag-hunting bacteria.

But you can also combine both approaches. And do time-lapse microscopy of the colonies as they form.

A couple of years ago, Robert Vander Velde Andriy Marusyk were working on experiments that use colony forming units (CFUs) as a measure of populations. However, they wanted to dig deeper into the heterogeneous dynamics of CFUs by tracking the formation process through time-lapsed microscopy. Robert asked me if I could help out with a bit of the computer vision, so I wrote a Python script for them to identify and track individual colonies through time. I thought that the code might be useful to others — or me in the future — so I wanted to write a quick post explaining my approach.

This post ended up trapped in the drafts box of TheEGG for a while, but I thought now is as good a time as any to share it. I don’t know where Robert’s work on this has gone since, or if the space-time visualizations I developed were of any use. Maybe he can fill us in in the comments or with a new guest post.

Coarse-graining vs abstraction and building theory without a grounding

Back in September 2017, Sandy Anderson was tweeting about the mathematical oncology revolution. To which Noel Aherne replied with a thorny observation that “we have been curing cancers for decades with radiation without a full understanding of all the mechanisms”.

This lead to a wide-ranging discussion and clarification of what is meant by terms like mechanism. I had meant to blog about these conversations when they were happening, but the post fell through the cracks and into the long to-write list.

This week, to continue celebrating Rockne et al.’s 2019 Mathematical Oncology Roadmap, I want to revisit this thread.

And not just in cancer. Although my starting example will focus on VEGF and cancer.

I want to focus on a particular point that came up in my discussion with Paul Macklin: what is the difference between coarse-graining and abstraction? In the process, I will argue that if we want to build mechanistic models, we should aim not after explaining new unknown effects but rather focus on effects where we already have great predictive power from simple effective models.

Since Paul and I often have useful disagreements on twitter, hopefully writing about it on TheEGG will also prove useful.

Game landscapes: from fitness scalars to fitness functions

My biology writing focuses heavily on fitness landscapes and evolutionary games. On the surface, these might seem fundamentally different from each other, with their only common feature being that they are both about evolution. But there are many ways that we can interconnect these two approaches.

The most popular connection is to view these models as two different extremes in terms of time-scale.

When we are looking at evolution on short time-scales, we are primarily interested which of a limited number of extant variants will take over the population or how they’ll co-exist. We can take the effort to model the interactions of the different types with each other, and we summarize these interactions as games.

But when we zoom out to longer and longer timescales, the importance of these short term dynamics diminish. And we start to worry about how new types arise and take over the population. At this timescale, the details of the type interactions are not as important and we can just focus on the first-order: fitness. What starts to matter is how fitness of nearby mutants compares to each other, so that we can reason about long-term evolutionary trajectories. We summarize this as fitness landscapes.

From this perspective, the fitness landscapes are the more foundational concept. Games are the details that only matter in the short term.

But this isn’t the only perspective we can take. In my recent contribution with Peter Jeavons to Russell Rockne’s 2019 Mathematical Oncology Roadmap, I wanted to sketch a different perspective. In this post I want to sketch this alternative perspective and discuss how ‘game landscapes’ generalize the traditional view of fitness landscapes. In this way, the post can be viewed as my third entry on progressively more general views of fitness landscapes. The previous two were on generalizing the NK-model, and replacing scalar fitness by a probability distribution.

In this post, I will take this exploration of fitness landscapes a little further and finally connect to games. Nothing profound will be said, but maybe it will give another look at a well-known object.

Constant-sum games as a way from non-cell autonomous processes to constant tumour growth rate

A lot of thinking in cancer biology seems to be focused on cell-autonomous processes. This is the (overly) reductive view that key properties of cells, such as fitness, are intrinsic to the cells themselves and not a function of their interaction with other cells in the tumour. As far as starting points go, this is reasonable. But in many cases, we can start to go beyond this cell-autonomous starting point and consider non-cell-autonomous processes. This is when the key properties of a cell are not a function of just that cell but also its interaction partners. As an evolutionary game theorist, I am clearly partial to this view.

Recently, I was reading yet another preprint that has observed non-cell autonomous fitness in tumours. In this case, Johnson et al. (2019) spotted the Allee effect in the growth kinetics of cancer cells even at extremely low densities (seeding in vitro at <200 cells in a 1 mm^3 well). This is an interesting paper, and although not explicitly game-theoretic in its approach, I think it is worth reading for evolutionary game theorists.

Johnson et al.'s (2019) approach is not explicitly game-theoretic because they consider their in vitro populations as a monomorphic clonal line, and thus don't model interactions between types. Instead, they attribute non-cell autonomous processes to density dependence of the single type on itself. In this setting, they reasonably define the cell-autonomous null-model as constant exponential growth, i.e. $\dot{N}_T = w_TN_T$ for some constant fitness $w_T$ and total tumour size $N_T$.

It might also be tempting to use the same model to capture cell-autonomous growth in game-theoretic models. But this would be mistaken. For this is only effectively cell-autonomous at the level of the whole tumour, but could hide non-cell-autonomous fitness at the level of the different types that make up the tumour. This apparent cell-autonomous total growth will happen whenever the type interactions are described by constant-sum games.

Given the importance of constant-sum games (more famously known as zero-sum games) to the classical game theory literature, I thought that I would write a quick introductory post about this correspondence between non-cell autonomous constant-sum games and effectively cell-autonomous growth at the level of the whole tumour.

Quick introduction: Evolutionary game assay in Python

It’s been a while since I’ve shared or discussed code on TheEGG. So to avoid always being too vague and theoretical, I want to use this post to explain how one would write some Python code to measure evolutionary games. This will be an annotated sketch of the game assay from our recent work on measuring evolutionary games in non-small cell lung cancer (Kaznatcheev et al., 2019).

The motivation for this post came about a month ago when Nathan Farrokhian was asking for some advice on how to repeat our game assay with a new experimental system. He has since done so (I think) by measuring the game between Gefitinib-sensitive and Gefitinib-resistant cell types. And I thought it would make a nice post in the quick introductions series.

Of course, the details of the system don’t matter. As long as you have an array of growth rates (call them yR and yG with corresponding errors yR_e and yG_e) and initial proportions of cell types (call them xR and xG) then you could repeat the assay. To see how to get to this array from more primitive measurements, see my old post on population dynamics from time-lapse microscopy. It also has Python code for your enjoyment.

In this post, I’ll go through the two final steps of the game assay. First, I’ll show how to fit and visualize fitness functions (Figure 3 in Kaznatcheev et al., 2019). Second, I’ll transform those fitness functions into game points and plot (Figure 4b in Kaznatcheev et al., 2019). I’ll save discussions of the non-linear game assay (see Appendix F in Kaznatcheev et al., 2019) for a future post.

Abstracting evolutionary games in cancer

As you can tell from browsing the mathematical oncology posts on TheEGG, somatic evolution is now recognized as a central force in the initiation, progression, treatment, and management of cancer. This has opened a new front in the proverbial war on cancer: focusing on the ecology and evolutionary biology of cancer. On this new front, we are starting to deploy new kinds of mathematical machinery like fitness landscapes and evolutionary games.

Recently, together with Peter Jeavons, I wrote a couple of thousand words on this new machinery for Russell Rockne’s upcoming mathematical oncology roadmap. Our central argument being — to continue the war metaphor — that with new machinery, we need new tactics.

Biologist often aim for reductive explanations, and mathematical modelers have tended to encourage this tactic by searching for mechanistic models. This is important work. But we also need to consider other tactics. Most notable, we need to look at the role that abstraction — both theoretical and empirical abstraction — can play in modeling and thinking about cancer.

The easiest way to share my vision for how we should approach this new tactic would be to throw a preprint up on BioRxiv or to wait for Rockne’s road map to eventually see print. Unfortunately, BioRxiv has a policy against views-like articles — as I was surprised to discover. And I am too impatient to wait for the eventual giant roadmap article.

Hence, I want to share some central parts in this blog post. This is basically an edited and slightly more focused version of our roadmap. Since, so far, game theory models have had more direct impact in oncology than fitness landscapes, I’ve focused this post exclusively on games.

Cataloging a year of blogging: cancer and fitness landscapes

Happy 2019!

As we leave 2018, the Theory, Evolution, and Games Group Blog enters its 9th calendar year. This past year started out slowly with only 4 posts in the first 5 months. However, after May 31st, I managed to maintain a regular posting schedule. This is the 32nd calendar week in a row with at least one new blog post released.

A total of 38 posts appeared on TheEGG last year. This is the 3rd most prolific year after the 47 in 2014 and 88 in 2013. One of those being a review of the 12 posts of 2017 (the least prolific year for TheEGG).

But the other 37 posts are too much to cover in one review. Thus, in this catalogue, I’ll focus on cancer and fitness landscapes. Next week, I’ll deal with the more philosophical content from the last year.

Local peaks and clinical resistance at negative cost

Last week, I expanded on Rob Noble’s warning about the different meanings of de novo resistance with a general discussion on the meaning of resistance in a biological vs clinical setting. In that post, I suggested that clinicians are much more comfortable than biologists with resistance without cost, or more radically: with negative cost. But I made no argument — especially no reductive argument that could potentially sway a biologist — about why we should entertain the clinician’s perspective. I want to provide a sketch for such an argument in this post.

In particular, I want to present a theoretical and extremely simple fitness landscape on which a hypothetical tumour might be evolving. The key feature of this landscape is a low local peak blocking the path to a higher local peak — a (partial) ultimate constraint on evolution. I will then consider two imaginary treatments on this landscape, one that I find to be more similar to a global chemotherapy and one that is meant to capture the essence of a targetted therapy. In the process, I will get to introduce the idea of therapy transformations to a landscape — something to address the tendency of people treating treatment fitness landscapes as completely unrelated to untreated fitness landscapes.

Of course, these hypothetical landscapes are chosen as toy models where we can have resistance emerge with a ‘negative’ cost. It is an empirical question to determine if any of this heuristic capture some important feature of real cancer landscapes.

But we won’t know until we start looking.

Causes and costs in biological vs clinical resistance

This Wednesday, on These few lines, Rob Noble warned of the two different ways in which the term de novo resistance is used by biologists and clinicians. The biologist sees de novo resistance as new genetic resistance arising after treatment has started. The clinician sees de novo resistance as a tumour that is not responsive to treatment from the start. To make matters even more confusing, Hitesh Mistry points to a further interpretation among pharmocologists: they refer to the tumour remaining after a partial but incomplete response to treatment as de novo resistant. Clearly this is a mess!

But I think this is an informative mess. I don’t think it is a matter of people accidentally overloading the same word. Instead, I think it reflects a conceptual difference in how biologists and clinicians think about resistance. A difference that is a bit akin to the difference between reductive and effective theories. It is also a difference that I had to deal with during the revisions of our recent work on measuring the games played by treatment sensitive and treatment resistance non-small cell lung cancer (Kaznatcheev et al., 2018).

The wei wu wei of evolutionary oncology

The world was disordered, rains would come and the rivers would flood. No one knew when. When it rained, plants would grow, but no one knew which were fit to eat and which were poisonous. Sickness was rife. Life was precarious.

The philosopher-king Yu dredged the rivers, cleaned them so they would flow into the sea. Only then were the people of the Middle Kingdom able to grow the five grains to obtain food.

Generations later, Bai Gui — the prime minister of Wei — boasted to Mengzi: “my management of the water is superior to that of Yu.”

Mengzi responded: “You are wrong. Yu’s method was based on the way of the water. It is why Yu used the four seas as receptacles. But you are using the neighbouring states as receptacles. When water goes contrary to its course, we call if overflowing. Overflowing means flooding water, something that a humane man detests… As for Yu moving the waters, he moved them without interference.”

Although Yu made changes to the environment by digging channels, he did so after understanding how the water flowed and moved naturally. He did so with knowledge of the Way. Yu’s management of water was superior to Bai Gui’s because Yu’s approach was in accordance with the Way. This is what evolutionary oncology seeks to achieve with cancer treatment. By understanding how the dynamics of somatic evolution drive tumour growth, we hope to change the selective pressures in accordance with this knowledge to manage or cure the disease.