Introduction

One of the central questions in microbial evolutionary biology is understanding the mechanisms by which bacteria expand their ecological breadth. The niche shift hypothesis postulates that the process of adaptation to a different environment can result from rapid adaptive changes via mutation or horizontal gene transfer1,2, leading to diversification and opening the possibility of exploiting novel niches3. Bacteria may have to contend with novel stresses to adapt. This may often involve forming a biofilm, which generically increases tolerance to a broad range of stresses4. Such resilient surface-attached multicellular structures are ubiquitous and the prevalent prokaryotic lifestyle5.

In the context of host-microbe interactions, it has been shown that increased ability to form biofilm correlates with the capacity to replicate and colonize multiple hosts, whereas bacteria with narrow host ranges are usually poor biofilm-formers6,7. Within a host, biofilm formation offers numerous specific advantages, such as higher resistance to antimicrobials8 and to antibody-mediated killing and phagocytosis9. During competition with other members of the microbiome, it can also lead to niche exclusion of direct competitors10.

The Klebsiella pneumoniae species complex (KpSC) is a metabolically versatile group of seven distinct and closely related taxa of Klebsiella belonging to the Enterobacteriaceae family. KpSC includes the best-studied K. pneumoniae sensu stricto but also other species like K. variicola and K. africana11. KpSC are characterised by a very large carbon and nitrogen core metabolism12. This may partly explain its ubiquity and ecological breadth13,14,15. These bacteria can adopt a free-living lifestyle in the soil or in the water, but they are mostly studied in its host-associated form, colonizing plants, insects and mammals, including humans, where they can be a found as gut commensals. Hypervirulent strains of K. pneumoniae cause community-acquired infections which may result in pyogenic liver abscesses, but most of K. pneumoniae infections are opportunistic and health-care associated. They typically require a precolonization of the gastrointestinal epithelia prior to infecting other body sites11.

Several factors impact the ability of K. pneumoniae to form biofilm and colonise host tissue, most notably two chaperon-usher systems16: the type I fimbriae encoded by the fimA-K operon and the type III fimbriae encoded by the mrkA-I operon. The former has been shown to preferentially bind to mannose residues in E. coli but not in K. pneumoniae17, whereas the latter has high affinity to collagen18,19 and mediates adhesion to abiotic surfaces20. In silico studies have predicted the existence of many other chaperon–usher systems that could have specific tropism or be expressed in response to specific environmental cues21.

In addition to surface adhesins, another important factor determining biofilm formation in K. pneumoniae is the extracellular capsule22,23,24,25 produced by most isolates26. On the one side, some studies revealed that the capsule can strongly inhibit biofilm formation by masking surface adhesins24 or by altering surface physico-chemical properties and thus limiting surface attachment and inter-cellular interactions27,28. On the other side, presence of some Klebsiella capsules has been shown to increase the formation of biofilm and be required for its maturation22. Thus, the role of the capsule in biofilm formation is convoluted and depends both on the physical interactions between the capsule and the environment25, and the genetic interactions between the capsule locus and the rest of the genome23.

Numerous studies have focused on how different microbes increase biofilm formation by positively selecting for this trait29,30,31. Yet, how biofilm formation evolves when it is not under strong selection, or just as a mere by-product of the generic processes of adaptation is not currently understood. Indeed, adaptation of a given population to different novel environments may impact the ability of the population to adhere and form a biofilm. This can have important consequences, for instance, in host colonisation or increased tolerance to antibiotics. Here, we measured the evolution of biofilm formation to determine whether it latently changes when it is not specifically selected. If it does, we sought to enquire if this evolutionary process takes place in a progressive manner or evolves by leaps. We hypothesise that changes in biofilm could be the result of alterations in other phenotypic traits that were under strong selection in our evolution experiment, and which are known to affect biofilm formation. We thus specifically tested for correlation in changes in population yield or surface-attached polysaccharide production (capsule or others), and changes in biofilm formation. To link phenotype with genotype, we investigated whether the changes in biofilm formation were contingent with the presence of mutations in the two main types of fimbrial adhesins. Taken together our work highlights how the generic process of adaptation to non-biotic structured environments may promote the ability of a bacteria to form biofilm, and thus potentially expand its niche from the free-living environment to host colonisation.

Results

Changes in biofilm formation occur fast and depend on nutrient availability in the environment

To study how biofilm formation changed through time, we took advantage of a previous evolution study in which we evolved in parallel three different strains from the Klebsiella pneumoniae species complex32. Specifically, we propagated two hypervirulent K. pneumoniae strains (Kpn NTUH and Kpn BJ1; with K1 and K2 capsule serotypes, respectively) and one environmental K. variicola strain (Kva 342, K30 capsule serotype) as well as their non-capsulated isogenic mutants. The latter were generated by in-frame deletions of wcaJ, the first gene of the biosynthetic pathway and the gene most commonly mutated in lab-evolved non-capsulated clones32 and in genomic datasets26. From each of the six ancestral genotypes, six replicate populations were propagated in different liquid static environments varying in nutrient availability and thus, carrying capacity. Here, we analysed four of these environments: two with high carrying capacity (artificial sputum –ASM- and LB), and two with low carrying capacity (M02 and artificial urine -AUM-) (Supplementary Figure 1)32. The soil environment was not included here due to a very low carrying capacity of the media which was below the limit of detection of the biofilm assay. Each evolving population was grown for 24 h in 2 mL of media in 24-welled microtiter plates. Prior to the daily transfer, populations were re-homogenised by vigorous pipetting. Thus, biofilm formation either at the bottom of the well or in the air-liquid interface was not under positive selection. Then, 1% of the population was inoculated in fresh media. The evolution experiment ran for 102 days (~675 generations).

