## Abstract

By nature of their small size, dense growth and frequent need for extracellular metabolism, microbes face persistent public goods dilemmas. Genetic assortment is the only general solution stabilizing cooperation, but all known mechanisms structuring microbial populations depend on the availability of free space, an often unrealistic constraint. Here we describe a class of self-organization that operates within densely packed bacterial populations. Through mathematical modelling and experiments with *Vibrio cholerae,* we show how killing adjacent competitors via the Type VI secretion system (T6SS) precipitates phase separation via the ‘Model A’ universality class of order-disorder transition mediated by killing. We mathematically demonstrate that T6SS-mediated killing should favour the evolution of public goods cooperation, and empirically support this prediction using a phylogenetic comparative analysis. This work illustrates the twin role played by the T6SS, dealing death to local competitors while simultaneously creating conditions potentially favouring the evolution of cooperation with kin.

## Introduction

Microbes are fundamentally social organisms^{1,2,3,4,5}. They often live in dense, surface-attached communities, and participate in a range of social behaviours mediated through the production and consumption of extracellular proteins and metabolites. Paradigmatic examples include the cooperative production of digestive enzymes^{6}, metal chelators^{7}, signalling molecules^{6} and the structural components of biofilms^{8}. Many of these extracellular compounds are susceptible to social exploitation, in which non-producing ‘cheats’ gain an evolutionary advantage. If unchecked, this social exploitation can lead to the extinction of cooperative genotypes^{9,10}.

It is widely recognized that the spatial segregation of cooperative microbes away from cheats can solve this cooperative dilemma by ensuring that the investment of cooperators goes to other adjacent cooperative individuals^{1,5,10,11,12}. Mechanisms creating assortment when organisms expand their ranges via growth into free space have recently received much attention^{13,14,15,16,17,18}, where robust patterns of genetic segregation can occur via stochastic bottlenecking. However, this mechanism cannot generate genetic segregation within dense, well-mixed communities displaying no net growth, despite the clear ecological relevance of such communities.

One mechanism that has been proposed to potentially generate spatial structure in dense communities is antagonistic interactions among genotypes^{1,19,20,21,22,23}. If different genotypes interact antagonistically then wherever a genotype is in the minority they will be killed by competitors at a high rate, resulting in genetically homogenous patches. While mechanisms via which individuals can recognize and kill non-kin have been extensively studied, the consequences of such interactions for the spatial structure of communities have not been explored in detail.

The Type VI secretion system (T6SS) is a potent mechanism of bacterial aggression that can deliver effector proteins directly into eukaryotic cells to mediate virulence by cellular disruption, and into adjacent bacteria to mediate competition by killing non-kin while leaving kin with corresponding protective immunity proteins unscathed^{24,25}. In *Vibrio cholerae,* T6-proficient strains utilize the T6SS to intoxicate T6-deficient eukaryotic predators and diverse proteobacteria, as well as other more closely related *V. cholerae* isolates that lack identical effector immunity pairs^{26,27,28,29,30,31,32}. T6-mediated segregation occurs during co-culture of T6-proficient *V. cholerae* with T6-deficient *E. coli*. Segregation was also predicted to occur between two mutually antagonistic T6-proficient strains^{33}, and recently demonstrated at the single cell level in co-cultures of *V. cholerae* and *Aeromonas hydrophila*^{20}.

Here we examine the causes and consequences of neighbour killing via the T6SS on the physical structure of microbial communities. Using a *V. cholerae* experimental system and mathematical modelling, we show that T6SS-mediated killing causes an initially well-mixed population of mutually antagonistic bacteria to phase separate, forming clonal patches that grow larger through time. This phase separation belongs to the ‘Model A’ class of order-disorder transitions, which is described by the Allen-Cahn equation. We mathematically demonstrate that the spatial structure generated as a consequence of T6SS-mediated killing can favour the evolution of public-goods cooperation by limiting the potential for unrelated ‘cheats’ to access secreted products. Finally, we bioinformatically show that bacteria with more T6SS systems and effectors dedicate a larger fraction of their genomes to secreted products. While it is too early to rule out alternative hypotheses, this correlation is consistent with general predictions from social evolutionary theory that spatially structured environments favour the evolution of cooperation.

## Results

## Mutual antagonism drives phase separation

Our system illustrates the profound effect of T6SS-mediated killing on emergent spatial patterning of a surface attached population. Mathematical modelling suggests that an initially well-mixed population of mutual killers should rapidly undergo phase separation due to ‘selfish herd’ dynamics^{34}, as the cells within genetically uniform groups no longer risk T6SS-mediated death. Indeed, we observe rapid phase separation in three distinct classes of models, all starting with a randomly seeded population on a two-dimensional lattice (Fig. 1a). We first developed an individual-based model (IBM; Fig. 1b; Supplementary Movie 1) that simulates bacterial growth, the killing of adjacent competitors and reproduction into empty patches through time. IBMs are appealing, in that they offer an intuitive simulation of discretized, interacting individuals. However, IBMs often lack mathematical transparency, limiting generalization. We thus modelled our system using two distinct, mathematically defined approaches: an ecologically based partial differential equation model in order to gain analytical insight into the dynamics (PDE; Fig. 1c; Supplementary Figs 1 and 2, Supplementary Movie 2), and the ecologically-based Ising spin model in order to relate our results to classical modelling of phase separation in statistical mechanics^{35} (Fig. 1d; Supplementary Movie 3). In all three modelling frameworks, initially well mixed populations rapidly underwent phase separation. Similarly, initially-well mixed populations of two *Vibrio cholerae* strains (C6706 and 692–79; Supplementary Table 1) capable of mutual T6SS-mediated killing (Supplementary Fig. 3) underwent phase separation (Fig. 1f,i,j). Non-killing controls (Δ*vasK,* that is, T6SS^{−}; Supplementary Fig. 3) and T6SS^{+} mutual killers cultured at low temperatures which impede T6SS activity^{36} remained well-mixed (Fig. 1e,g,h).

## Spatial analysis

