Skip to main content
Bioinformatics logoLink to Bioinformatics
. 2020 Dec 16;36(22-23):5542–5544. doi: 10.1093/bioinformatics/btaa1025

IsoMaTrix: a framework to visualize the isoclines of matrix games and quantify uncertainty in structured populations

Jeffrey West btaa1025-aff1,, Yongqian Ma btaa1025-aff2, Artem Kaznatcheev btaa1025-aff3,btaa1025-aff4, Alexander R A Anderson btaa1025-aff1
Editor: Russell Schwartz
PMCID: PMC8016459  PMID: 33325501

Abstract

Summary

Evolutionary game theory describes frequency-dependent selection for fixed, heritable strategies in a population of competing individuals using a payoff matrix. We present a software package to aid in the construction, analysis and visualization of three-strategy matrix games. The IsoMaTrix package computes the isoclines (lines of zero growth) of matrix games, and facilitates direct comparison of well-mixed dynamics to structured populations on a lattice grid. IsoMaTrix computes fixed points, phase flow, trajectories, (sub)velocities and uncertainty quantification for stochastic effects in spatial matrix games. We describe a result obtained via IsoMaTrix’s spatial games functionality, which shows that the timing of competitive release in a cancer model (under continuous treatment) critically depends on the initial spatial configuration of the tumor.

Availability and implementation

The code is available at: https://github.com/mathonco/isomatrix.

Supplementary information

Supplementary data are available at Bioinformatics online.

1 Introduction

Interactions between competing individuals which result in some benefit or cost can broadly be described and analyzed using game theory. Game theory aims to mathematically determine the optimal strategy to employ when in competition with an adversary (Neumann and Morgenstern, 1947). The typical ingredients of a game are (i) the strategies, (ii) the players and (iii) the payoffs of each strategy (Hofbauer and Sigmund, 1998). This classical definition of game theory can be extended to model evolution by natural selection, known as evolutionary game theory (EGT; Maynard Smith, 1986). Most often, EGT is used to describe changes in the prevalence of strategies due to frequency-dependent selection in a population of competing players that adhere to fixed strategies [but see (Kaznatcheev, 2017) for an alternative experiment-focused interpretation of the basic ingredients of EGT]. In a typical setting, competition is governed by a ‘payoff matrix,’ defining the Darwinian fitness of an individual based upon pairwise interactions with other individuals within the population.

EGT is increasingly used to model cancer as an evolutionary process (Archetti and Pienta, 2019; Staňková et al., 2019), and viewed as one of the central paths forward in the roadmap of mathematical oncology (Rockne et al., 2019). EGT models have shown success in modeling glioma progression (Basanta et al., 2008), growth factor production as a public good (Archetti, 2013), effects of tissue edges on cancer cell motility (Kaznatcheev et al., 2015), vascularization and tumor acidity (Kaznatcheev et al., 2017), metastatic prostate cancer and the bone-remodeling cycle (Warman et al., 2018), competitive release (West et al., 2018) and optimal cancer treatment (Gluzman et al., 2020; West et al., 2020). Recently, the payoff matrices that specify evolutionary games have even been directly measured in vitro (Kaznatcheev et al., 2019).

To help mathematical oncologists along the path of EGT modeling, we develop a software package, IsoMaTrix, to systematically analyze three-strategy matrix games. The package places a special focus on boundaries between the positive and negative growth regions of each strategy, known as isoclines. Thus, the name of this package, IsoMaTrix, is a blend of ‘isocline’ and ‘matrix’ games, to describe this key functionality.

Several groups have released similar packages in Mathematica, Dynamo (Sandholm et al., 2012), EvoDyn-3s (Izquierdo et al., 2018), DeFinetti (Archetti, 2020) or in Python, EGTplot (Mirzaev et al., 2018), that compute evolutionary game dynamics of three strategy games. The foremost distinguishing feature of the IsoMaTrix package is the extension of explicit spatial structure, including functions to quantify and visualize uncertainty due to stochastic effects, which has not been done in previous packages. This extension allows for easy comparison between non-spatial (replicator dynamics) and spatial (cellular automata; discrete space) model configurations. Other distinguishing features include computation of isoclines, novel region plots, simultaneous visualization of multiple games and automatic computation of basins of attraction.