To understand how adaptation shapes the ability of a bacterium to form biofilm, we quantified biofilm formation in all evolving populations at regular intervals during the evolution experiment (day 15, 45, 75 and 102 – i.e. 100, 300, 500 and 675 generations) using the crystal violet staining method (see ”Methods” section). This method measures attached biofilm biomass. Taking all populations together, there was a fast and significant increase in the biofilm formation capacity by day 15 of ca + 36%, which continued until day 45 (ca + 50%; One-sample Wilcoxon Rank-Sum test, difference from 1, P < 0.001). Afterwards, a significant decrease is observed, to end up with total increase of ca ~ 27% at the end of the experiment (One-sample Wilcoxon Rank-Sum test, difference from 1, P = 0.01). We observed a high degree of parallel evolution across replicates of the same ancestral genotype in each environment (Supplementary Fig. 2A). Notwithstanding, there were large across-treatment differences between environments and genotypes (Supplementary Figure 2A). For instance, in Kva 342 populations, little change is observed in biofilm formation in populations evolving in M02, a steady increase is observed in LB, and divergent evolutionary paths were observed across capsule genotypes in ASM.

We had previously observed that the presence or absence of the capsule drives the direction and magnitude of evolutionary change in endpoint populations32, yet how it affects the evolutionary dynamics remained to be tested. Initial changes in biofilm formation were similar across both capsule genotypes (Fig. 1a). However, we observed divergent evolution between non-capsulated and capsulated populations towards the end of the evolution experiment, as biofilm formation in the latter decreased almost to ancestral levels (Fig. 1a). Such decrease was mostly observed in Kpn strains in environments with low carrying capacity, namely M02 and AUM (Supplementary Fig. 2A). We thus tested whether the nutrient availability of the environment influenced evolutionary dynamics. In nutrient-rich environments with high carrying capacities (ASM and LB), populations increased biofilm formation steadily throughout the duration of the experiment (Fig. 1b). In environments with lower carrying capacities, there was a similar increase in the ability to form biofilm compared to those in nutrient-rich, but this reverted fast to ancestral values (Fig. 1c). Multifactorial ANOVA revealed that changes in biofilm were strongly dependent on the interaction between capsule genotype and nutrient availability (F = 123.4, P < 0.001). Independently, nutrient availability (F = 59.95, P < 0.001) and the ancestral capsule genotype (F = 3.14, P = 0.01) also affected the evolution of biofilm formation.

Fig. 1: Changes in biofilm formation during ~675 generations.
figure 1

Biofilm formation was assessed using the crystal violet staining assay (see “Methods” section). Each population was tested in its evolutionary conditions, i.e. in 24-welled microtiter plates and different growth media. a Dynamics of biofilm formation in populations descending from capsulated (grey, N = 69) or non-capsulated ancestor (dotted, black, N = 72), relative to their respective ancestor, across all environments and strains. Grey points are shifted not to overlap with black points for visualisation purposes. Error bars indicate interval of confidence (α = 0.05). Statistics represent One-sample Wilcoxon Rank-Sum test, difference from 1. **P < 0.01 and ***P < 0.001. b Dynamics of biofilm formation in populations evolving in high carrying capacity environments (ASM and LB, dotted black, N = 36 in both) compared to low carrying capacities (AUM -N = 33- and M02 -N = 36-, in grey) relative to their respective ancestor, across all ancestral strains. Error bars indicate interval of confidence (α = 0.05). c Linear regression between the ancestral formation of biofilm per genotype (x-axis) and formation of biofilm after ~675 generations (grey line). Each point represents the average of the independently evolving populations. Vertical error bars reflect the diversity of evolutionary outcomes (standard deviation from the mean). Horizontal error bars represent experimental variance of the phenotype (interval of confidence, 95%). R2 is indicated (P-values P < 0.05, except for M02 where P = 0.09).

We then tested how end-point populations had evolved as a function of the ancestral capacity of biofilm formation in each environment. We observed a strong negative correlation across all environments between the ancestral ability of each genotype to form biofilm and the relative change in biofilm formation (Fig. 1c, P < 0.05 for all except M02). The less biofilm the ancestor could produce, the larger the increase in biofilm formation observed at the end of the experiment. Inversely, genotypes that were already proficient biofilm formers tended to decrease biofilm production, for example, capsulated Kpn NTUH in LB and ASM. This suggests that biofilm formation could be under stabilising selection in KpSC.

Taken together, large changes in the capacity of forming biofilm are observed during the first steps of adaptation to novel environments. At longer evolutionary times, such changes seem to be vary depending on the environment, and more precisely, in nutrient availability.

The environment determines how changes in population yield and surface polysaccharides influence biofilm formation