To determine whether our models and experiments undergo the same type of order-disorder transition, we quantitatively examined the dynamics of phase separation in each. We first computed the Fourier-transformed structure factor, *S(q)*. The characteristic wavenumber of clonal groups is , and the height of the peak is related to how often it occurs in the lattice (that is, the strength of patterning at that length scale). At early timesteps (Fig. 2a, Supplementary Fig. 4), or for non-killing controls (Fig. 2b), *S*(*q*) is relatively flat, as expected for a well-mixed population lacking a characteristic length scale. T6SS-mediated killing causes *S(q)* to increase at smaller values of *q* (longer length scales) as the population grows increasingly structured. This progression of *S(q)* is a hallmark of phase separation^{37}. For Model A, *q*_{m} scales as *q*_{m}∝1/, while *S(q*_{m}) scales as (ref. 38). It is ambiguous how to relate simulation time to experimental time; instead, we plot *S(q*_{m}) versus *q*_{m}. All models (IBM, PDE and Ising) and experiments fall on the same line (*S*(*q*_{m})∝1/) (Fig. 2c), a relationship consistent with the ‘Model A’ order-disorder phase separation process^{39}, developed to explain the interaction of atomic ‘spins’ in systems that lack conservation, and described by the Allen-Cahn equation =*η*−*μ*, which relates the change in local concentration, *ϕ*, over time to diffusion and the chemical potential, *μ* and stochastic fluctuations (see Methods)^{40}. To demonstrate this equivalence across wavenumbers, we plot *q*_{m}^{2}*S*(*q*) versus *q*/*q*_{m} (Fig. 2d). This collapses all data onto one master curve. In fact, due to the universality of non-conserved domain growth, this collapse could have been expected. Importantly, this universality, shown in Fig. 2c,d, demonstrates that while initial conditions—such as the initial number ratio of the two competing strains—may influence the timing of phase separation, they do not influence how phase separation occurs, or that the characteristic clonal group size always grows as . Cellular mobility has a surprising effect on phase separation: rather than impeding phase separation, it accelerates it by enhancing killing at the borders of clonal patches (Supplementary Methods, Supplementary Fig. 5 and Supplementary Movie 4).

To provide biological context for this process of phase separation, we calculated clonal assortment (*r*), for the IBM (Fig. 2e) and the *Vibrio* experiments (Fig. 2f). Assortment, which can be thought of as analogous to Hamiltonian relatedness^{17,41,42}, describes the extent to which clonemates spatially co-localize after accounting for their frequency in the population (see Methods for details). T6SS-mediated killing resulted in the creation of highly structured populations with high assortment over long length scales (Fig. 2e,f). Such assortment can protect diffusible public goods from consumption by competing strains^{43,44}.

## Spatial assortment supports cooperation

To explore the effect of T6SS-mediated killing on the evolutionary stability of public goods cooperation, we introduced a diffusible cooperative good into our model. Because all three of our modelling frameworks displayed similar dynamics, we chose the PDE framework because it is the most amenable to analytical investigation. We considered two competing strains: a cooperator that secretes an exoproduct into its environment at an individual cost, and a non-producing cheat that, all else equal, grows faster than the cooperator as it does not pay the cost of production. In this model, cellular growth rates for both strains depend on the local concentration of the diffusible exoproduct. We find that T6SS-mediated killing protects cooperation in two different ways. In a non-spatial (that is, constantly mixed) environment, T6SS-mediated killing can allow cooperators to resist invasion by rare cheats owing to the cooperators’ numerical dominance in antagonistic interactions (that is, it creates positive frequency-dependence (Fig. 3c), while without T6SS-mediated killing (either because strains lack T6SS, or because the cheat is of the same T6SS type as the cooperator) cheats outcompete cooperators at all starting frequencies (Fig. 3a). However, in a spatially defined environment, phase separation driven by T6SS-mediated killing physically separates producers from cheats, expanding the conditions favouring cooperation and allowing them to invade a population of cheats from rarity (Fig. 3d,e and Supplementary Movie 5; see proof in Supplementary Methods), while cheats ultimately win in the absence of T6SS-mediated killing (Fig. 3b).

Our models and experiments demonstrate that T6SS-mediated killing can generate favourable conditions for the evolution of public-goods cooperation^{1,12,15,45}. This can occur in two ways. First, T6SS-mediated killing induces positive frequency-dependent selection, allowing cooperators to resist rare cheats. Second, T6SS-mediated killing precipitates self-organized structuring of microbial communities, reducing the diversity of cheats that can exploit cooperators. In addition to the predictions of our models previous experimental work has suggested that, via pleiotropic linkage to quorum sensing communication systems, the T6SS can also act as a policing mechanism protecting against the evolution of quorum sensing cheats^{46}. Altogether, this suggests that there are three complementary paths via which T6SS-mediated killing could favour the evolution of cooperation.

## Association between T6SS and secreted product evolution

Does T6SS-mediated killing have a similar effect in the real world, where ephemeral resources, physical disturbance and intense competition may impede these mechanisms? We approach this question phylogenetically, examining the relationship between the proportion of each genome coding for potentially exploitable secreted proteins and its T6SS complexity, with the rationale that microbes possessing a greater number of T6SSs may face less social exploitation by living in more structured communities. All else equal, genotypes that possess a greater number of T6SSs should form more highly structured patches (higher *r*), phase separating with a greater proportion of competitor genotypes (that is, those with non-complementary effector/immunity proteins). As a result, we hypothesize that genotypes with more T6SSs should experience less pressure from social cheating imposed by distantly related competitors. There is, of course, an important caveat to this scenario: while T6SS-based phase separation should effectively exclude competitors, it does not address the *de novo* evolution of cheating from within the clone (for example, Fig. 3a,b).

As a first-order proxy for cooperativity, we measured the proportion of a clone’s genome dedicated to secreted proteins (henceforth referred to as ‘secretome size’). While many of these secretions may have antagonistic effects on other microbes, they can still be seen as cooperative from the producing cell’s perspective, as their kin can benefit from the reduced competition that they create^{47,48}. We constructed a Bayesian phylogenetic mixed model of T6SS-containing Proteobacteria and Bacteroidetes (Fig. 4a, Supplementary Fig. 6) using 439 genomes from 26 genera. Secretome size is positively correlated with both the number of T6SSs (Fig. 4b,d, Supplementary Table 2) and T6SS effector proteins (Fig. 4c,e, Supplementary Table 2) present, and the model shows an excellent overall fit to the data, explaining 99% of the variance in secretome size (Fig. 4f). These results are also robust in univariate analyses (Supplementary Tables 3 and 4) and to the inclusion of genome size as a predictor (Supplementary Table 5). As our analyses include many closely related strains (for example, many *Helicobacter pylori*, Fig. 4a), most (91%) of the variance in secretome size is explained by the phylogenetic relationships among strains. Nonetheless, the number of T6 secretion systems and T6SS effectors are important predictors of secretome size, explaining 8% of the total, and 90% of the non-phylogenetic variance in secretome size.

While the above analysis is consistent with the predictions of our mathematical model showing that phase separation should favour the evolution of cooperation (Fig. 3), it is not conclusive. As with any broad-scale phylogenetic analysis, alternative mechanisms explaining this correlation cannot be ruled out. For example, some unknown aspect of bacterial ecology may independently select for both investment in T6SS-mediated killing and exoproduct production. By controlling for phylogenetic variation, our analysis should capture some of this ecological variance, through it does not eliminate it entirely. Alternatively, increases in the presence of dead competitors owing to T6SS-mediated killing can create additional opportunities for horizontal gene transfer^{49}, which could allow for increased acquisition of genes coding for secretions. However, such an explanation relies on horizontal gene transfer being biased towards genes encoding extracellular secretions. While there is evidence that this bias towards secretions is the case for plasmids and other mobile genetic elements^{50}, whether this bias occurs when sampling the genes of dead competitors remains to be determined. Detailed analysis of the phylogenetic dynamics of T6SS genes and secretions in individual clades may allow the relative contributions of these hypotheses to our observed correlation to be disentangled.

## Discussion

Phase separation is well-known to drive pattern formation in biology^{51,52}, but has mainly been investigated using either Turing activator-inhibitor feedbacks^{53,54}, or positive density-dependent movement, described by the Cahn-Hilliard equation^{51,55,56,57}. In this paper, we describe a third general mechanism of self-organized pattern formation: targeted killing of non-kin competitors. This drives a ‘Model A’ phase separation; the kinetics of this coarsening process—described by the Allen-Cahn equation—only depend on a few cellular details. While we restrict our analysis in this paper to the T6SS, the role of antagonistic interactions in structuring biological communities it is probably far more general, applying to diffusible compounds that kill adjacent non-kin in both micro-organisms (for example, antibiotics) and macro-organisms (for example, allelopathy in plants^{58} and animals^{59}). However, while ‘Model A’ coarsening is universal, the realization of such dynamics in a densely packed, immobile, athermal system is likely unique to biology.

Physically, this system bears similarities to active matter^{18,51,56,57}; phase separation has also been observed in these far from equilibrium active systems, wherein constituents expend energy to move. Phase separation in these systems typically occurs due to differences in mobility as a function of density; constituents move slowly through crowded regions, and quickly through low density regions. Mobility-induced phase separation has been observed (or predicted) in systems as varied as swimming bacteria^{60}, self-propelled colloids^{61,62}, mussels^{51}, granular rods^{63}, active filaments^{64,65}, rotating particles^{66}, among other systems^{52}. In the current system, activity is derived from reproduction and killing events at high density rather than constituent mobility^{67}, leading to a ‘Model A’ transition.

Model A coarsening captures the behaviour of a broad array of phase transitions that lack conservation. This transition was originally developed to model magnetization in ferromagnetic materials via the Ising model. Ferromagnetic spins have minimum energy when they align; they do so via Glauber spin flips, leading to a change in the overall magnetization. The physical universality of this transition may be reflected in the strong correlation between secretome and T6SS effectors and apparatuses seen in Fig. 4. The microscopic details of the system do not strongly affect coarsening, so long as densely packed cells are equipped with T6SS.

In recent years, there has been a growing appreciation that many microbial behaviours requiring extracellular metabolism are susceptible to social exploitation. Here we show how simple cell-cell aggression can, as a consequence, create a structured population favourable to cooperation. Clearly, many factors contribute to the structure and function of microbial communities^{1,4,15,16,19,20,21,22,42,47}. However, because T6SSs are common (found in ∼25% of Gram-negative bacteria^{68}), and microbes often live in dense communities, phase-separation driven by contact-mediated killing may have a fundamental role in defining the genetic composition and ecosystem-level functionality of microbial communities worldwide.

## Methods

## Bacterial strains and culture conditions

The bacterial strains used in this study are shown in Supplementary Table 1. *Vibrio cholerae* fluorescence reporter constructs were chromosomally integrated and gene deletions and promoter replacements were constructed by allelic exchange as described and verified by Sanger sequencing^{69,70,71}. *Vibrio cholerae* was routinely grown at 30 °C in Luria-Bertani (LB) liquid medium supplemented with 50 μg ml^{−1} of kanamycin or 150 μg ml^{−1} spectinomycin when appropriate. For confocal microscopy experiments, overnight cultures were mixed and 0.5 μl was inoculated onto Luria-Bertani agar (1.5%) pads on glass slides, and incubated at 17, 25 or 30 °C for 24 h. C6706 and 692–79 were inoculated at a 1:6 initial ratio, as T6SS^{+} C6706 is more competitive than T6SS^{+} 692–79 under our assay conditions (it grew from an inoculation ratio of 16.6% to constitute an average of 40–62% of each colony at all three temperatures). To visualize less-advanced stages of phase separation, we used a 1:8 initial ratio of strain C6706 to 692–79. For all images, we show C6706 in red and 692–79 in blue. As expected^{69}, phase occurred similarly when the fluorescence reporters were swapped between strains (Supplementary Fig. 7).

## Microscopy and image analysis

Laser fluorescence confocal microscopy was performed with a Nikon A1R. The filters used were fluorescein isothiocyanate (for detecting mTFP1, cyan) and tetramethylrhodamine (TRITC) (for detecting mKO, orange). Full colony images were captured in one z-plane using the 20 × Plan Apo objective lens and a 2 × internal multiplier was applied to capture close-up images. The Galvano scanner was used to scan 2,048 × 2,048 pixels on all images in order to maximize resolution. For every sample, the top and bottom of the colony was located, and a plane in the middle was imaged. The images were stitched and channels were merged using NIS Elements software. To eliminate issues with red–green colourblindness, we present green fluorescence in images as blue.

To calculate the structure factor, *S(q)*, we start with an image from a simulation or experiment, *I(x,y)*. *S(qx,qy)* is the absolute value of the Fourier Transform of *I(x,y)*, squared , where *q*_{x} and *q*_{y} are spatial frequencies in the x- and y- directions, respectively. We then radially average *S(q*_{x}*,q*_{y}), .

To calculate the assortment (*r*) of the genotype over interaction radius *h*, we again start out with a binarized image from a simulation or experiment *I(x,y)* in which we set values of the focal strain *g* to 1 and the competitor strain *c* to −1. We first convolved *I(x,y)* with a kernel in which all positions other than the center were set to 1, and the center set to −((2*h+1)*^{2}*−1*), generating the transformed matrix *C(x,y)*. For example, the kernel for distance *h* of 1 would be . Edges within distance *h* were trimmed. For each interaction radius *h* (which ranged from 1–36), we calculated the assortment *r* of the focal strain *g* as *r*_{g}*=* . *r* is thus the mean frequency of *g* within interaction radius *h,* relative to frequency of *g* in the population as a whole. *r,* which ranges from −1 to 1, describes the spatial association of each genotype above or below what would be expected from random associations (*r*=0). This definition of assortment is commonly used in social evolution studies, and is conceptually analogous to Hamiltonian relatedness^{17,41,42}. Similarly, we calculated the assortment of the competitor strain *c* as *r*_{c}*=*.

## Phylogenetic comparative analysis

We gathered data on the presence of putative T6SSs and effectors across proteobacterial genomes from the SecReT6 database^{72}. We restricted our analysis to genera in which there has been experimental verification of the presence of at least one T6SS in at least one strain in SecReT6 (ref. 72). This gave data for a total of 439 genomes from the Proterobacteria and Bacteroidetes of the genera *Acidovorax* (*N*=5), *Acinetobacter* (*N*=19), *Aeromonas* (*N*=4), *Agrobacterium* (*N*=4), *Azoarcus* (*N*=2), *Bacteroides* (*N*=9), *Bordetella* (*N*=10), *Burkholderia* (*N*=38), *Campylobacter* (*N*=24), *Citrobacter* (*N*=2), *Edwardsiella* (*N*=4), *Enterobacter* (*N*=11), *Escherichia* (*N*=59), *Flavobacterium* (*N*=5), *Francisella* (*N*=19), *Helicobacter* (*N*=59), *Methylomonas* (*N*=1), *Myxococcus* (*N*=3), *Pectobacterium* (*N*=5), *Proteus* (*N*=2), *Pseudomonas* (*N*=53), *Ralstonia* (*N*=10), *Salmonella* (*N*=41), *Serratia* (*N*=9), *Vibrio* (*N*=22) and *Yersinia* (*N*=19). For each genome we also recorded the genome size and secretome size (number of genes coding for secreted proteins) from PSORTdb^{73}. Any T6SS effectors identified in SecReT6 were removed from secretome size counts from PSORTdb to avoid creating a spurious correlation owing to double counting of effectors. Scatterplots of all raw data are shown in Supplementary Fig. 6. To control for the phylogenetic relationships among strains we used the SUPERFAMILY phylogeny^{74}, which we ultrametricised using the chronpl function in ape^{75}. The data and phylogeny used are included in Supplementary Data 1 and 2.

We used a Bayesian phylogenetic mixed model (BPMM) approach to test for an evolutionary association between T6SSs and secretome size. Analyses were implemented in R using the package MCMCglmm^{76}. We treated secretome size as a binomial response variable, expressing it as a proportion of genome size. In all models, we included phylogeny as a random effect to control for the shared evolutionary history of strains, and also included a residual random effect to account for overdispersion. For fixed effects we used an uninformative normally distributed prior with mean 0 and variance of 10^{8}. For the phylogenetic and residual variances, we used an uninformative inverse gamma prior with shape and scale both set to 0.001. We ran all models for 6,000,000 iterations with a burn-in of 1,000,000, and thinning interval of 1,000 iterations. We used visual inspection of traces, as well as the Gelman-Rubin test^{77,78} on three independent chains to assess model convergence. In all cases, the potential scale reduction factor was <1.03. We first fit a model including both the number of T6SSs and number of T6SS effectors as fixed effects (Supplementary Table 2). To test the sensitivity of our results we also fit univariate models with number of T6SSs and number of T6SS effectors as fixed effects in isolation (Supplementary Tables 3 and 4). Finally, to control for the potential of non-linear scaling of secretome size with genome size we ran a model with number of T6SSs, number of T6SS effectors, and the log of genome size as fixed effects (Supplementary Table 5). In all cases, both the numbers of T6SSs and T6SS effectors show significant associations with secretome size. Statistics quoted are posterior modes, 95% credible intervals, and p_{MCMC} a Bayesian equivalent to the frequentist *P* value, which is set as twice whichever is smaller of the proportion of posterior samples above or below zero. Values for proportion of variance explained (R-squared) were calculated following the approach of Nakagawa and Schielzeth^{79} as the proportion of total variance attributable to the variable in question on the link (logit) scale, but removing the term for the intrinsic variance of the binomial distribution as we are interested in prediction at the level of proportion of the genome dedicated to secretions, rather than prediction of whether individual genes code for secretions. Total variance was calculated as the posterior mode of the sum of the residual, phylogenetic and fixed effect variance, with the proportional contributions of each component then determined. In addition, we calculated the proportion of non-phylogenetic variance accounted for by the fixed effects by repeating the calculations while neglecting the phylogenetic variance estimates.

## Individual based simulation model

We randomly seeded a 500 × 500 lattice with an equal number of red and blue cells. Every time step, 5% of the cells were randomly chosen to activate their T6SS systems, killing any adjacent (eight cells surrounding the focal cell) cells of the opposite colour. Similarly, 5% of the cells in the landscape were randomly chosen to attempt to reproduce, filling up to one adjacent unoccupied patch with a cell of its colour. Rates of killing and reproduction were chosen to provide sufficient temporal resolution of population dynamics while still being computationally efficient. Reproduction was aborted if all neighbouring patches were occupied. Within each time step, model updates were propagated sequentially across rows, starting with the first position in the upper left corner. This model was coded in Python and is available upon request.

## Ising spin model

We randomly seeded a 500 × 500 lattice with an equal number of ‘1’ and ‘−1’ entries, representing ‘up’ and ‘down’ magnetic spins. The eight nearest neighbours of each point in the lattice are summed and multiplied by the entry they circumscribe—if an entry is surrounded by neighbours of its own type, the resultant quantity (the Hamiltonian ‘*H*’) is 8; if surrounded by neighbours opposite its own type, −8. We randomly choose a spin in the lattice and calculate *H*_{old} and *H*_{new}, where *H*_{new} is the Hamiltonian if the chosen spin were to flip, and *H*_{old} the Hamiltonian if the spin were to remain unflipped.

Each spin flips independently, so flipping one spin does not change the sum of its eight nearest neighbours. Because the Hamiltonian for each entry, however, is the product of that sum with the entry itself, the net effect is simply to add a minus sign. Thus, the difference between the energy for the flipped spin and the unflipped spin is

With this quantity calculated for our randomly chosen spin, we finally calculate , and compare it to a random number between 0 and 1—if and only if it is larger, the spin will flip^{80}. This process is applied iteratively, and after 500^{2} possible flips, one time-step is said to have passed. In the above discussion, the Hamiltonian is expressed in units of *k*_{B}**T*. This proportionality can be adjusted to modify the speed of convergence to the phase-separated state; our simulation used a ratio of unity. No external field was applied. This model was coded in Mathematica and is available upon request.

## ODE model for well-mixed environment

We will consider the interaction of two strains with different T6SS effector-immunity pairs so that each strain can kill the other strain upon cell–cell contact. For simplicity, we assume that both strains differ only in their T6SSs, having the same basal growth rate *r* and density dependent mortality rate *s*. We allow for asymmetric killing between the strains so that strain *A* kills strain *B* at rate *α*_{BA} and strain *B* kills strain *A* at rate *α*_{AB}. From these assumptions, we can write the change in density of strains *A* and *B* in a well-mixed environment as

There are four possible equilibria for this system: a bacteria-free equilibrium at *A*=0, *B*=0; two single-strain equilibria at *A*=*r*/*s*, *B*=0 and *A*=0, *B*=*r*/*s*; and a coexistence equilibrium with both strains present at *A*=*α*_{AB}*r*/(*s*(*α*_{AB}+*α*_{BA})+*α*_{AB}*α*_{BA}), *B*=*α*_{BA}*r*/(*s*(*α*_{AB}+*α*_{BA})+*α*_{AB}*α*_{BA}). Note that at the coexistence equilibrium the ratio of strain *A* to strain *B* simply depends on their relative rates of killing (*A*/*B*=*α*_{AB}/*α*_{BA}). Analysing the Jacobian (*J*) of the system around the equilibrium we can see that the bacteria-free equilibrium is unstable as long as *r>*0 (tr(*J*)=2*r*,|*J*|=*r*^{2}), while the single strain equilibria are always stable for our assumption of positive rates of killing (tr(*J*)=−*r*(*s*+*α*_{BA})/*s*, |*J*|=*α*_{BA}*r*^{2}/*s* for *A*=*r*/*s*, *B*=0, and tr(*J*) =−*r*(*s*+*α*_{AB})/*s*, |*J*|=*α*_{AB}*r*^{2}/*s* for *A*=0, *B*=*r*/*s*). Analysing the coexistence equilibrium we can see that both the trace and the determinant at the equilibrium are strictly negative