2 Materials and methods

Frequency-dependent selection dynamics in IsoMaTrix are governed by the replicator equation:

x˙i=xi(fiϕ) (1)

where xi is the fraction of each strategy, fi=jaijxj is the fitness of each strategy, the average fitness is ϕ=jfjxj (with i,j[1,2,3]) and aij are elements of the payoff matrix, A such that [A]ij=aij.

The IsoMaTrix package has functions which display the replicator equation’s (i) fixed points, (ii) isoclines, (iii) phase flow, (iv) velocities, (v) trajectories, (vi) regions of positive/negative strategy fitness and (vii) basins of attraction. See the attached manual for an exhaustive list and tutorial of all IsoMaTrix functionality. Each function is independently called, enabling chaining to facilitate the desired visualization of dynamics.Figure 1 shows a representative example of visualizations possible in IsoMaTrix.

Fig. 1.

Fig. 1.

IsoMaTrix. Top section: well-mixed dynamics. (A) Schematic of simplex describing competition between Normal (N), Sensitive (S) and Resistant (R) cells. (B) Example IsoMaTrix diagram describing competitive release. (C) ‘Region plot’ (regions delineated isoclines, x˙i=0), with example trajectory (red dashed line). (D) Isoclines for resistant strategy (x˙3=0) for varied dose, c. (E) Phase flow shown for c =0.25, with simulated spatial structure using the Ohtsuki–Nowak transform (k =4, Death-Birth updating). Color-coded by basins of attraction. (F) Schematic of IsoMaTrix diagrams computation in structured populations. M stochastic realizations are simulated for each initial proportion within a mesh covering the triangle: four examples shown inset. (G) Phase flow is estimated via resultant vector xFx0, after n number of time steps Uncertainty: standard deviation of magnitude (background-color) and direction (gray arc). (H) Resistant subvelocity. The trajectories through space (I) and time (J) for configurations shown in (K, L) compared to well-mixed (black)

While replicator dynamics has proven quite useful, the dynamics of spatially structured populations can vary dramatically (Gatenbee et al., 2019; Kaznatcheev et al., 2015; You et al., 2017). In some cases, it is possible to spatialize replicator dynamics: i.e. transform the replicator dynamics to account for the specific spatial structures. IsoMaTrix provides an implementation of one such analytic transform to get modelers started with first-order deviations from well-mixed dynamics due to spatial structure (Kaznatcheev, 2018; Ohtsuki and Nowak, 2006).

IsoMaTrix uses the on-lattice cellular automata framework HAL (Bravo et al., 2020) to perform simulation-based analysis of spatial structure. IsoMaTrix uses ‘imitation updating’ whereby a randomly chosen focal cell updates its strategy to imitate one of its own neighbors in proportion to fitness (Ohtsuki and Nowak, 2006). Either deterministic (maximum fitness neighbor strategy wins) or stochastic (weighted by fitness of all neighbors) updating can be chosen (Nowak, 2006).

3 Example

To illustrate the utility of IsoMaTrix, Figure 1 uses a payoff matrix previously used to model competitive release (West et al., 2018) (see Supplementary Material), which describes competition between Normal (N), Sensitive (S) and Resistant (R) cells within the tumor bed. Competition depends on drug concentration, c. Figure 1 illustrates the dynamics, displayed on a triangular plot (Fig. 1A) where each corner represents a tumor with 100% of the given strategy. Figure 1B shows phase flow under treatment, with fixed points for each two strategy interaction (N–S, S–R, N–R) conveniently offset on each edge. Isomatrix shows the stability of each of the corner, edge and internal fixed points (solid circles are stable; open are unstable). Any solid circle on the simplex corresponds to an evolutionary stable strategy (ESS; Maynard Smith, 1986; Zeeman, 1980). For example in Figure 1B, all-R is an ESS and the other fixed points (all-S, all-N, SR-mix, SRN-mix) are not, while in the spatialized Figure 1E, all-S and all-R are ESS and the other fixed points (all-N and SR-mix) are not.