Adaptation to novel environments latently altered the ability of populations to form biofilm. Yet, our methodology to evaluate biofilm, i.e. by staining the extracellular matrix and attached cells with crystal violet, could be influenced by other variables, such as the changes in total population yield or in the production of surface polysaccharides. We tested how these two traits evolved throughout our evolution experiment (Supplementary Fig. 2B, C and Supplementary Table 1). Unfortunately, population yield in some capsulated populations could not be tested due to the emergence of hypermucoviscosity, which precludes accurate CFU assessment32. On average, evolving populations significantly increased yield (x̄ = +60%, One-sample Wilcoxon Rank-Sum test, P < 0.001) (Supplementary Fig. 2B and Supplementary Table 1), but as observed for biofilm formation, most changes occurred early during the evolution experiment. Similarly, surface polysaccharide production also increased (x̄ = +30%, One-sample Wilcoxon Rank-Sum test, P = 0.0001), but only in environments with high carrying capacity (Supplementary Fig. 2C and Supplementary Table 1).

To specifically test how changes in either yield or surface polysaccharides could influence biofilm formation, we correlated the degree of change relative to the ancestor of each of these two variables and the degree of change in biofilm formation. Despite the differences across ancestral genotypes, changes in both yield and surface polysaccharides were associated with changes in biofilm formation. However, such associations were different across environments and strongly depend on the carrying capacity of each environment (Fig. 2). In environments with high carrying capacity, we observed a positive correlation between both yield and surface polysaccharides with biofilm formation. But in environments with low carrying capacity (AUM and M02), biofilm formation negatively correlated with changes in yield and surface polysaccharides. Despite such general trends, there are many exceptions. For instance, Kva 342 populations evolving in ASM increased population yield, yet biofilm formation was reduced. The correlations explain only a small fraction of the observed changes in biofilm formation, as indicated by their low rho values.

Fig. 2: Correlation between changes in biofilm formation and co-evolving traits.
figure 2

Each shape corresponds to different days during the evolution experiment, and colours indicate different ancestral genotypes. Each dot is the average of at least three independent biological replicates. P-values correspond to a Spearman correlation test. Blue lines represent a linear regression model, and the grey shadow the confidence interval.

Overall, changes in adaptive traits like population yield and surface polysaccharide production correlated with changes in a latent phenotype, i.e. biofilm formation., but did not fully explain changes in the latter and depended on the environment to which populations were adapting.

Parallel adaptation in mrk operon

To understand the genotypic factors involved in changes in biofilm formation, we analysed the genomic sequences of one randomly chosen clone from each population. We hypothesised that the adaptation by repeated mutations in the mrk locus, which encodes for type III fimbriae, could be largely responsible for changes in biofilm formation (Supplementary Table 2). Indeed, our results show that populations in which mutations were detected in mrkD, the tip adhesin, but not in the rest of the operon, were associated with increased biofilm formation (Fig. 3a). Mutations in mrkD tend to accumulate in populations evolving in rich environments (56% population in ASM or LB vs only 9% of populations in AUM or M02) (Fig. 3b and Supplementary Fig. 3). This fits our abovementioned observation that populations evolving in environments with high carrying capacities form more biofilm. Despite a lower mutational supply in populations evolving in low-nutrient environments, changes in biofilm in these populations can be observed after just fifteen days. The absence of mutations in mrkD in these populations strongly suggests that other mutations present in the population can also impact biofilm formation (Figs. 1a and 2). Of note, most mutations in mrkD accumulate in the lectin binding domain (89%) which determines the binding specificity of the pili, in this case to type V collagen, as opposed to mutations in the pilin domain (11%), which would mostly influence the structure. Thus, this suggests that most mutations could be affecting surface affinity (Fig. 3d).

Fig. 3: Analyses of evolved populations with mutations in mrkD.
figure 3

a Biofilm formation of end-point evolved populations relative to their respective ancestor. Data is presented in the form of violin plots, with a line across the violin plot indicating the median. Additionally, each dot represents the average biofilm formation of at least three independent replicates of each individual evolving population. Different dot colours represent different ancestors. Populations were divided into four categories corresponding to whether the sequenced randomly chosen clone from each population had a mutation in mrkD, elsewhere in the mrk operon, on both mrkD and elsewhere, or no mutations in the operon (x-axis). Only populations with mutations in mrkD have increased biofilm formation. Statistics on top of violin plots represent One-sample Wilcoxon Rank-Sum test, difference from 1, **P < 0.01 and ***P < 0.001. b Number of clones in which each category of mutation was found, depending on the carrying capacity of the evolutionary environment: high carrying capacity (nutrient-rich) and low carrying capacity (nutrient-poor). ***P < 0.001, Fisher’s Exact test. c Frequency of different mrkD alleles in each population as estimated by QSVAnalyzer (blue lines), and capsulated clones (dashed grey lines) as per CFU counts. The difference in biofilm formation between each evolved population and the ancestor is depicted by the green lines. No mutations in mrkD were identified in populations 1A1 or 1D1 and are not represented here. d Identified mutations in mrkD in Kva 342 strain. Protein structure was predicted with AlphaFold60, and colored according to the pLDDT (predicted local distance difference test), that is, the AlphaFold score for confidence per residue. All base-pair deletions resulted in in-frame deletions. Dotted boxes correspond to mutations that were found in multiple populations, but not always observed at the end of the experiment.

