De novo evolved interference competition promotes the spread of biofilm defectors

Biofilms are social entities where bacteria live in tightly packed agglomerations, surrounded by self-secreted exopolymers. Since production of exopolymers is costly and potentially exploitable by non-producers, mechanisms that prevent invasion of non-producing mutants are hypothesized. Here we study long-term dynamics and evolution in Bacillus subtilis biofilm populations consisting of wild-type (WT) matrix producers and mutant non-producers. We show that non-producers initially fail to incorporate into biofilms formed by the WT cells, resulting in 100-fold lower final frequency compared to the WT. However, this is modulated in a long-term scenario, as non-producers evolve the ability to better incorporate into biofilms, thereby slightly decreasing the productivity of the whole population. Detailed molecular analysis reveals that the unexpected shift in the initially stable biofilm is coupled with newly evolved phage-mediated interference competition. Our work therefore demonstrates how collective behaviour can be disrupted as a result of rapid adaptation through mobile genetic elements.

B iofilms, consisting of densely packed single-or multispecies communities embedded in self-produced slimy polymers, represent the most common microbial life form [1][2][3] . Several recent studies have shown that the spatial structure of biofilms has a major impact on competition and cooperation among microbes and drives evolutionary changes within microbial communities (reviewed in refs 4,5). One particularly well-studied example used static cultures of Pseudomonas fluorescens, where an oxygen gradient led to the emergence of a new wrinkly (W) phenotype that secretes polysaccharides and forms a biofilm at the air-liquid interface 6,7 . Interestingly, biofilms formed by W undergo a premature collapse caused by the incorporation of another phenotype into the biofilm without sharing the metabolic costs of exopolymer production 8 . This scenario of biofilm collapse reflects the phenomenon known as 'tragedy of the commons', which happens due to invasion by non-cooperators and depletion of an overly-exploited resource (in this case the exopolymer) 9 .
How often the 'tragedy of the commons' happens in other biofilm communities remains an open question in sociomicrobiology. Several studies suggest that exopolymer production cannot easily be exploited by non-producing defectors 10,11 . Such robustness of cooperation-based biofilm formation is often explained by limited sharing of matrix components [10][11][12] , the low costs of polymer production 11 , the spatial assortment of cells in biofilms 13 or even the intrinsic nature of certain matrix components that are exclusively shared between mother and daughter cells 14 . Although the key principles of certain non-producer exclusion mechanisms are becoming clear, competition experiments involving producers and non-producers are usually conducted over short timescales [11][12][13][14] , leaving a window of opportunity for unexpected evolutionary scenarios 15 . Data from various bacterial models suggest that defectors can leave a fingerprint on the evolution of social strains and promote the evolution of novel cheating-suppression mechanisms 16 . These can be linked to lowering the cost of cooperation by the wild-type (WT) cells 17 . Selection can also work to the advantage of the non-producers, which can evolve better exploitation skills 15,17 . In extreme cases, cooperators can be de novo selected from the population of cheats 18 . In general, long-term scenarios in socially heterogeneous populations of microbes are still very difficult to predict.
In this manuscript, we study the long-term social dynamics of co-cultures comprising matrix producer and non-producer strains using the widespread soil bacterium Bacillus subtilis. B. subtilis forms thick, robust structures at the air-liquid interface (pellicle) facilitated by two crucial secreted compounds: an exopolysaccharide, Eps (encoded by epsA-O), and a protein component, TasA (encoded by tapA-sipW-tasA). In a standing culture, driven by oxygen limitation, matrix-producing strains form pellicles 19 . Strains lacking either one or both matrix components cannot form robust biofilms at the air-liquid interface and they barely colonize the liquid surface 20 . Moreover, strains producing only one of the components are able to complement each other and form a WT-like pellicle 20 . This strongly suggests that both matrix components secreted by producers are freely shared with non-producers and could therefore be exploited by non-producing mutants.
Here we show that on a short timescale, B. subtilis matrix non-producers have a tremendous disadvantage in co-culture with the WT. We further demonstrate how unexpected adaptive events involving mobile genetic elements can shift the social dynamics in the population and reduce biofilm formation.