The ‘regions’ plot (Fig. 1C) delineates the ternary plot into color-coded regions according to if each strategy (i{1,2,3}) is selected for (fi>ϕ) or against (fi<ϕ). Knowledge of the dose-dependent resistant isocline (Fig. 1D) facilitates control of the tumor dynamics by allowing treatment to be discontinued well before resistant regrowth (West et al., 2018, 2016). Importantly, IsoMaTrix allows for multiple games (in this case, multiple values of dose) to be easily displayed on the same ternary diagram.

Figure 1F shows a schematic detailing how IsoMaTrix diagrams are produced for spatially structured populations. M stochastic realizations are simulated for each initial proportion (i.e. x0=[x1,x2,x3]) within the triangle. Phase flow is estimated by calculating the resultant vector between and the initial and final proportion after n time steps. Given the stochastic nature of spatial simulations, uncertainty can be calculated (Fig. 1G). IsoMaTrix facilitates comparison of precise spatial configurations. Figure 1I–L compare the well-mixed (black line) dynamics to two spatial configurations: resistant cells trapped inside sensitive cells (K) and vice versa (L). The tumor with resistant cells trapped within the core delays the emergence of resistant cells (Fig. 1J) under treatment.

Financial Support: The authors gratefully acknowledge funding from both the Cancer Systems Biology Consortium and the Physical Sciences Oncology Network at the National Cancer Institute, through grants U01CA232382 and U54CA193489 as well as support from the Moffitt Center of Excellence for Evolutionary Therapy.

Conflict of Interest: none declared.

Supplementary Material

btaa1025_Supplementary_Data