The abovementioned correlations were performed based on the sequence of one randomly chosen clone in the population. To get a finer view of the effect of mrkD on biofilm formation, we followed the frequency of mrkD alleles in a subset of evolving populations and searched to understand if the frequency of the evolved allele correlated with changes in biofilm formation (Fig. 3c). We focused on Kva 342, an environmental strain which displayed the highest percentage of populations with mutations in the mrk operon (47% vs 22% and 29% in Kpn BJ1 and NTUH respectively) (Supplementary Table 2 and Supplementary Fig. 3) in ASM, a host-mimicking environment. We tested all evolving populations (including those that did not have mrkD mutations at the end of the evolution experiment). Surprinsingly, 10 out of the 12 populations had clones with mutations in mrkD at some point during the evolution experiment, even if most of them did not reach high frequencies or fix. Our data revealed that changes in biofilm formation were associated with changes in the frequency of evolved mrkD alleles in the population (GLM, R2 = 0.6, P = 0.005).

Because non-capsulated clones readily emerge in capsulated populations23,32, we also included the proportion of capsulated clones in the generalised linear model. This revealed that the changes in biofilm formation are also associated with the frequency of capsulated clones (P < 0.0001). We observed that in the two capsulated clones in which the mrkD allele fixated (i.e. population 1A3 or 1A5), the increase in biofilm formation correlated with an increase in frequency of mrkD evolved alleles (Fig. 3c). Further, these two populations were the only ones where newly emerged non-capsulated clones outcompeted all capsulated clones by the end of the experiments. In populations 1A4 and 1A6, the emergence of mrkD clones correlated with decreased frequency of capsulated clones, even though neither non-capsulated clones nor mrkD alleles fixated. These population dynamics could suggest that mrkD mutations do not emerge in capsulated backgrounds readily. Indeed, among the 141 evolving populations, mutations in the mrk operon are more frequent in the non-capsulated ones (46% vs 19% in capsulated populations, Fisher’s exact test P = 0.005). Alternatively, the observation that mrkD mutations only fix in non-capsulated backgrounds could suggest that mrkD mutations in a capsulated background emerge as readily but do not offer such a large fitness advantage (compared to those in non-capsulated backgrounds) and are outcompeted.

We thus tested whether mrkD mutations preferentially emerged in non-capsulated clones spontaneously appearing in the originally capsulated population, or whether there is no initial bias in the genetic background where these mutations appear but that milder selection in capsulated backgrounds limit their frequency in the population. We isolated six capsulated and six non-capsulated clones from each originally capsulated population at the time point in which the different mrkD alleles had reached a frequency of 0.5 in the population (Supplementary Table 3). Our results show that in some populations (1A5 and 1A6) mrkD mutations emerged in non-capsulated clones, suggesting that capsule inactivation precedes mutations in mrkD. But the opposite seems to occur in population 1A3. The mutation in mrkD emerges in a capsulated background, implying that capsule production is abolished later, leading to fixation of a non-capsulated mrkD-bearing clone shortly after (Supplementary Table 3). In population 1A2, the mrkD mutation emerged in capsulated clones, but eventually the genotype goes extinct. Interestingly, in population 1A4, two different mutations, G167C and T139P, emerge in either a capsulated and non-capsulated backgrounds, respectively. These data indicate that mrkD mutations can appear in both genetic backgrounds (Supplementary Table 3), but they seem to fix only when they are in a non-capsulated background. And the latter is independent of the background in which the mutations first emerged (Fig. 3c and Supplementary Table 3). Overall, our data shows that mutations in mrkD can be associated to changes in biofilm formation, but the latter seems to depend on more complex interactions between the capsule and the different evolved alleles.

Mutations in mrkD increase biofilm formation and reduce aggregation in K. variicola but not in K. pneumoniae

To disentangle the role of the different evolved mrkD alleles in biofilm formation and intercellular interactions, and how the capsule may affect these traits, we reverted mutations in mrkD to the ancestral state in all three strains. The reversion of mutations did not result in consistent changes in biofilm formation in K. pneumoniae or in K. variicola 342, (Supplementary Figs. 4A and S5A), except for the reversion of ∆37–40 in a capsulated background (1A2) that significantly reduced biofilm formation (Supplementary Fig. 5A). We hypothesised that mutations occurring after the mutation in mrkD could mask changes in the biofilm phenotype. Indeed, insertion of selected mrkD evolved alleles in both capsulated and non-capsulated backgrounds in Kva 342, revealed that mrkD mutations increased biofilm formation significantly, but only when the capsule was present (Fig. 4a and Supplementary Fig. 5B). Such increase was independent of the genetic context in which the mutation originated, that is, whether it had originally emerged in a capsulated or non-capsulated clone (Multiple-way ANOVA, df = 1, P > 0.05). Given previous studies showing that the capsule limits adhesin exposure33, we expected mutations in non-capsulated clones to have larger effects on biofilm formation. But, contrary to our expectations, we found no effect (Fig. 4a). Analysis of variance confirms that the presence of capsule strongly impacts the effect of mrkD mutations (Multiple-way ANOVA, df = 1, P < 0.001). In K. pneumoniae, the results were different: only the simultaneous insertion of two SNPs in mrkD resulted in significant increases of biofilm formation (Supplementary Fig. 5B). Our data implies that mutations in mrkD were not selected for their role in biofilm formation, as the repeated emergence of such mutations is not followed by similar changes at the functional level.

Fig. 4: Effect on biofilm formation and aggregation of evolved mrkD alleles in ancestral capsulated or non-capsulated Kva 342.
figure 4