meaning that this is a saddle node, and is hence unstable. This means that in a well-mixed environment killing by T6SS will always lead to one strain coming to dominate the environment, with the critical ratio of strains *A* to *B* at which *A* eventually dominates decided by its relative rate of killing (*A* dominates if *A*/*B*>*α*_{AB}/*α*_{BA}) and vice versa for domination by strain *B* (Supplementary Fig. 1).

## PDE model for spatially extended environment

In order to study the dynamics of strains with different T6SS effector-immunity pairs in a spatial environment, we use the following system of PDEs

The dynamics are given as before but with a Laplacian operator for the diffusion/dispersal of cells through space, where *d* is the dispersal/diffusion rate for both strains. We will first consider the stability of a homogenous coexistence equilibrium where the average densities of the strains are

We will consider the effect of a fluctuation in the strain composition in one-dimensional space of the form

This fluctuation leads to a change in density of strain *A* at location *x* of *a* sin *βx* with a corresponding change of −*a* sin *βx* in the density of strain *B*, where *a* is the amplitude of the fluctuation (which e will assume to be infinitesimally small) and *β* is the angular frequency. As we are concerned with changes in composition we will denote the density/volume fraction of strain *A* as *ϕ*_{A}=*A*/(*A*+*B*) and using equations (3a-3b), the rate of change in the density fraction is

Substituting in equations (4a, 4b, 5a-5b), , we get

For the compositions to diverge δ*ϕ*_{A}/δ*t* must have the same sign as the fluctuation sin *βx*, as this leads to *A* increase in frequency in regions of positive fluctuation and *B* to increase in frequency in regions of negative fluctuation. At any point of zero compositional fluctuation (*x*=*nπ*/*β*, where ), δ*ϕ*_{A}/δ*t*=0 and this condition cannot be fulfilled. However, the condition for δ*ϕ*_{A}/δ*t* and sin *βx* to have the same sign in a region of non-zero fluctuation (*x*≠*nπ*/*β*, where ) is

Assuming that the amplitude of the compositional fluctuation is infinitesimally small (*a* → 0), inequality 8 simplifies to

Therefore, the strain compositions will diverge, with *A* increasingly dominating in regions of positive compositional fluctuation and *B* coming to dominate in regions of negative compositional fluctuation, if the fluctuations occur on a sufficiently wide scale relative to bacterial dispersal/diffusion (that is, sufficiently low *d* and/or *β*, Supplementary Fig. 2). It is also worth noting that this condition is more easily satisfied for higher rates of killing by both strains (higher *α*_{AB} and *α*_{AB}), and for higher values of the basal growth rate (higher *r*) and lower values of density-dependent mortality (lower *s*). This highlights that the local demography of killing by T6SS pushes the system towards decomposition even for fluctuations on short length scales, while higher diffusion/dispersal of cells mean that fluctuations of longer length scales are required for decomposition to occur.

## Relationship of the PDE model to the Allen-Cahn equation

The Allen-Cahn equation governs the density of strains A and B during phase separation absent the conservation of strains A and B. Assuming that the *effective* diffusion rate *d*_{Eff} doesnot vary through space (as will be approximately the case when oscillations in composition are of vanishingly small amplitude, *a* → 0) we can write the Allen-Cahn equation for strain *A* as

Where *f*(*ϕ*_{A}) is a function of *ϕ*_{A}. The δ*f*(*ϕ*_{A})/δ*ϕ*_{A} term drives *ϕ*_{A} to the free energy minimum over time, and can work with or against diffusion. Thus, the effective diffusion is uphill whenever δ*ϕ*_{A}/δ*t* and are of opposite sign (that is, whenever the change in volume fraction is of opposite sign to the Laplacian). The Laplacian, is given by

The sign of is, therefore, given by the sign of −sin *βx*, and it follows that δ*ϕ*_{A}/δ*t* and will be of opposite sign, and effective diffusion will be uphill, in the limit of infinitesimally small amplitude fluctuations (*a* → 0) whenever inequality 9 is satisfied. This highlights the two counteracting forces governing whether decomposition occurs—the diffusion/dispersal of cells favours downhill diffusion, while the local demographic effects of killing mimic uphill diffusion by a strain’s relative growth rate being increased in regions in which it is in the majority.

## Adding public goods to the model

To consider the effects of T6SS-mediated phase separation on the evolution of cooperation we extend our model so that strain *A* produces a diffusable public good secretion at rate *ρ*, while strain *B* does not invest in its production. We assume that strain *A* pays a growth rate cost *c* for production of the secretion. We also assume that the secretion increases each strains growth rate by amount *b* per unit concentration *S* by increasing nutrient availability (for example, an exoenzyme digesting a substrate or siderophores binding insoluble iron). From these assumptions, we write the dynamics of the two strains and the secretion concentration as

for a well-mixed, non-spatial system and as

for a spatially extended system, where *λ* is the decay rate of the secretion, *D* is its diffusion coefficient, and all other variables are as previously defined. We numerically explore both the non-spatial and spatial systems in the presence and absence of killing in the Fig. 3, and here we analytically explore these four scenarios.

## Non-spatial model in the absence of killing

In order to gain analytical insight into our model, we will make the assumption that the dynamics of the public good occur on a much faster time-scale than the ecological dynamics so that we may treat the public good as being at equilibrium for any given ecological state of the model. For the non-spatial model this gives us

Substituting this into equation (10) and setting the dynamics of the two strains are

We will assume throughout that *s*>*ρb*/*λ*, such that in the absence of cheaters a population of cooperators has a finite stable equilibrium. Solving for the equilibrium of equations (15a-15b), we can see that the only stable equilibrium is *B*=*r/s* so long as *c*>0. This means that, as long as there is a cost of cooperation, cheaters will always outcompete cooperators in a non-spatial environment in the absence of killing.

## Non-spatial model with killing

Again using the assumption that public goods dynamics play out on a faster time-scale than the ecological dynamics but now setting (that is, assuming symmetric killing) the dynamics of the two strains are

For this system there are two single strain equilibria, one for a pure population of cooperators at

and one for a pure population of cheaters at

The cooperator equilibrium is stable so long as *α*>*c*(*λs*−*ρb*)/(*λr*−*λc*), while the cheater equilibrium is always stable. There is a an unstable saddle point at

which exists whenever *α*>*c*(*λs*−*ρb*)/(*λr*−*λc*). This means that in the presence of killing cooperation can potentially still be a stable outcome. However, the location of the saddle point given is always at a higher value of *A* than of *B* (that is, *A* is always larger than *B* in equations (19a-19b), whenever *c*>0), meaning that the basin of attraction for strain *A* is smaller than that for strain *B*. Thus, though killing can help protect cooperation from cheaters in a non-spatial environment, they are still disfavoured compared with cheaters. More generally, the condition for the cooperative strain to increase in frequency is

Here we see that, in a non-spatial environment killing can help protect cooperators owing to the positive frequency dependence that it induces. However, cooperators are still disfavoured compared with cheaters as the basin of attraction for cheaters is larger (equations (19a-19b), ).

## Spatial model in the absence of killing

We will consider a one-dimensional spatial environment with a fluctuation in the strain composition as given in equations (5a-5b), . Using this spatial distribution of strains and assuming that the public goods dynamics happen on a much faster timescale than the ecological dynamics, we can solve for the equilibrium concentration of the public good across space as

Note here that as the diffusion rate of the public good approaches infinity (*D* → ∞) this simplifies to *S*(*x*)=*ρA*_{0}/*λ*, and thus has a constant concentration through space, while as the diffusion rate of the public good approaches zero it simplifies to *S*(*x*)=*ρ*(*A*_{0}+*a* sin *βx*)/*λ*, and is thus simply proportional to the local density of the cooperator strain. Using equations (11, 18a-18b), and setting we get

We can evaluate the fitness (per cell growth rate) of each strain as

We can then evaluate when cooperators are favoured by evaluating the inequality *w*_{A}>*w*_{B}, which gives

as the condition for cooperators to increase in frequency. This condition is more easily favoured for lower costs of cooperation (low *c*), higher benefits of cooperation (high *b*), and with spatial fluctuations that are of large amplitude (high *a*) and over a wide spatial scale (low *β*).

Inequality 24 shows that cooperation can be favoured by spatial variance in the population composition. However, in the absence of outside forces or stochastic effects will such spatial fluctuations be maintained? To answer this, we first evaluate an expression for the change in the density/volume fraction of the cooperator strain giving

which is always negative, meaning that the cooperator strain is always locally decreasing in frequency, even when globally increasing in frequency. This means that the change in cooperator frequency cannot match the sign of the spatial fluctuation , and thus in the absence of external forces any spatial fluctuations in composition will be lost. As we can see from inequality 24 as the amplitude of the fluctuation decays to zero (*a* approaches 0) cooperation cannot be favoured, and thus without killing, external perturbations to the system or stochastic effects are required to maintain the spatial structure necessary to maintain cooperation.

## Spatial model with killing

We now set and evaluate the consequences of the combination of killing and a spatial environment of the dynamics of cooperation. From our assumptions, the dynamics are now given by

We can again evaluate the fitness of each strain as in equations (23a-23b), , and derive the condition for the cooperative strain to be favoured (*w*_{A}>*w*_{B}) as

Note that if the cooperator and cheater strains are at equal average density (*A*_{0}=*B*_{0}) this simplifies to the inequality given in 24. As the amplitude of the spatial fluctuation must be less than the average density of the less abundant of the two strains the condition given in inequality 27 is more easily satisfied than that in inequality 24 whenever *A*_{0}>*B*_{0} and less easily satisfied whenever *A*_{0}<*B*_{0}. This occurs owing to the positive frequency dependence introduced by killing. However, as we will show, unlike in a spatial environment without killing, killing in a spatial environment can increase structuring, thus further favouring cooperation.

Comparing inequality 27 (condition for cooperation to increase in frequency in a spatial environment with killing) with inequality 20 (condition for cooperation to increase in frequency in a non-spatial environment with killing), we can also see that the presence of spatial heterogeneity means that the cooperator can be favoured even when numerically less abundant in a spatial environment with killing (that is, inequality 27 can be satisfied when inequality 20 is not). This occurs as spatial heterogeneity can allow cooperators to disproportionately gain the benefits of cooperation compared with cheaters.

Finally, we will show that killing causes phase separation in a spatial environment when one strain is a cooperator and the other a cheat. We follow the same approach as before and consider whether a spatial fluctuation around the homogenous coexistence equilibrium given in equations (17a-17b), will be amplified, which can be evaluated by considering if δ*ϕ*_{A}/δ*t* has the same sign as the fluctuation sin *βx*. At any point of zero compositional fluctuation (*x*=*nπ*/*β*, where ), δ*ϕ*_{A}/δ*t*=0 and this condition cannot be fulfilled. However, the condition for δ*ϕ*_{A}/δ*t* and sin *βx* to have the same sign in a region of non-zero fluctuation (*x*≠*nπ*/*β*, where ) in the limit of an infinitesimally small amplitude for the compositional fluctuation (*a*→0) is

This shows that killing promotes phase separation of cooperator and cheater strains in a spatial environment which favours cooperators of cheats as shown in inequality 27.

Taken together, these results show that: (1) Killing in a non-spatial environment can protect cooperators from cheats when the cooperator is at higher abundance. However, cooperators cannot invade from rarity; (2) Heterogeneity in a spatial environment without killing can favour cooperators over cheats. However, in the absence of any external forces or stochastic effects (for example., bottlenecking during range expansion) this structure will ultimately be lost, allowing cheaters to win; and (3) In a spatial environment with killing phase separation can occur, protecting cooperators from cheats and potentially allowing them to invade from rarity.

## Parameter values for numerical simulations of PDE model

Equations were numerically evaluated in R. Parameter values for figures and videos are as follows: Figs 1 and 2 and Supplementary Movie 2: *r*=2, *s*=2, *α*_{AB}*=*0.5, *α*_{BA}*=*0.5, *d*=0.01; Supplementary Fig. 5: *r*=2, *s*=2, *α*_{AB}*=*0.5, *α*_{BA}*=*0.5; Supplementary Movie 4: *r*=2, *s*=2, *α*_{AB}*=*0.5, *α*_{BA}*=*0.5, and *d* as indicated in the panels; Fig. 3 and Supplementary Movie 5: *r*=2, *s*=2, *α*_{AB}*=*0.5, *α*_{BA}*=*0.5, *d*=0.01, *b*=1.9, *c*=0.1, *D*=0.1, *λ*=100, *ρ*=100.

## Code availability

All code is available from the authors upon request.

## Data availability

All data sets generated or analysed during this study are included in this published article (and its Supplementary Information files) or are available from the corresponding authors upon request.

## Additional information

**How to cite this article:** McNally, L. *et al*. Killing by Type VI secretion drives genetic phase separation and correlates with increased cooperation. *Nat. Commun.* **8,** 14371 doi: 10.1038/ncomms14371 (2017).

**Publisher’s note**: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## References

- 1.
Nadell, C. D., Drescher, K. & Foster, K. R. Spatial structure, cooperation and competition in biofilms.

*Nat. Rev. Microbiol.***14**, 589–600 (2016). - 2.
Kümmerli, R., Griffin, A. S., West, S. A., Buckling, A. & Harrison, F. Viscous medium promotes cooperation in the pathogenic bacterium

*Pseudomonas aeruginosa*.*Proc. R. Soc. B***276**, 3531–3538 (2009). - 3.
West, S. A., Griffin, A. S., Gardner, A. & Diggle, S. P. Social evolution theory for microorganisms.

*Nat. Rev. Microbiol.***4**, 597–607 (2006). - 4.
Oliveira, N. M., Niehus, R. & Foster, K. R. Evolutionary limits to cooperation in microbial communities.

*Proc. Natl Acad. Sci.***111**, 17941–17946 (2014). - 5.
Hibbing, M. E., Fuqua, C., Parsek, M. R. & Peterson, S. B. Bacterial competition: surviving and thriving in the microbial jungle.

*Nat. Rev. Microbiol.***8**, 15–25 (2010). - 6.
Diggle, S. P., Griffin, A. S., Campbell, G. S. & West, S. A. Cooperation and conflict in quorum-sensing bacterial populations.

*Nature***450**, 411–414 (2007). - 7.
Buckling, A.

*et al.*Siderophore-mediated cooperation and virulence in*Pseudomonas aeruginosa*.*FEMS Microbiol. Ecol.***62**, 135–141 (2007). - 8.
Hammerschmidt, K., Rose, C. J., Kerr, B. & Rainey, P. B. Life cycles, fitness decoupling and the evolution of multicellularity.

*Nature***515**, 75–79 (2014). - 9.
Sanchez, A. & Gore, J. Feedback between population and evolutionary dynamics determines the fate of social microbial populations.

*PLoS Biol.***11**, e1001547 (2013). - 10.
Travisano, M. & Velicer, G. J. Strategies of microbial cheater control.

*Trends Microbiol.***12**, 72–78 (2004). - 11.
Damore, J. A. & Gore, J. Understanding microbial cooperation.

*J. Theor. Biol.***299**, 31–41 (2012). - 12.
Fletcher, J. A. & Doebeli, M. A simple and general explanation for the evolution of altruism.

*Proc. R. Soc. B: Biol. Sci.***276**, 13–19 (2009). - 13.
Vos, M. & Velicer, G. J. Isolation by distance in the spore-forming soil bacterium

*Myxococcus xanthus*.*Curr. Biol.***18**, 386–391 (2008). - 14.
Strassmann, J. E. & Queller, D. C. Fine-scale spatial ecology drives kin selection relatedness among cooperating amoebae.

*Evolution***70**, 848–859 (2016). - 15.
Van Dyken, J. D., Müller, M. J., Mack, K. M. & Desai, M. M. Spatial population expansion promotes the evolution of cooperation in an experimental Prisoner’s Dilemma.

*Curr. Biol.***23**, 919–923 (2013). - 16.
Momeni, B., Waite, A. J. & Shou, W. Spatial self-organization favors heterotypic cooperation over cheating.

*eLife***2**, e00960 (2013). - 17.
Estrela, S. & Brown, S. P. Metabolic and demographic feedbacks shape the emergent spatial structure and function of microbial communities.

*PLoS Comput. Biol.***9**, e1003398 (2013). - 18.
Farrell, F., Marchetti, M., Marenduzzo, D. & Tailleur, J. Pattern formation in self-propelled particles with density-dependent motility.

*Phys. Rev. Lett.***108**, 248101 (2012). - 19.
Strassmann, J. E., Gilbert, O. M. & Queller, D. C. Kin discrimination and cooperation in microbes.

*Ann. Rev. Microbiol.***65**, 349–367 (2011). - 20.
Wong, M.

*et al.*Microbial herd protection mediated by antagonistic interaction in polymicrobial communities.*Appl. Environ. Microbiol***82**, 6881–6888 (2016). - 21.
Ghoul, M. & Mitri, S. The ecology and evolution of microbial competition.

*Trend Microbiol.***24**, 833–845 (2016). - 22.
Chao, L. & Levin, B. R. Structured habitats and the evolution of anticompetitor toxins in bacteria.

*Proc. Natl Acad. Sci.***78**, 6324–6328 (1981). - 23.
Rendueles, O., Amherd, M. & Velicer, G. J. Positively frequency-dependent interference competition maintains diversity and pervades a natural population of cooperative microbes.

*Curr. Biol.***25**, 1673–1681 (2015). - 24.
Ho, B. T., Dong, T. G. & Mekalanos, J. J. A view to a kill: the bacterial type VI secretion system.

*Cell Host Microbe***15**, 9–21 (2014). - 25.
Russell, A. B., Peterson, S. B. & Mougous, J. D. Type VI secretion system effectors: poisons with a purpose.

*Nat. Rev. Microbiol.***12**, 137–148 (2014). - 26.
Pukatzki, S.

*et al.*Identification of a conserved bacterial protein secretion system in*Vibrio cholerae*using the*Dictyostelium*host model system.*Proc. Natl Acad Sci.***103**, 1528–1533 (2006). - 27.
MacIntyre, D. L., Miyata, S. T., Kitaoka, M. & Pukatzki, S. The

*Vibrio cholerae*type VI secretion system displays antimicrobial properties.*Proc. Natl Acad. Sci.***107**, 19520–19524 (2010). - 28.
Unterweger, D.

*et al.*Constitutive type VI secretion system expression gives*Vibrio cholerae*intra-and interspecific competitive advantages.*PLoS ONE***7**, e48320 (2012). - 29.
Brooks, T. M., Unterweger, D., Bachmann, V., Kostiuk, B. & Pukatzki, S. Lytic activity of the

*Vibrio cholerae*type VI secretion toxin VgrG-3 is inhibited by the antitoxin TsaB.*J. Biol. Chem.***288**, 7618–7625 (2013). - 30.
Dong, T. G., Ho, B. T., Yoder-Himes, D. R. & Mekalanos, J. J. Identification of T6SS-dependent effector and immunity proteins by Tn-seq in

*Vibrio cholerae*.*Proc. Natl Acad. Sci.***110**, 2623–2628 (2013). - 31.
Unterweger, D.

*et al.*The*Vibrio cholerae*type VI secretion system employs diverse effector modules for intraspecific competition.*Nat. Commun.***5**, 3549 (2014). - 32.
Bernardy, E. E., Turnsek, M. A., Wilson, S. K., Tarr, C. L. & Hammer, B. K. Diversity of clinical and environmental isolates of

*Vibrio cholerae*in natural transformation and contact-dependent bacterial killing indicative of type VI secretion system activity.*Appl. Environ. Microbiol.***82**, 2833–2842 (2016). - 33.
Borenstein, D. B., Ringel, P., Basler, M. & Wingreen, N. S. Established microbial colonies can survive Type VI secretion assault.

*PLoS Comput. Biol.***11**, e1004520 (2015). - 34.
Hamilton, W. D. Geometry for the selfish herd.

*J. Theor. Biol.***31**, 295–311 (1971). - 35.
Heermann, D. W. & Binder, K.

*Monte Carlo Simulation in Statistical Physics*Springer-Verlag (2010). - 36.
Townsley, L., Mangus, M. P. S., Mehic, S. & Yildiz, F. H. Response of

*Vibrio cholerae*to low-temperature shift: CpsV regulates type VI secretion, biofilm formation, and association with zooplankton.*Appl. Environ. Microbiol***82**, 4441–4452 (2016). - 37.
Lu, P. J.

*et al.*Gelation of particles with short-range attraction.*Nature***453**, 499–503 (2008). - 38.
Brown, G., Rikvold, P. A. & Grant, M. Universality and scaling for the structure factor in dynamic order-disorder transitions.

*Phys. Rev. E***58**, 5501 (1998). - 39.
Ala-Nissila, T., Majaniemi, S. & Elder, K. in

*Novel Methods in Soft Matter Simulations*357–388Springer (2004). - 40.
Allen, S. M. & Cahn, J. W. Ground state structures in ordered binary alloys with second neighbor interactions.

*Acta Metall.***20**, 423–433 (1972). - 41.
Queller, D. & Goodnight, K. Estimation of genetic relatedness using allozyme data.

*Evolution***43**, 258–275 (1989). - 42.
Buttery, N. J.

*et al.*Structured growth and genetic drift raise relatedness in the social amoeba*Dictyostelium discoideum*.*Biol. Lett.***8**, 794–797 (2012). - 43.
Drescher, K.

*et al.*Solutions to the public goods dilemma in bacterial biofilms.*Curr. Biol.***24**, 50–55 (2014). - 44.
Nadell, C. D.

*et al.*Cutting through the complexity of cell collectives.*Proc. R. Soc. Lond. B: Biol. Sci.***280**, 20122770 (2013). - 45.
Griffin, A. S., West, S. A. & Buckling, A. Cooperation and competition in pathogenic bacteria.

*Nature***430**, 1024–1027 (2004). - 46.
Majerczyk, C., Schneider, E. & Greenberg, E. P. Quorum sensing control of Type VI secretion factors restricts the proliferation of quorum-sensing mutants.

*eLife***5**, e14712 (2016). - 47.
Celiker, H. & Gore, J. Cellular cooperation: insights from microbes.

*Trend Cell Biol.***23**, 9–15 (2013). - 48.
Driscoll, W. & Pepper, J. Theory for the evolution of diffusible external goods.

*Evolution***64**, 2682–2687 (2010). - 49.
Borgeaud, S., Metzger, L. C., Scrignari, T. & Blokesch, M. The type VI secretion system of

*Vibrio cholerae*fosters horizontal gene transfer.*Science***347**, 63–67 (2015). - 50.
Nogueira, T.

*et al.*Horizontal gene transfer of the secretome drives the evolution of bacterial cooperation and virulence.*Curr. Biol.***19**, 1683–1691 (2009). - 51.
Liu, Q. X.

*et al.*Phase separation explains a new class of self-organized spatial patterns in ecological systems.*Proc. Natl Acad. Sci. USA***110**, 11905–11910 (2013). - 52.
Liu, Q.-X.

*et al.*Phase separation driven by density-dependent movement: a novel mechanism for ecological patterns.*Phys. Life Rev.***19**, 142–146 (2016). - 53.
Turing, A. M. The chemical basis of morphogenesis.

*Philos. Trans. R. Soc. Lond. B: Biol. Sci.***237**, 37–72 (1952). - 54.
Kondo, S. & Miura, T. Reaction-diffusion model as a framework for understanding biological pattern formation.

*Science***329**, 1616–1620 (2010). - 55.
Cahn, J. W. & Hilliard, J. E. Free energy of a nonuniform system. I. Interfacial free energy.

*J. Chem. Phys.***28**, 258–267 (1958). - 56.
Wittkowski, R.

*et al.*Scalar φ4 field theory for active-particle phase separation.*Nat. Commun.***5**, 4351 (2014). - 57.
Fily, Y. & Marchetti, M. C. Athermal phase separation of self-propelled particles with no alignment.

*Phys. Rev. Lett.***108**, 235702 (2012). - 58.
Bais, H. P., Vepachedu, R., Gilroy, S., Callaway, R. M. & Vivanco, J. M. Allelopathy and exotic plant invasion: from molecules and genes to species interactions.

*Science***301**, 1377–1380 (2003). - 59.
Jackson, J. & Buss, L. Alleopathy and spatial competition among coral reef invertebrates.

*Proc. Natl Acad. Sci.***72**, 5160–5163 (1975). - 60.
Cates, M., Marenduzzo, D., Pagonabarraga, I. & Tailleur, J. Arrested phase separation in reproducing bacteria creates a generic route to pattern formation.

*Proc. Natl Acad. Sci.***107**, 11715–11720 (2010). - 61.
Henkes, S., Fily, Y. & Marchetti, M. C. Active jamming: self-propelled soft particles at high density.

*Phys. Rev. E***84**, 040301 (2011). - 62.
Buttinoni, I.

*et al.*Dynamical clustering and phase separation in suspensions of self-propelled colloidal particles.*Phys. Rev. Lett.***110**, 238301 (2013). - 63.
Narayan, V., Ramaswamy, S. & Menon, N. Long-lived giant number fluctuations in a swarming granular nematic.

*Science***317**, 105–108 (2007). - 64.
Sanchez, T., Chen, D. T., DeCamp, S. J., Heymann, M. & Dogic, Z. Spontaneous motion in hierarchically assembled active matter.

*Nature***491**, 431–434 (2012). - 65.
Sanchez, T., Welch, D., Nicastro, D. & Dogic, Z. Cilia-like beating of active microtubule bundles.

*Science***333**, 456–459 (2011). - 66.
Spellings, M.

*et al.*Shape control and compartmentalization in active colloidal cells.*Proc. Natl Acad. Sci.***112**, E4642–E4650 (2015). - 67.
Risler, T., Peilloux, A. & Prost, J. Homeostatic fluctuations of a tissue surface.

*Phys. Rev. Lett.***115**, 258104 (2015). - 68.
Boyer, F., Fichant, G., Berthod, J., Vandenbrouck, Y. & Attree, I. Dissecting the bacterial type VI secretion system by a genome wide

*in silico*analysis: what can be learned from available microbial genomic resources?*BMC genomics***10**, 104 (2009). - 69.
Nadell, C. D. & Bassler, B. L. A fitness trade-off between local competition and dispersal in

*Vibrio cholerae*biofilms.*Proc. Natl Acad. Sci.***108**, 14181–14185 (2011). - 70.
Skorupski, K. & Taylor, R. K. Positive selection vectors for allelic exchange.

*Gene***169**, 47–52 (1996). - 71.
Edwards, R. A., Keller, L. H. & Schifferli, D. M. Improved allelic exchange vectors and their use to analyze 987P fimbria gene expression.

*Gene***207**, 149–157 (1998). - 72.
Li, J.

*et al.*SecReT6: a web-based resource for type VI secretion systems found in bacteria.*Environ. Microbiol.***17**, 2196–2202 (2015). - 73.
Peabody, M. A., Laird, M. R., Vlasschaert, C., Lo, R. & Brinkman, F. S. PSORTdb: expanding the bacteria and archaea protein subcellular localization database to better reflect diversity in cell envelope structures.

*Nucleic Acids Res.***44**, D663–D668 (2016). - 74.
Wilson, D.

*et al.*SUPERFAMILY—sophisticated comparative genomics, data mining, visualization and phylogeny.*Nucleic Acids Res.***37**, D380–D386 (2009). - 75.
Paradis, E., Claude, J. & Strimmer, K. . APE: analyses of phylogenetics and evolution in R language.

*Bioinformatics***20**, 289–290 (2004). - 76.
Hadfield, J. D. MCMC methods for multi-response generalized linear mixed models: the MCMCglmm R package.

*J. Stat. Softw.***33**, 1–22 (2010). - 77.
Gelman, A. & Rubin, D. B. Inference from iterative simulation using multiple sequences.

*Stat. Sci.***7**, 457–472 (1992). - 78.
Plummer, M., Best, N., Cowles, K. & Vines, K. CODA: Convergence diagnosis and output analysis for MCMC.

*R News***6**, 7–11 (2006). - 79.
Nakagawa, S. & Schielzeth, H. A general and simple method for obtaining R2 from generalized linear mixed-effects models.

*Methods Ecol. Evol.***4**, 133–142 (2013). - 80.
Newman, M. & Barkema, G. Monte Carlo Methods in Statistical Physics. 1999, Vol. 475 (Oxford, 1999).

## Acknowledgements

This work was supported by NSF grant #DEB-1456652 to W.R. and NASA Exobiology grant #NNX15AR33G to W.R.; by the Gordon and Betty Moore Foundation grant #4308.07 to B.H., NSF grant #MCB-1149925 to B.H. and Wellcome Trust grant #WT095831 to S.B. L.M. was supported by HFSP grant #RGP0011/2014 to S.B. We would like to thank David Yanni, Jonathan Michel, Shane Jacobeen and Wouter Ellenbroek for helpful comments.

## Author information

## Author notes

- Luke McNally
- & Eryn Bernardy

These authors contributed equally to this work

## Affiliations

### Centre for Immunity, Infection and Evolution, School of Biological Sciences, University of Edinburgh, Edinburgh EH9 3FL, UK

- Luke McNally

### Institute of Evolutionary Biology, School of Biological Sciences, University of Edinburgh, Edinburgh EH9 3FL, UK

- Luke McNally

### School of Biological Sciences, Georgia Institute of Technology. Atlanta, Georgia 30332, USA

- Eryn Bernardy
- , Jacob Thomas
- , Jennifer Pentz
- , Sam P. Brown
- , Brian K. Hammer
- & William C. Ratcliff

### School of Physics, Georgia Institute of Technology. Atlanta, Georgia 30332, USA

- Arben Kalziqi
- & Peter J. Yunker

## Authors

### Search for Luke McNally in:

### Search for Eryn Bernardy in:

### Search for Jacob Thomas in:

### Search for Arben Kalziqi in:

### Search for Jennifer Pentz in:

### Search for Sam P. Brown in:

### Search for Brian K. Hammer in:

### Search for Peter J. Yunker in:

### Search for William C. Ratcliff in:

## Contributions

All authors actively participated in the planning of this research. E.B., J.T. and B.H. constructed the *Vibrio* mutants and performed all bacterial experiments. E.B., J.T., P.J.Y. and A.K. performed and analysed the microscopy. L.M. and P.J.Y. wrote and analysed the PDE model. L.M. performed the phylogenetic analysis. W.R. wrote the individual-based model and script to calculate assortment, P.J.Y. and A.K. wrote the Ising spin model and script to calculate *S*(*q*). W.R., L.M., E.B. and P.J.Y. wrote the first draft of the paper, all authors contributed to revision.

## Competing interests

The authors declare no competing financial interests.

## Corresponding authors

Correspondence to Peter J. Yunker or William C. Ratcliff.

## Supplementary information

## PDF files

- 1.
### Supplementary Information

Supplementary Figures, Supplementary Tables and Supplementary References

- 2.
### Peer Review File

## Zip files

- 1.
### Supplementary Data 1

Data used in phylogenetic comparative analysis.

## Text files

- 1.
### Supplementary Data 2

Phylogenetic tree for Figure 4a.

## Videos

- 1.
### Supplementary Movie 1

Time-lapse of the individual based model. Both strains kill with equal probability. Each timestep, 5% of cells attempt to kill neighboring non-kin, and 5% of cells attempt to reproduce into an adjacent open patch.

- 2.
### Supplementary Movie 2

Time-lapse of the PDE model. Cellular mobility,

*d*, is 0.001. Other parameter values are*r*= 2,*s*= 2, α_{AB}= 0.5, α_{BA}= 0.5. - 3.
### Supplementary Movie 3

Time-lapse of the Ising spin model. Initial conditions correspond to infinite temperature, or completely random spins. Thermodynamic beta was set to unity and the eight nearest neighbors were considered. One generation is equivalent to an average of one spin-flip opportunity per site.

- 4.
### Supplementary Movie 4

Variation in cellular mobility,

*d*, within the PDE model. Higher rates of mobility delay the formation of clonal patches, but increase the rate of phase separation. - 5.
### Supplementary Movie 5

Public goods cooperation in the PDE model. In the leftmost panel cooperator frequency of 0 is represented by red and frequency of 1 by blue. In the center panel the concentration of public goods (produced by the cooperator) is indicated by intensity of yellow. In the rightmost panel the cell density is indicated by intensity of green. Parameter values are

*r*= 2,*s*= 2, α_{AB}= 0.5, α_{BA}= 0.5,*d*= 0.01,*b*= 1.9,*c*= 0.1,*D*= 0.1, λ = 100,*ρ*= 100.

## Comments

By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.

This work is licensed under a Creative Commons Attribution 4.0 International License. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in the credit line; if the material is not included under the Creative Commons license, users will need to obtain permission from the license holder to reproduce the material. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/