Results
Biofilm non-producers are outcompeted from mixed pellicles. A positive result in a complementation assay of B. subtilis Deps and DtasA biofilm mutants suggests that both key biofilm components, Eps and TasA, can be shared (Fig. 1a) 20 . We therefore predicted that the double mutant Deps-DtasA, which cannot form a pellicle in monoculture 20 , would still be able to incorporate into the pellicle when co-cultured with the WT. To test our hypothesis, we mixed WT and Deps-DtasA strains in a 1:1 ratio and allowed the pellicle to form (see Methods). The final ratio of the WT to the Deps-DtasA strain was assessed by two alternative methods: antibiotic marker based colony forming unit (c.f.u.) counts (Fig. 1a) and fluorescence microscopy (here, GFP and mKATE2 producing WT and Deps-DtasA mutants were used, respectively, or we used the same strains with swapped fluorescent markers; Fig. 1b,c). Surprisingly both c.f.u. assay and microscopy indicated a dramatic advantage of the WT over Deps-DtasA; the latter was almost completely outcompeted from the pellicle formed by the WT (Fig. 1a-c). The incorporation success of Deps-DtasA into the pellicle was positively dependent on its initial frequency (Pearson's correlation coefficient r ¼ 0.74; Supplementary Fig. 1A). Specifically, the mutant showed increased pellicle incorporation, up to 23 ± 1.9%, which also correlated with decline in total c.f.u. of the pellicle, but only when its initial proportion was 450%, while at initial frequencies o50%, the pellicle incorporation ranged from 0.11 to 5% ( Supplementary Fig. 1A).
To understand if the availability of nutrients influenced the ability of non-producers to incorporate into the pellicle, the competition assay was repeated using a medium in which the broth and other components were doubled (4 Â SG, see Methods). It was observed that the Deps-DtasA strain could incorporate better in richer medium ( Supplementary Fig. 1B). Using 2 Â SG, the incorporation ability of the Deps-DtasA strain was 2% (mean; n ¼ 5; s.d. ¼ 1.37), while in 4 Â SG medium pellicle incorporation increased to 6.72% (mean; n ¼ 5; s.d. ¼ 3.40). Importantly, the starting ratios in these competition assays were identical (46.72% Deps-DtasA; mean; n ¼ 5; s.d. ¼ 14.4), therefore, the possibility of the initial frequency influencing these results could be excluded.
Finally, to ensure that the above result was caused by a mechanism that is specific to biofilm conditions and not simply caused by a growth defect of the Deps-DtasA strain, WT versus Deps-DtasA competition experiments were also performed in planktonic cultures where oxygen distribution is more homogenous and no fitness benefits from biofilm formation are to be expected 11,13,21 . In planktonic culture, Deps-DtasA had a strong fitness advantage over the WT (Fig. 1d) that is likely due to the release of the mutant from the metabolic costs of Eps and TasA production 13 , as also indicated by its higher growth rate in planktonic culture conditions ( Supplementary Fig. 1C). We therefore concluded that a specific mechanism prevents incorporation of the Deps-DtasA mutant into B. subtilis pellicles.
The ratio of non-producers increases during co-evolution. For the investigation of long-term dynamics in B. subtilis WT and Deps-DtasA mutant co-culture over time, a serial transfer experiment was conducted in conditions promoting pellicle formation (see Methods). During the evolution experiment, two transfer methods were applied: in transfer method A, the disrupted biofilm suspension was used directly for the inoculation of fresh medium; in transfer method B the disrupted biofilm suspension was heat-treated, thereby selecting only spores for the inoculation (for detailed description see Methods). Method B was chosen to select for individuals that successfully went through the entire biofilm life cycle.
The ratio of WT to the Deps-DtasA mutant was monitored by selective plating of frozen stocks prepared at different timepoints from the experiment, from the 2nd up to the final (10th) transfer. Despite the initial incorporation failure of Deps-DtasA into the pellicle (Fig. 1a-c), its representation in certain populations of transfer method B was observed to increase dramatically over longer timescales. Remarkably, in parallel populations where transfer method B was applied (that is, selection for spores), the fraction of the Deps-DtasA mutant was considerably higher after the 10th transfer than at the start of the experimental evolution in all but two replicates (Fig. 2b). Importantly, with several exceptions (in replicates 2 that remained relatively stable WT:Deps-DtasA ratio over time and replicate 4 that showed an outlying outburst of Deps-DtasA at passage 8), the percentage of the Deps-DtasA mutant was increased in each successive passage of these populations (Fig. 2b). The values rose to 430% in general and to a maximum of around 80% after the 10th transfer of replicate 5. Also, in one out of five parallel populations that were transferred by method A, the fraction of Deps-DtasA was slightly higher after the 10th transfer compared to that at the beginning of the evolution experiment (Fig. 2a).
Non-producers evolve to better incorporate into the pellicle. To further investigate the evolutionary phenomena involved in improved performance of Deps-DtasA in the evolved biofilm population, single clones of both the WT and Deps-DtasA mutant were isolated from three randomly chosen populations after the 10th transfer where an increase of Deps-DtasA in the pellicle was observed (replicates 3, 4 and 5 from transfer method B) (Fig. 2b). All evolved populations and single clones that were further analysed (or genetically modified) in this study are listed in Supplementary Table 2. For clarity, we refer to evolved matrix producers (WT strains) as eMP and to the evolved matrix nonproducers (Deps-DtasA) as eNMP.
First, to understand which of the co-cultured strains evolved to facilitate better incorporation of the mutant into the pellicle, a series of pellicle competition assays were performed. Competition assays revealed that all but one tested eNMP strains from populations B410m and B510m, and one isolate from population B310m, could increase their fraction within the pellicles as compared to their ancestor when co-cultured with the ancestor WT ( Fig. 3a,b). This result was confirmed by both c.f.u. assay (Fig. 3a) and fluorescence microscopy (Fig. 3b). Moreover, the ancestor Deps-DtasA performed even worse when co-cultured with the eMP strains compared to its performance against the WT ancestor (Fig. 3). Therefore, the eMPs completely suppressed the ancestral Deps-DtasA.
The performance of three selected eMP and eNMP representatives (one from each evolved population) against the WT ancestor was additionally determined by calculating the selection rate coefficient. All eMPs showed a positive selection rate and their relative c.f.u. in the pellicle was significantly higher that 50% ( Supplementary Fig. 3). However, the ancestor Deps-DtasA and eNMPs had negative selection rates, which indicates poor performance during competition with the ancestor WT. Nevertheless, the ancestor Deps-DtasA strain showed the poorest performance (selection rate value of À 3.36) and all the eNMPs, B310mA, B410mB and B510mC, revealed improved performance compared to the ancestor mutant strain, with selection rate values of À 2.59, À 1.14 and À 2.25, respectively.
Finally, the eNMPs were challenged with the eMPs selected from the corresponding populations (that is, B310mA versus B310wtA or B410mB versus B410wtB). We noticed that the eNMPs from population B310m exhibited a slight decrease in pellicle incorporation compared to their pellicle incorporation when in competition with the ancestor WT (Fig. 3). Overall the eMPs performed better at suppressing the eNMPs as compared to the WT ancestor, however, certain eNMPs from populations B410m and B510m still displayed significantly improved incorporation whether competing against the evolved or ancestor WT (Fig. 3). On the basis of these competition assays, we conclude that evolutionary changes in the Deps-DtasA mutant, rather than the WT, resulted in the improved performance of the non-producers in mixed pellicles.
It was further revealed that the incorporation success of the eNMPs did not depend on their initial frequency. Competition assays with different starting ratios of the WT ancestor to each of the eNMPs (B310mA, B410mB and B510mC) revealed that the eNMPs exhibited higher levels of pellicle incorporation regardless of their starting frequency ( Supplementary Fig. 1D-F). B310mA, B410mB and B510mC showed an average pellicle incorporation percentage of 9.13% (Pearson's correlation coefficient r ¼ 0.17), 18% (r ¼ 0.22) and 27% (r ¼ 0.16), respectively (Supplementary Fig. 1D-F).
Further experiments also revealed that, in contrast to the ancestor mutant ( Supplementary Fig. 1B), the incorporation percentage of the eNMP B310mA was not affected by doubling the concentration of resources in the medium ( Supplementary  Fig. 1B); the incorporation of the evolved B310mA was 9.54%±3.04% in 2 Â SG medium and 9.88%±2.04% in 4 Â SG. These results suggest that the incorporation efficiency of the eNMPs might be driven by a different mechanism from that in the ancestor Deps-DtasA.
Incorporation of eNMPs decreases biofilm productivity. A productivity assay was performed to understand the effect of increased incorporation of the eNMPs on the biofilm productivity and to compare the productivity of the eMPs relative to the ancestor WT. Productivity was measured by weighing the whole biomass of the pellicle and is represented as relative productivity compared with the ancestor WT (that is, ancestor WT productivity ¼ 1).
As expected, the productivity of the mixed pellicle consisting of the WT ancestor and mutant ancestor was very similar to the productivity of the WT ancestor grown alone, indicating that the presence of the ancestor Deps-DtasA did not affect the biofilm productivity (Fig. 4). This result agrees with our results showing that ancestor Deps-DtasA was almost completely outcompeted from the pellicle (Fig. 1a-c). In contrast, the productivity of pellicles containing both the ancestor WT and the eNMPs was lower than the productivity of the monoculture WT (productivity values o1), indicating that the population was negatively affected overall when eNMPs were present (Fig. 4). Interestingly, the eMPs in monocultures (B310wtA, B410wtB and B510wtC) had higher productivity than the WT ancestor ( Fig. 4; Supplementary  Fig. 4A). Finally, we examined the productivities of the evolved pairs with common evolutionary histories (B310wtA þ B310mA; B410wtB þ B410mB; and B510wtC þ B510mC). For all three pairs, the productivity of the mixed pellicles was lower than the productivity of the ancestor WT; however, these differences were statistically significant only for the pairs B410wtB þ B410mB and B510wtC þ B510mC (Fig. 4). Nevertheless, in all combinations, the eNMP þ eMP productivities were significantly lower than the corresponding eMP productivity, indicating reproducible  In transfer method (a), the pellicle was harvested, disrupted (see Methods) and the suspension of spores and cells was directly used for inoculation of new medium. After harvest and disruption, the cells in transfer method (b) were heat-treated at 70°C for 15 min to eliminate all vegetative cells. The resulting spore suspension was used to inoculate new medium and was incubated for 2-3 days to allow for pellicle formation. For transfer method (b), the gradual change of wild-type (grey) and Deps-DtasA (white) ratio during the evolution experiment is also presented. The ratio was followed during evolution experiments using the disrupted pellicle suspension directly. In addition, the ratio was redetermined from frozen glycerol stocks for the second, eighth and tenth pellicles. ARTICLE NATURE COMMUNICATIONS | DOI: 10.1038/ncomms15127 negative effects of the eNMPs on the productivity of the entire evolved population (Fig. 4). In addition, the pellicles formed by the populations from sequential evolutionary timepoints showed overall decreases in productivity in evolutionary time ( Supplementary Fig. 4B), presumably caused by the increasing frequency of eNMPs in pellicles (Fig. 2b).
These results show that although matrix producers evolved a higher productivity, higher incorporation of the coevolved matrix non-producers into the pellicle eventually decreased the overall population productivity.
eMPs and eNMPs contain multiple SNPs in prophage elements. To understand the genetic basis of the observed evolutionary dynamics, the genomes of three eMP and three eNMP populations separated from the 10th transfer of method B cultures (replicates 3, 4 and 5), where the frequency of non-producers was observed to increase during evolution (either gradually or periodically), were subjected to high-throughput sequencing (Supplementary Table 2). The genomes of corresponding three single isolates of eMPs (B310wtA, B410wtB and B510wtC) and three eNMPs (B310mA, B410mB and B510mC) from those populations were also sequenced. In addition, the genomes of the WT ancestor and the Deps-DtasA ancestor were resequenced to screen for any single SNPs that emerged before the evolution experiment during standard stock preparation and laboratory procedures. The sequencing of six populations (eMPs B310wt, B410wt and B510wt and eNMPs B310m, B410m and B510m) and six single isolates (B310wtA, B410wtB, B510wtC, B310mA, B410mB and B510mC) revealed multiple single-nucleotide polymorphisms (SNPs) exclusively accumulated in three distinct sites on the chromosome compared to the ancestors: two prophage-like regions previously described as prophage-like element 5 and prophage-like element 6 (ref. 22), and the SPb prophage region (Supplementary Data 1; Fig. 5a    Further analysis of the sequenced genomes revealed that there was also a large parallel mutational overlap between the evolutionarily unrelated populations and single isolates (regardless of WT or Deps-DtasA background; Supplementary Data 1; Fig. 6a,b). For visual representation of this overlap we produced a windowed-average identity score for the alignment of the entire 134 kbp SPb region of the evolved strains/populations to the ancestral SPb ( Supplementary Fig. 5A). A global analysis of SNPs from all six single isolates showed that the majority of SNPs represented synonymous substitutions (58%), 17% were non-synonymous but evolutionarily conserved (that is, similar; Blosum62 matrix scoreZ1), 9% were evolutionarily nonconserved and non-synonymous (Blosum62 matrix scorer0), and the remaining 16% of the substitutions were located in noncoding regions (Supplementary Fig. 5B). We also compared the distributions of SNPs in the eMPs and eNMPs by analysing the functions of affected genes. We observed that eMPs accumulated more SNPs than the corresponding eNMPs, especially in genes related to the toxin production and secretion (Supplementary Data 1; Supplementary Fig. 5D,E). However, most of the affected genes belonged to the unknown function category.
More detailed analyses of the sequencing data on the evolved strains suggested duplications of certain genome fragments and genome rearrangements compared to the ancestors. Duplications were indicated by the increased sequencing coverage within the SNP-containing regions (Supplementary Fig. 6A) and the striking pattern of SNP frequencies (Supplementary Data 1; Supplementary Fig. 6B), which was confirmed by PCR and Sanger sequencing of the particularly highly-mutated SPb fragment (2,178,034-2,179,407) from the genomic DNA of B310mA and B310wtA ( Supplementary Fig. 6C). Interestingly, the PCR product obtained from B310mA gave a clear chromatogram with all SNPs present, whereas B310wtA showed a heterogeneous chromatogram with double peaks in the positions of SNPs, one peak coming from an ancestor-like base and the other from the evolved-like base (Supplementary Fig. 6C). In addition, the SPb fragments could still be amplified by PCR even after deletion of the original SPb region from the chromosomes of B410mB and B510mC (Supplementary Fig. 6D-F). The identification of genome rearrangements was made after de novo assembly of sequencing reads into contigs (Fig. 6c). All of the predicted rearrangements involved sequences belonging to prophage-like elements 5 and 6 and various SPb fragments, and included the exact regions where multiple SNPs accumulated (Fig. 6c). The presence of two randomly selected rearrangements (contig type 1 and type 4) was confirmed by PCR to occur exclusively in the evolved strains; it did not occur in the ancestor WT or ancestor Deps-DtasA (Supplementary Fig. 6G). Altogether, we conclude that the emergence of multiple SNPs in all evolved strains (both eMPs and eNMPs) was linked to duplications and rearrangements within prophage elements in the B. subtilis genome. It is important to note that the mutation frequencies of the ancestor and the evolved strains were similar, as confirmed using fluctuation assays ( Supplementary Fig. 5C). The obtained mutation frequencies were comparable to previously reported data for other B. subtilis strains 23 , suggesting that the ancestor strains used here were not hypermutators. Moreover, when the same ancestor strain was evolved for B350 generations in emulsion droplets, 60 SNPs and short deletions were identified (Eisha Mhatre and Á .T. Kovács, unpublished data).
Hybrid SPb prophage shows lytic activity towards the ancestors. Rearrangements involving SPb prophage regions have previously been described as a result of the hybridization of SPb with another B. subtilis phage, phi3T (ref. 24). A hybrid form of SPb can undergo spontaneous excision from the chromosome to form a pseudolysogen, or it can enter a lytic cycle leading to active phage-particle release 24 . To verify whether the eMPs and eNMPs in the present study spontaneously released phage particles into the medium, phages were precipitated from the supernatants of cultures of selected evolved strains and of the WT ancestor (as a negative control) and visualized by transmission electron microscopy.
No phage particles could be detected in the precipitate obtained from the WT ancestor, which was in line with previous findings 25 . When the WT ancestor was grown in the presence of the prophage-inducing agent mitomycin C, PBSX-like phage particles were detected in its supernatant, which again reproduced previous results 26 (Supplementary Fig. 7A). However, even in the absence of mitomycin C, the evolved strains B410mB and B410wtB released two types of phage particles-PBSX-like particles with a small head and a rigid tail (assignment based on ref. 26), and SPb-like particles with a big head and a longer, flexible tail (assignment based on an image provided by Vladimir Lazarevic, Hôpitaux Universitaires de Genève, Switzerland, personal communication; Fig. 7a; Supplementary Fig. 7A). The addition of mitomycin C to B410mB and B410wtB cultures resulted in a dramatic increase in the number of SPb-like phage particles in the culture supernatants ( Supplementary Fig. 7A). SPb-like particles could not be detected in the supernatant of B310mA SPb À cultures, but were still present in B410mB SPb À cultures, which corresponded well with the results of molecular analysis, which indicated successful deletion of SPb from strain B310mA SPb À but not from B410mB SPb À ( Supplementary  Figs 6D-F and 7A). two-tail Po0.05). Boxes represent Q1-Q3, lines represent the median, and bars span from max to min. Each WT versus co-culture/eMP comparison was replicated at least twice. *-productivities significantly different from the WT ancestor. w-productivities significantly lower from the corresponding eMP cultures.
Next, the lytic activity of the SPb particles released by the evolved strains was tested against the ancestor strains. A series of plaque assays were performed where each strain served both as a supernatant donor and as potential prey. Neither of the ancestor strains (WT or Deps-DtasA) showed lytic activity when serving as the supernatant donor, but they were both susceptible to the lytic activity of almost all supernatants of the evolved strains (Fig. 6b, Supplementary Fig. 7B). Strain B310mA SPb À performed exactly the same as the ancestors, showing no lytic activity but displaying susceptibility to all supernatants, including that of B310mA (from which it was derived; Fig. 6b; Supplementary  Fig. 7B). Despite the fact that all evolved strains showed lytic activity and immunity, they could be differentiated into strong (for example, B410mB) and moderate levels (for example, B510wtC) ( Fig. 6b; Supplementary Fig. 7B). The lytic activity of the supernatants of all evolved populations was assessed, including all five populations from transfer method A and all five populations from transfer method B (Fig. 2). Strong lytic activity towards the ancestor WT strain was found exclusively in populations that showed an increased incorporation of non-producers into the pellicle following the evolution experiment, specifically population 2 from transfer method A, and populations 1, 3, 4 and 5 from transfer method B ( Supplementary  Fig. 7C). Further, populations that did not show increased incorporation of non-producers and lacked lytic activity towards the ancestor strains did not contain multiple SNPs within the SPb regions, as confirmed by Sanger sequencing of the 2,178,034-2,179,407 genomic fragment.  Spontaneous phage release by the evolved strains and their lytic activity towards the ancestors suggested that higher incorporation of the eNMPs into pellicles may be the result of newly evolved interference competition. We therefore examined whether the ancestor mutant could acquire the evolved-like phenotype with higher incorporation pellicle properties through a single-phage transduction step. For the infection assay, a 1:1 mixture of the WT and Deps-DtasA ancestors was introduced into standard 2 Â SG medium supplemented with phage precipitate obtained from B410mB where the presence of SPb-like phage particles was detected. After a single growth cycle, three colonies of the WT and three colonies of Deps-DtasA were isolated and their acquired lytic activity towards the ancestor strains was assessed. Finally, pellicle competition assays were performed using the WT ancestor and the three Deps-DtasA strains isolated from the infected population (ImA, ImB and ImC). As expected, the phage-infected strains behaved similarly to the evolved mutants, showing 44-fold (in the case of ImA) and 42.5-fold (ImB and ImC) increased incorporation rates into the pellicle compared with the ancestor mutant (Fig. 7).
Phage release facilitates higher pellicle inclusion of eNMPs. Finally, we asked whether the presence of an identical active phage variant in both producers and non-producers is sufficient to explain the higher incorporation of the eNMPs into pellicles. This was first tested by assaying the infected mutants (ImA, ImB and ImC) with the infected WT strains (Supplementary Fig. 8).
No increased pellicle incorporation of the mutants was observed, indicating that higher incorporation of the mutants cannot be explained by a general increase of phage activity in the entire population ( Supplementary Fig. 8), but is due instead to subtle differences within phage elements of evolved non-producers and producers.
This was further confirmed by a fitness assay that involved Deps-DtasA and WT strains with an isogenic evolved background. Isogenic evolved WT and mutant strains were obtained simply by introducing the Deps-DtasA deletions into eMPs. Genome resequencing confirmed that the obtained Deps-DtasA strains still contained the genetic background of corresponding eMPs (Supplementary Data 1). When the eMPs B310wtA, B410wtB and B510wtC were competed against their direct derivatives B310wtA Deps-DtasA , B410wtB Deps-DtasA , and B510wtC Deps-DtasA , respectively, a very low pellicle incorporation percentage of the mutants was observed, which was comparable to the performance of the ancestor Deps-DtasA against the ancestor WT (Supplementary Fig. 8). As expected, competition assays with the WT ancestor revealed that the transformants had comparable incorporation probabilities to the eNMPs (Fig. 7). These results indicated that although producers and nonproducers showed very similar general adaptation patterns involving major changes in mobile genetic elements, some of these changes were specific to the evolved non-producers, resulting in their improved incorporation into pellicles, most likely through an advantage in interference competition.

Discussion
Stability of cooperative interactions can determine the performance of microbes in most medically and biotechnologically relevant situations [27][28][29][30][31][32] . In recent years, understanding of microbial group behaviours and the mechanisms that prevent Specifically, the number of points was equal to a maximal log dilution factor where lytic activity was still present (for example, a lytic activity that can still be detected in a conditioned medium diluted to 10 À 3 but not 10 À 4 is denoted with 3 points). Obtained immunity and lytic activity scores were then divided by the maximum value of each and are presented as relative percentages. Darkness of the bars is proportional to immunity/lytic activity scores values. High immunity/lytic activity scores correlated with presence of SPb-like particles (black in the right-hand column) isolated from the culture medium of those strains. 'nt' indicates media were not tested by transmission electron microscopy. The experiment was independently replicated four times.
spreading of non-cooperative mutants has become one of the key aims of sociomicrobiology. Long timescale evolutionary experiments have already demonstrated the evolutionary plasticity of social interactions in various bacterial models 18,33,34 . Here we describe a scenario where a biofilm matrix non-producer that is initially eliminated from the population increases its performance over longer timescales and evolves the ability to better incorporate into the biofilm. The evolution of improved invasion of biofilms by non-producers was previously observed by Zhang et al. 15 . They excluded the possibility of general adaptation being responsible for the changed social dynamics in biofilms since the evolved producer did not increase its performance towards the ancestor producer. In the present work, an increased selection coefficient and improved productivity of the evolved WT could be observed in monocultures; the same, unfortunately, could not be tested for the evolved mutants because of their inability to form pellicles in monocultures. We therefore hypothesize that the evolved increased-biofilm-incorporation-ability of the mutant was a side effect of extremely fast general adaptation of both producer and non-producers driven by mobile genetic elements. Interestingly, the improved incorporation of the non-producers into biofilms was not reproduced when both WT and non-producer strains had identical evolved genetic backgrounds (that of the evolved WT strains). This means that although the general adaptation pattern in the entire population was very similar, the nonproducers are evolutionarily ahead of the producers and carry certain specific changes that allow their improved performance in incorporation into biofilms formed by the evolved WT strains. We believe those specific differences are hidden within prophage elements of the evolved strains, and they could be revealed by de novo sequencing in the future.
In the ancestral population, the matrix non-producers (Deps-DtasA, which do not secrete two key matrix components Eps and TasA) can hardly incorporate into pellicle biofilms formed by the WT. This result was rather unexpected for two reasons: first, previous work demonstrated that both Eps and TasA are shared with non-producing strains 20 , and, second, the production of at least one of those compounds (Eps) was proven to be costly and exploitable 13 . Although we did not study the competition mechanism in detail, a positive correlation between fitness, initial Deps-DtasA frequency and resource availability suggests that in the ancestral population the growth of Deps-DtasA is not only limited by the lack of oxygen, but also by carbon resources. We speculate that this is caused by a delay in surface co-colonization of Deps-DtasA, because the producer can partially privatize the matrix components. Since the WT is released from oxygen-limitation first, it can quickly deplete the remaining carbon resources, preventing further growth of the mutant. This model, however, awaits further studies.
The pellicle incorporation mechanism of evolved Deps-DtasA does not depend on resource concentration or on the initial frequency of the mutant in the co-culture. It is likely that new antagonistic interactions involving infection and lysis of the ancestor WT by the evolved mutant delay surface colonization by the WT, giving the mutant a prolonged window of opportunity for co-colonization. A similar mechanism could play a role in the competition between the evolved mutant and the evolved WT, since the evolved WT strains spontaneously release phages into the medium and show a delay in pellicle formation.
How did the new lytic properties evolve? We believe that multiple rearrangements in the genomes of the evolved strains, combined with series of SNPs in regions that were rearranged, resulted in new lytic properties of the normally inactive domesticated SPb prophage. Since this scenario was more likely to occur on sporulation treatment (that is, treatment method B), we suspect that the multiple heat-treatments involved in this treatment might have promoted phage activation 35 or even rearrangements of phage elements in the genome 36 . The accumulation of multiple SNPs and rearrangements resembles the previously reported evolutionary response of the Streptococcus thermophilus phage to the host's CRISPR system 37 , however, no CRISPR/Cas has yet been identified in B. subtilis. Alternatively, rapid diversification within prophage regions combined with lytic induction may be a universal adaptive pattern of bacteria to a biofilm lifestyle, as it was previously also observed during experimental evolution of Pseudomonas aeruginosa biofilms 38 . Our work also demonstrates how such newly evolved phage warfare shifts social dynamics in the bacterial population in favour of biofilm non-producers. The dynamics of host-phage interactions is long studied in various experimental systems 39 . It was previously observed that lytic phages can shift the balance in competitive interactions by reducing the frequency of a winning partner 40 , or impair biofilm formation ability as a tradeoff for phage immunity 41 . We hypothesize that in the case of the B. subtilis pellicles, the disadvantage of matrix producers could originate from the degeneration of toxin/secretion-related genes in the evolved wild-types that in turn became less efficient competitors than the evolved mutants.
The improved fitness of the evolved WT strain in monoculture could be a direct result of the evolved spontaneous phage release. Normally, the excision of the SPb prophage from the B. subtilis chromosome takes place before sporulation and allows reconstitution of the spsM gene involved in spore polysaccharide ; between the WT ancestor and three single colonies obtained after transduction of the Deps-DtasA ancestor with phage particles released by eNMP B410mB (n ¼ 2); and between the WT ancestor and eMPs (B310wtA, B410wtB, and B510wtC) with deleted eps and tasA (n ¼ 10; n ¼ 10; n ¼ 7, respectively). Boxes represent Q1-Q3, lines represent the median, and bars span from max to min. Each competition assay in parallel with the ancestor WT versus Deps-DtasA was replicated at least twice. biosynthesis 42 . Sanchez-Vizuete et al. 43 demonstrated that removal of SPb from the chromosome permanently restores spsM, resulting in increased biofilm thickness. We presume that frequent spontaneous excision of SPb, or even pseudolysogeny (as demonstrated in ref. 24) in the evolved WT strains, could positively contribute to the biofilm productivity through spsM reconstitution. Excision of prophage from the host chromosome was recently linked to improved biofilm formation by Shewanella oneidensis facing cold stress 44 . Such a phage excision benefited the host through gene inactivation rather than reconstitution (as observed in ref. 43). Similar genetic switches triggered by prophage excision were also described in several other species (reviewed in ref. 45). The B. subtilis SPb prophage carries a bacteriocin-immunity system 46 , several putative toxin-antitoxin systems 47 and cell wall hydrolases 48 . Several SPb segments of 4250 nucleotides exhibit 490% identity with B. subtilis chromosomal regions 25 promoting recombination events, especially in naturally competent strains. Not surprisingly, recent reports strongly indicate a key role of phage elements in rapid evolution of kin recognition mechanisms and antagonistic interactions between closely related, sympatric B. subtilis strains 49,50 . Accumulation of SNPs in the SPb region was also observed in the evolution experiments of Overkamp et al. 51 , where B. subtilis was kept in zero-growth conditions for 42 days. Among hundreds of SNPs discovered by Overkamp et al. 51 , 80% overlapped with the SNPs reported in this study. In addition, most of the SNPs detected were synonymous and evolutionarily conserved, suggesting selection against loss of function. Recent reports show that even non-synonymous mutations can positively contribute to fitness 52,53 . This again suggests that mutations or rearrangements within phage elements can be a very important evolutionary force in B. subtilis, with a major impact on social interactions. Recently, the profound impact of prophages on the evolution of a pathogenic bacterium was experimentally demonstrated in P. aeruginosa biofilms 54 , where the presence of phages resulted in strong selection against phage recognition elements (type IV pilus), at the same time enhancing parallel evolution 54 . Similar selective pressure could emerge after fast evolution of active SPb variants in B. subtilis biofilms, resulting in striking parallelism in evolved populations of both WT and Deps-DtasA bacteria.
Our work demonstrates how social dynamics in an initially very robust biofilm can be shifted by unexpected evolutionary events. We show that an adaptive genotype that is quickly tailored by mobile genetic elements can easily spread through horizontal gene transfer. The same adaptive path, although beneficial for the producer, became maladaptive in a mixed population where producers coexisted with non-producers.

Methods
Strains and cultivation conditions. Supplementary Table 1 describes strains used in this study and construction of their mutant derivatives. Strain B. subtilis 168 hymKATE P tapA -yfp was obtained by transforming the laboratory strain, B. subtilis 168, with genomic DNA from DL821 and selecting for MLS resistance. Subsequently, the created strain was transformed with genomic DNA from 168 hymKate and selecting on chloramphenicol resistance and for the loss of amylase activity. The Deps and DtasA strains were obtained by transforming the 168 strains with genomic DNA isolated from DL1032 and specifically selecting for tetracycline or kanamycin resistance, respectively. The double mutant Deps-DtasA was obtained by transforming 168 Deps with genomic DNA from DL1032 and selecting on the kanamycin marker. The Deps-DtasA hyGFP and Deps-DtasA hymKate strains were obtained by transforming the Deps-DtasA strain with genomic DNA obtained from 168 hyGFP and 168 hymKate, respectively. Deletion of epsA-O and tasA genes were confirmed with PCR using oligos described in Supplementary Table 3. Strains were maintained in LB medium (Lennox broth; Carl Roth, Germany), while 2 Â SG medium was used for biofilm induction 55 .
Experimental evolution and competition assays. Experimental evolution was performed using co-cultures of fluorescently labelled but otherwise WT and Deps-DtasA strains grown in 2 ml 2 Â SG medium statically in a 24-well plate at 30°C for 2-3 days. For transfer method A, the mature pellicles were harvested, mildly disrupted, and reinoculated after 100 Â dilution. For transfer method B, the pellicles were additionally heat-treated after disruption and diluted Â 20 during reinoculation. The sporulation frequency in the conditions applied in the evolution experiment was about 20% (Supplementary Fig. 2). To maintain similar selection bottlenecks in the two transfer methods, a fivefold lower dilution factor was used in transfer method B.
After the 2nd, 8th and 10th pellicle transfers, frozen stocks were preserved. Evolved populations or single isolates were isolated by selecting with appropriate antibiotics. Competition experiments were performed by mixing certain ratios of 100-fold diluted LB-pregrown cultures which were then incubated in static pellicle forming conditions for 3 days or in agitated planktonic cultures for 16 h. The numbers of c.f.u. of the inocula and the final cultures were determined on LB-agar plates containing selective antibiotics, incubated overnight at 37°C. Prior the c.f.u. assays, pellicles were sonicated according to a protocol optimized in our laboratory (2 cycles each containing 12 Â 1 s pulses at 20% amplitude with 1 s pause between the pulses), that ensured efficient disruption of biofilm clumps (as verified by microscopy) and therefore accurate total cell counts in the pellicles.
Microscopy. Bright field images of whole pellicles were obtained with an Axio Zoom V16 stereomicroscope (Carl Zeiss, Jena, Germany) equipped with a Zeiss CL 9000 LED light source and an AxioCam MRm monochrome camera (Carl Zeiss). The pellicles were also analysed using a confocal laser scanning microscope (LSM 780 equipped with an argon laser, Carl Zeiss) and Plan-Apochromat/1.4 Oil DIC M27 Â 63 objective. Fluorescent reporter excitation was performed with the argon laser at 488 nm and the emitted fluorescence was recorded at 484-536 nm and 567-654 nm for GFP and mKate, respectively. To generate pellicle images, Z-stack series with 1 mm steps were acquired. Zen 2012 Software (Carl Zeiss) was used for both stereomicroscopy and CLSM image visualization.
Productivity assay. For productivity assays, pellicles were inoculated into 4 ml of 2 Â SG medium placed in 35 mm-diameter Petri dishes and incubated for 3 days at 30°C. Next, the medium fraction was removed, and pellicles were dried at 55°C for 3 h. The dry biomass was determined on an analytical balance.
Fluctuation assay. To determine the mutation rate, single colonies were picked from LB-agar medium and cultivated for 18 h in LB broth at 37°C. After 100-times dilution in 2 Â SG medium, cultures (n ¼ 10 for each strain) were subsequently cultivated for 18 h with vigorous shaking, and dilution series were plated on LB-agar medium to assay the frequency of streptomycin (50 mg ml À l ) resistant c.f.u. after 18-24 h at 37°C.
Genome resequencing and genome analysis. Genomic DNA of selected populations or isolated strains was isolated using the EURex Bacterial and Yeast Genomic DNA Kit from cultures grown for 18 h. For the evolved population, single-end fragment reads were sequenced using a Life Technologies SOLiD 5500xl sequencer. Base-calling was carried out with the software provided by the supplier. All other downstream analysis steps were done in CLC Genomics Workbench Tool 7.0.4. Reads were length-filtered, keeping only Z50 nucleotide long fragments. Mapping used only those reads that displayed Z80% similarity to the reference genome (GenBank accession number AL009126) over Z60% of the read length (meaning an alignment of Z30 nucleotides having Z24 identical matches). Non-specific reads were randomly placed to one of their possible genomic locations. Quality-based SNP and small in/del variant calling was carried out requiring Z10 Â read coverage with Z20% variant frequency. Only variants suggested by good quality bases (QZ20) were taken into account. Furthermore, mutations had to be supported by evidence from both DNA strands.
For single isolate strains, paired-end fragment reads (2 Â 250 nucleotides) were generated using an Illumina MiSeq sequencer. Primary data analysis (base-calling) was carried out with MiSeq Reporter software (Illumina). All further analysis steps were done in CLC Genomics Workbench Tool 8.0.2. Reads were quality-trimmed using an error probability of 0.05 (Q13) as the threshold. Reads that displayed Z80% similarity to the reference genome (GenBank accession number AL009126) over Z80% of their read lengths were used in mapping. Non-specific reads were randomly placed to one of their possible genomic locations. Quality-based SNP and small In/Del variant calling was carried out requiring Z40 Â read coverage with Z20% variant frequency. Only variants supported by good quality bases (QZ20) were taken into account and only if they were supported by evidence from both DNA strands. Selected genomic regions were validated by Sanger sequencing (GATC Biotech, Konstanz, Germany) using oligos listed in Supplementary Table 3.
Transmission electron microscopy analysis. Selected bacterial strains were grown overnight in LB medium at 37°C with shaking at 200 r.p.m. In the case of mitomycin-C-treated cultures, mitomycin C was added in late exponential phase to a final concentration of 0.5 mg ml À 1 . Culture supernatants were collected, mixed at a 1:4 ratio with PEG-8000 solution (PEG-8000 20%, 2 M NaCl), incubated on ice for at least 90 min and finally centrifuged (20 min, 7,600 r.p.m.) to obtain precipitate. The pellet was resuspended in 10% of the original supernatant volume in TBS solution (50 mM Tris-HCl, 150 mM NaCl, pH 7), incubated on ice for 90 min and centrifuged (20 min, 7600 r.p.m.). Supernatant was carefully transferred to clean Eppendorf tubes. Purified samples (100 ml) were adsorbed onto duplicate 400 mesh carbon-coated Cu grids (Quantifoil, Grolöbichau, Germany) for 2 min. Before use, the carbon grids were hydrophilized by 30 s of electric glow discharging. The grids were washed twice in distilled water and stained for 30 s with 1% uranyl acetate. Virus morphologies were examined using a Zeiss CEM 902A transmission electron microscope (Carl Zeiss AG, Oberkochen, Germany). At least 20 images were taken per sample at different magnifications using a 1k FastScan CCD-Camera (camera and software from TVIPS, Munich, Germany).
Statistical analyses. Statistical differences between two experimental groups were identified using two-tailed Student's t-tests assuming equal variance. Variances in the two main types of datasets (c.f.u. counts in competition assays and weight of biomass) were similar across different samples. One data point with a value greater than the mean plus 3 times the s.d. was removed from the dataset of n410 as an outlier. Normal distributions within the two main data types (biomass and c.f.u.) were confirmed by Kolmogorov-Smirnov (P40.05). No statistical methods were used to predetermine sample size and the experiments were not randomized.
Data availability. The genome resequencing data are available in Supplementary Data 1. The authors declare that all other relevant data supporting the findings of the study are available within the article and its Supplementary Information files, or from the corresponding author upon request.