a Biofilm formation is expressed relative to the ancestor (dashed line). b Aggregation is quantified by the absorbance (OD600) of the top layer of culture in static conditions after 4.5 h. High absorbance results from low aggregation levels. Calculation of the area under the aggregation curve results in qualitatively similar results. Each dot represents a clone with an independently evolved mutation. Full points represent mutants in which mrkD allele originally emerged in a clone descending from a capsulated ancestor whereas empty points represent mutants bearing mrkD alleles that emerged in non-capsulated ancestors. For individual visualisation of each mutation, and individual statistics see Supplementary Fig. 5. Statistics: two-sided paired t-tests. *P < 0.05,**P < 0.01, ***P < 0.001.

Because most mutations in mrkD were found in the lectin (collagen) binding domain (Fig. 3d), we tested whether these mutations could specifically impact cell-to-cell interactions. To do so, we measured the absorbance of the top layer of sitting cultures through time as a proxy for sedimentation. In such tests, high absorbance represents low sedimentation. Aggregation results confirm what was observed in biofilm formation, namely that in Kva 342, the mrkD allele (Multiple-way ANOVA, df = 1, P < 0.001), as well as the presence of the capsule (Multiple-way ANOVA, df = 1, P = 0.008), but not the ancestral background in which the mutation originally emerged (Multiple-way ANOVA, df = 1, P > 0.05), impacts aggregation. Specifically, most mutations significantly reduced aggregation relative to the ancestor in Kva342 (Fig. 4b and Supplementary Fig. 5C). No changes in aggregation were observed in mrkD mutants of K. pneumoniae.

Taken together, our data show that irrespective of the ancestral capsule genotype, mutations in mrkD increase biofilm formation in capsulated clones whilst diminishing cell-to-cell interactions in K. variicola but not in K. pneumoniae.

Non-capsulated K. pneumoniae populations revert the fim switch and form less biofilm

Analyses of mutations observed in end-point populations revealed that some Kpn NTUH population had clones that reversed the fim switch. The fim switch is a phase-variable inversion of a short DNA element (comprising the promoter), which results in an ON/OFF expression of the fim operon, responsible for the production, or not, of type I fimbriae34. Whereas in a wild-type population of Kpn NTUH type 1 fimbriae transcription is activated35, seventeen out of the 56 Kpn NTUH clones we sequenced had reverted fim switch, which should result in silencing of type I fimbriae. The reversions of the promoter did not depend on the ancestral capsule genotype but were dependent on the environment in which the population evolved. Switch reversal accumulated preferentially in environments with low-carrying capacities (Fisher’s test, P = 0.002), as opposed to mutations in mrkD which mostly accumulated in environments with high carrying-capacities (Fig. 5)

Fig. 5: Analyses of reversal of fim switch in evolved populations.
figure 5

a Tropism of fim switch reversal. The dashed horizontal line indicates the total frequency of fim switch in evolved clones. Fisher’s Exact test was used to compute difference in the distribution of mutations depending on media carrying capacity. ***P < 0.001. b Biofilm formation was assessed in the evolutionary treatment in which this mutation evolved. Each dot represents the average of three independent experiments of each individual population. Blue dots depict populations evolved in media with high carrying capacity and green indicates media with low carrying capacity. Statistics: Two-tailed One-sample t-test, difference from 1. ***P < 0.001, ns not significant.

We then tested whether Kpn NTUH populations with the reversed fim promoter displayed changes in biofilm formation. Analysis of variance revealed that variation in biofilm formation was not dependent on the environment (Multi-way ANOVA, df = 3, P > 0.05) nor on mutations in the fim promoter (Multi-way ANOVA, df = 1 and P > 0.05). In contrast, it was strongly associated with the ancestral capsule genotype (Multiway ANOVA, df = 1, P = 0.0003). Whereas in capsulated backgrounds, populations displaying changes in the fim switch did not result in differences in biofilm formation, in non-capsulated populations, populations with switch reversal produced less biofilm than those without (Fig. 5b). Despite the fact that the reversion of the fim switch is equally frequent in capsulated and in non-capsulated populations, it only seems to reduce biofilm formation in non-capsulated K. pneumoniae NTUH.

Mutations in mrkD are also found in natural and clinical isolates