References

  1. Archetti M. (2013) Evolutionary game theory of growth factor production: implications for tumour heterogeneity and resistance to therapies. Br. J. Cancer, 109, 1056–1062. [DOI] [PMC free article] [PubMed] [Google Scholar]
  2. Archetti M. (2020) Definetti: a mathematica program to analyze the replicator dynamics of 3-strategy collective interactions. SoftwareX, 11, 100415. [Google Scholar]
  3. Archetti M., Pienta K.J. (2019) Cooperation among cancer cells: applying game theory to cancer. Nat. Rev. Cancer, 19, 110–117. [DOI] [PMC free article] [PubMed] [Google Scholar]
  4. Basanta D.  et al. (2008) Evolutionary game theory elucidates the role of glycolysis in glioma progression and invasion. Cell Proliferation, 41, 980–987. [DOI] [PMC free article] [PubMed] [Google Scholar]
  5. Bravo R.R.  et al. (2020) Hybrid automata library: a flexible platform for hybrid modeling with real-time visualization. PLoS Comput. Biol., 16, e1007635. [DOI] [PMC free article] [PubMed] [Google Scholar]
  6. Gatenbee C.  et al. (2019) Macrophage-mediated immunoediting drives ductal carcinoma evolution: Space is the game changer. doi: 10.1101/594598.
  7. Gluzman M.  et al. (2020) Optimizing adaptive cancer therapy: dynamic programming and evolutionary game theory. Proc. R. Soc. B, 287, 20192454. [DOI] [PMC free article] [PubMed] [Google Scholar]
  8. Hofbauer, J. and Sigmund, K. (1998) Evolutionary Games and Population Dynamics. Cambridge University Press, Cambridge. [Google Scholar]
  9. Izquierdo L.R.  et al. (2018) Evodyn-3s: a mathematica computable document to analyze evolutionary dynamics in 3-strategy games. SoftwareX, 7, 226–233. [Google Scholar]
  10. Kaznatcheev A. (2017) Two conceptions of evolutionary games: reductive vs effective. bioRxiv, doi: 10.1101/231993.
  11. Kaznatcheev A. (2018) Effective games and the confusion over spatial structure. Proc. Natl. Acad. Sci. USA, 115, E1709. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Kaznatcheev A.  et al. (2015) Edge effects in game-theoretic dynamics of spatially structured tumours. J. R. Soc. Interface, 12, 20150154. [DOI] [PMC free article] [PubMed] [Google Scholar]
  13. Kaznatcheev A.  et al. (2017) Cancer treatment scheduling and dynamic heterogeneity in social dilemmas of tumour acidity and vasculature. Br. J. Cancer, 116, 785–792. [DOI] [PMC free article] [PubMed] [Google Scholar]
  14. Kaznatcheev A.  et al. (2019) Fibroblasts and alectinib switch the evolutionary games played by non-small cell lung cancer. Nat. Ecol. Evol., 3, 450–456. [DOI] [PMC free article] [PubMed] [Google Scholar]
  15. Maynard Smith J. (1986) Evolutionary game theory. Phys. D Nonlinear Phenomena, 22, 43–49. [Google Scholar]
  16. Mirzaev I.  et al. (2018) egtplot: a python package for three-strategy evolutionary games. J. Open Source Softw., 3, 735. [Google Scholar]
  17. Neumann,LJ. and Morgenstern,O. (1947) Theory of games and economic behavior. Vol. 60, Princeton, Princeton university press.. Theory of Games and Economic Behavior. University Press, Princeton. [Google Scholar]
  18. Nowak M.A. (2006) Evolutionary Dynamics: Exploring the Equations of Life. Harvard University Press, UK. [Google Scholar]
  19. Ohtsuki H., Nowak M.A. (2006) The replicator equation on graphs. J. Theor. Biol., 243, 86–97. [DOI] [PMC free article] [PubMed] [Google Scholar]
  20. Rockne R.C.  et al. (2019) The 2019 mathematical oncology roadmap. Phys. Biol., 16, 041005. [DOI] [PMC free article] [PubMed] [Google Scholar]
  21. Sandholm W.H.  et al. (2012) Dynamo: Diagrams for evolutionary game dynamics. http://www. ssc.wisc. edu/w∼hs/dynamo, (8 December 2020, date last accessed).
  22. Staňková K.  et al. (2019) Optimizing cancer treatment using game theory: a review. JAMA Oncol., 5, 96–103. [DOI] [PMC free article] [PubMed] [Google Scholar]
  23. Warman P.I.  et al. (2018) Fractionated follow-up chemotherapy delays the onset of resistance in bone metastatic prostate cancer. Games, 9, 19. [DOI] [PMC free article] [PubMed] [Google Scholar]
  24. West J.  et al. (2016) The prisoner’s dilemma as a cancer model. Convergent Sci. Phys. Oncol., 2, 035002. [DOI] [PMC free article] [PubMed] [Google Scholar]
  25. West J.  et al. (2018) Capitalizing on competition: an evolutionary model of competitive release in metastatic castration resistant prostate cancer treatment. J. Theor. Biol., 455, 249–260. [DOI] [PMC free article] [PubMed] [Google Scholar]
  26. West J.  et al. (2020) Towards multi-drug adaptive therapy. Cancer Res., 80, 1578–1589. [DOI] [PMC free article] [PubMed] [Google Scholar]
  27. You L.  et al. (2017) Spatial vs. non-spatial eco-evolutionary dynamics in a tumor growth model. J. Theor. Biol., 435, 78–97. [DOI] [PubMed] [Google Scholar]
  28. Zeeman E.C. (1980) Population dynamics from game theory. In Zbigniew,N. and Clark,R. (eds) Global Theory of Dynamical Systems. Springer, pp. 471–497. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

btaa1025_Supplementary_Data

Articles from Bioinformatics are provided here courtesy of Oxford University Press

RESOURCES