The frequency of mrkD mutations prompted us to enquire whether mutations driving latent phenotypes in laboratory evolution experiments could reflect evolutionary paths occurring in natural isolates. To do so, we analysed all K. variicola and almost 10,000 random K. pneumoniae genomes available in the Pathosystems Resource Integration Center (PATRIC) genome database36. In K. variicola, we identified a total 689 MrkD proteins in 671 genomes (prevalence of 93.6%) (Supplementary Fig. 6). From these, 384 protein sequences differed from our ancestral Kva 342. A total of 55 different amino acid changes were identified, grouped in 42 unique MrkD protein sequences (Table 1). Among these, three mutations (found in ten different genomes) displayed amino acid changes in the same positions as proteins evolved in our evolution experiment (position #57, #73 and #249) (Fig. 6 and Table 1). Genomes with similar mutations were all host-associated, isolated from humans or cats, including one human sample isolated from lung sputum. In K. pneumoniae, we found a similarly high prevalence of MrkD (93.7%). Fourteen out of the 22 (~63%) different amino acid positions that were mutated in our evolution experiment, were also mutated in the natural isolates (Fig. 6 and Table 1). Taken together, the comparison of the mutations in MrkD in wild isolates and that observed in the laboratory reveals that the evolution experiments captured a broad range of the genetic diversity observed in natural populations.

Table 1 Summary statistics of genomes and comparison of MrkD sequences analysed from the public repository PATRIC.
Fig. 6: Comparison of MrkD mutations observed in natural isolates and our evolution experiment.
figure 6

Smoothed density plot (default parameters) of the distribution of SNPs in MrkD from K. variicola (green) and K. pneumoniae (blue). The inset recapitulates the frequency of amino acid changes in each position. The intensity of red represents the frequency.

Discussion

Latent phenotypes evolve neutrally during adaptation to novel environments. Such phenotypes do not significantly impact fitness, but they can be adaptive if the environmental conditions change. Recently, numerous experimental evolution studies have tested how adaptation to novel environments may impact latent phenotypes as they contribute to diversification37,38 or to exaptation39,40. Indeed, the resulting genetic variation has been called “evolution’s hidden substrate”41. Here we studied the diversification and evolution of one such latent phenotype, namely the ability to form biofilm. To do so, we took advantage of a previous evolution experiment where we analysed changes in capsule in end-point populations32. Here, we examined the temporal dynamics of 141 evolving populations, grown in static liquid cultures for over 675 generations. We evaluated how the environment and ancestral genotypes impact changes in population yield, surface polysaccharide production, and most importantly, biofilm formation throughout the course of evolution. We also tested association between biofilm formation, aggregation and the emergence of mutations in surface adhesins, and namely mrkD. We observed little within-treatment diversity in the evolutionary outcomes in latent evolution of biofilm formation. This contrasted with the divergent evolutionary outcomes observed across treatments. These were driven by the ancestral genotypes, but more importantly by nutrient availability.

The presence or absence of the capsule not only impacts the magnitude of change of adaptive phenotypes like yield at the end of the experiment, as shown previously32. It also impacts the evolutionary dynamics of latent phenotypes. The effects of the capsule on biofilm formation seem to be stronger at longer evolutionary time scales. For example, in the first one hundred generations, both capsulated and non-capsulated populations across all environments followed a similar dynamic of fast and large changes in biofilm formation. The impact of the capsule in biofilm dynamics could be a consequence of its effect on an adaptive trait, like increased population yield. Changes in yield are frequent at the beginning of evolution experiments42. This is expected as the most beneficial mutations are incorporated early in the process43. At longer evolutionary time scales, divergent evolutionary paths are observed in terms of biofilm formation depending on the presence of the capsule and on the carrying capacity of the environment. This suggests that these two factors critically alter the future ability of microbes to form biofilm, which affects the way they prevail and better colonise a surface (including the host).

We hypothesised that the repeated accumulation of mutations across the three strains in the type III fimbriae tip adhesin mrkD, would phenotypically impact the formation of biofilm because MrkD mediates the adhesion to cells and several extracellular matrix proteins44. However, the phenotypic consequences of such mutations were not similar. Specifically, we observed that mrkD mutations increased biofilm formation in the K. variicola strain, but not in the K. pneumoniae strains. Further, we observed that reversions of fim switch accumulate in only one K. pneumoniae (NTUH), but not in BJ1 or in the K. variicola strain. This suggests that the importance of this adhesin in biofilm formation could be strain-dependent. Computational analyses have revealed that K. pneumoniae strains have a rich arsenal of chaperon-usher (CU) systems. Most of these systems are cryptic in laboratory conditions21 and little is known about their expression and conservation patterns. In light of our results, further research evaluating the precise role of each system in the presence and absence of the other CU-systems would be a promising research venue to unravel the inter-adhesin interactions and how they influence biofilm formation. The relative expression of each CU-system across different strains and environments could significantly alter the contribution of each system in biofilm formation21.

A major finding of this study is that differences in nutrient availability led to the differential accumulation of mutations in mrkD. This raises the question of why mrkD mutations are selected specifically in nutrient rich but not in nutrient poor environments? We speculate that in nutrient rich medium, when higher carrying capacities are sustained, fitness advantages may often be the result of higher growth rates. Because single cells have higher intrinsic growth rates than aggregates, mutations leading to decreased cell aggregation would be selected45. However, when competition is high and resources scarce, cell aggregates have higher fitness than single cells45, thus mutations in mrkD may be counter-selected in nutrient-poor environments. Alternatively, there may be a specific tropism of the fimbriae. Selection can only act on what is being expressed in each environment. Thus, we can speculate that changes in fimbriae expression across the different environments are driving mechanisms of adaptation. For instance, we observe reversions of the fim switch in nutrient-poor environments, like AUM, where they are expressed and known to play an important role46. On the contrary, we do not observe many reversions of the fim switch in nutrient-rich environments, where they are not expressed i.e. during lung infection46. A similar tropism could explain accumulation of mutations in mrkD in certain environments but not in others. Finally, given that the mutations in mrkD do not result in consistent changes in biofilm formation and/or aggregation across ancestral genotypes (strain and capsule), we may also speculate that selection is acting on another phenotype influenced by mrkD and of particular relevance in nutrient-rich environments. If so, it would suggest that this CU-system may fulfil roles unrelated to biofilm formation.

Our study reveals an intricate relationship between the capsule and extracellular proteins. The effect of the fim switch is only visible in non-capsulated cells. This is not unexpected as it was initially shown that the capsule in Klebsiella limited biofilm formation, notably by masking the effect of type I fimbriae33 and other short adhesins such as Ag-43 and AIDA-124. Accordingly, when the capsule contributes to biofilms’ maturation and is highly expressed22, type I fimbriae are downregulated16 and not involved in intestine or lung colonisation34. However, in these conditions, type III fimbriae are highly expressed, suggesting a positive interaction between the capsule and this fimbriae during biofilm formation. Similarly, a recent report showed that, in conditions in which type III fimbriae is expressed, biofilm formation increases when capsule production is enhanced47. Indeed, in K. variicola, the mutations in MrkD only significantly increase biofilm in capsulated strains, but not in non-capsulated strains. Such differential increase of biofilm is interesting, as mrkD mutations indiscriminately impact aggregation irrespective of the presence or absence of the capsule. This highlights that the interaction between the capsule and type III fimbriae during biofilm formation cannot be reduced to a mere masking of surface receptors and depending on the context, they may act synergistically.

The repeated evolution of mutations on the lectin domain of the tip adhesin MrkD is similar to that recently observed in the lectin domain of the tip adhesin FimH of type I fimbriae in E. coli, in a study in which biofilm formation under continuous flow was positively selected30. The nature of the mutations was also found to be very similar between the two studies, especially the emergence of several short in-frame deletions across independent populations. Of note, some clones with mutations in fimH, as observed with clones with mutations in mrkD, did not significantly increase biofilm formation relative to the ancestor. This reinforces our hypothesis that there may be other selective pressures underlying the emergence and rise to such high proportions of mutations in the tip adhesin of chaperon-usher dependent fimbriae. Alternatively, they may play roles other than formation of biofilm, either directly or as a result of epistasis with other surface structures. Despite the differences in selection regimes between the two studies, the mutagenic convergence in the lectin domain of the tip adhesins in Klebsiella and E. coli suggests that proteins with similar functions undergo similar evolutionary trajectories.

At the population level, we observed a remarkable correlation between the presence of mutations in the tip adhesin mrkD and increased biofilm formation (Fig. 3a). Yet, this effect could not be fully recapitulated when these mutations were analysed individually in an ancestral background. This could be due to complex epistatic interactions, for instance, with the capsule or other surface structures. Alternatively, the effects of these mutations could be altered by the presence of other mutations in the genome. We had previously reported that some populations also had mutations in ramA32, involved in the stability of the outer membrane48. These could alter molecular interactions at the cell surface, including the adhesin-capsule interactions. Further, in Salmonella enterica Typhimurium, expression of ramA directly impacts biofilm formation49. Finally, the formation of biofilm can be regarded as a social behaviour and thus, strongly influenced by the within-population diversity. Indeed, our initial tests were performed with populations that we expected to have some genetic diversity. The effect of mutations in mrkD were analysed in isolation, and we could have missed some important clonal interference that could be influencing changes observed at the population level.

The impact of direct selection on important virulence-associated traits has been largely studied, yet, changes in traits that evolve latently are rarely addressed. This could be caused by the challenges of analysing the genetic basis of their evolution, since these phenotypes may not have a direct impact on fitness. The phenotypic changes resulting from specific mutations may not be easy to reveal and may strongly rely on complex epistatic interactions or within-population diversity. Previously, we showed how susceptibility to antimicrobials latently evolves as a result of mutations in ramA32. Here, we have shown that the ability to form biofilm changes greatly during evolutionary time, depending on the ecological conditions in which mrkD mutations emerge, and on the genetic context in which it is expressed. In conclusion, our studies highlight the need to include analyses of latent phenotypic evolution in the general framework of microbial adaptation, and more particularly in the evolution of virulence-associated traits of bacterial pathogens37,38.

Materials and methods

Bacterial strains and growth conditions

i. Strains. Three different strains from the Klebsiella pneumoniae species complex were used in this study32: one environmental strain, isolated from maize in the USA, K. variicola 342 (Kva 342, serotype K30)50, K. pneumoniae BJ1 from clonal group 380 (Kpn BJ1, serotype K2) isolated in France from a liver abscess12 and the hypervirulent K. pneumoniae NTUH K2044 (Kpn NTUH, serotype K1) from clonal group 23 isolated in Taiwan from a liver abscess51. ii. Environment description. AUM (artificial urine medium) and ASM (artificial sputum medium) were prepared as described previously52,53. AUM is mainly composed of 1% urea and 0.1% peptone with trace amounts of lactic acid, uric acid, creatinine and peptone. ASM is composed of 0.5% mucin, 0.4% DNA, 0.5% egg yolk and 0.2% amino acids. LB is composed of 1% tryptone, 1% NaCl and 0.5% yeast extract. M02 corresponds to minimal M63B1 supplemented with 0.2% of glucose as the sole carbon source. iii. Primers. Primers used in this study are listed in Supplementary Table 4.

Mutant construction

Isogenic mutants were constructed by allelic exchange. We inserted evolved mrkD alleles in capsulated and non-capsulated ancestors. We also reverted evolved alleles into ancestral state in evolved clones. To do so, the cloning vector pKNG101 plasmid was amplified using Q5 High Fidelity Master Mix (New England Biolabs) and digested by DpnI (NEB BioEngland) restriction enzyme for 30 minutes at 37 °C. The mrkD allele of interest (ancestor or evolved) was amplified using Q5 High Fidelity Master Mix (New England Biolabs). The vector and allele of interest were then assembled using the GeneArt™ Gibson Assembly HiFi kit (Invitrogen), electroporated into competent E. coli DH5α strain and selected on streptomycin LB plates. pKNG101 plasmids containing mrkD alleles were verified by PCR and purified using the QIAprep Spin Miniprep Kit. These were then electroporated again into E. coli MFD λ-pir strain, used as a donor strain for conjugation in Kva 342 ancestral strains or evolved clones. Single cross-over mutants (transconjugants) were selected on Streptomycin plates and double cross-over mutants were selected on LB without salt, supplemented with 5% sucrose, after 48 h of growth at room temperature. From each double-recombination, an evolved alelle and an ancestral allele were isolated. Mutants were verified by Sanger sequencing.

Emergence of mrk mutants

To test the allele frequencies of mrkD in the evolved populations, we took aliquots from the glycerol stock from days 7, 15, 30, 45, 75 and 100. These were diluted in water and used for PCR reaction using Phusion Master Mix (Thermo Scientific). Purified PCR products were sequenced by Sanger. The frequency of the mutations was calculated using high quality chromatograms analysed by QSVanalyzer54 with default parameters. Of note, the limit of detection of QSVanalyzer is estimated at 5%.

Trait quantification

To initiate the different measurements, each population was grown overnight and 20 μL of each culture was inoculated into 1980 μL of the relevant growth media in 24-well microtiter plates and allowed to grow for 24 h without shaking at 37 °C. Populations evolving in poor media (M02 and AUM) were diluted 1:100 and allowed to grow for another 24-hours extra prior to the experiment, as we noticed that preconditioning was important for reproducibility. Overnight cultures were not adjusted as all populations had time to reach stationary phase and reach the maximum carrying capacity of the growth media (i) Biofilm formation. The capacity of a population or an isolated clone to form a biofilm was measured using the crystal violet staining method as previously described55, with minor volume modifications to cover the 24-welled microtiter plate wells. Briefly, unbound cells were removed by washing once in distilled water. To stain biofilms, 2100 μL of 1% crystal violet was added to each well for 20 min. The crystal violet was decanted and washed thrice with distilled water. The plates were allowed to dry under a laminar flow hood. Then, the biofilm was solubilized for 10 min in 2300 μL of a mix with 80% ethanol and 20% acetone. Then, 200 μL of each solubilized stain was transferred into a well of a 96-well plate. The absorbance of the sample was read at OD590nm. (ii) Population yield. Each well was homogenised by vigorous pipetting and then serially diluted in fresh LB and plated to count CFU after 24 h of growth. For most capsulated populations in LB and ASM, due to the extreme hypermucoviscous phenotype32, CFUs could not be accurately assessed as the populations cannot be resuspended and homogenised. Thus, the serial dilution process was biased and distorted because either a randomly large or a randomly small proportion of the population would be transferred, due to the abovementioned hypermucoviscosity. These populations were not taken into account in our analyses. (iii) Surface polysaccharide extraction and quantification. The bacterial capsule was extracted as described in ref.56 and quantified by the uronic acid method57 using glucuronic acid as a standard. (iv) Aggregation test. An isolated colony was allowed to grow in 5 mL overnight in M02 medium at 37° under shaking conditions. Prior to the experiment, the absorbance (OD600nm) was measured and adjusted to OD600 = 2, and the cultures were transferred to static test tubes. Two hundred μL samples were transferred to a 96-well microtiter plate and the absorbance (OD600nm) measured at defined time points (0; 1.5; 3; 4.5 and 24 h) using an automatic plate reader Spark Control Magellan (TECAN). Samples were removed from the uppermost layer of tube cultures, roughly at the 4 mL mark. Decreasing absorbance represents the settling of agglutinated cell clumps. Figures represent aggregation after 4.5 h. We also calculated the area under the aggregation curve (trapz function included in the pracma R package). Results were qualitatively similar to those observed when only the measurement of 4.5 h is taken into account.

Search for MrkD proteins

All genomes corresponding to K. variicola in the Pathosystems Resource Integration Center (PATRIC) genome database, filtered by good quality and text mined for K. variicola species (751 out of the 767) were downloaded on 11 March 2022. Same procedure was applied for the first 10,000 genomes of K. pneumoniae (of which 239 were discarded). The genomes were checked for quality control and annotated with the pipeline PaNaCoTa58 and the –prodigal option. Protein-Protein Blast (BLAST 2.7.1+) against either the Kva 342 MrkD or Kpn NTUH MrkD was performed with the following option -max_target_seqs 100000 and an E-value smaller than 10−5. Sequences covering less than 70% of the protein length were discarded (only 50 for K. pneumoniae). The distribution of MrkD protein identities revealed a bimodal distribution (Supplementary Fig. 6A, C). To analyse bona fide MrkD proteins, we applied a cut-off of 90% identity. Of note, some genomes had two MrkD homologues (18 out of 671 in K. variicola, and 97 out of 9154 in K. pneumoniae). Most of the unique MrkD protein sequences in the databases differed by one or two amino acids from our ancestral sequences, but these could go up to 20 (Supplementary Fig. 6B, D). Protein sequences were aligned using mafft v7.22 with the options –localpair –maxiterate 1000. Amino acid mismatches were then identified using the R package Biostrings.

Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.