BACKGROUND
bacterial populations often live in highly structured and dense populations, known as biofilms, in nature  <cit> .
biofilms are stable assemblages of bacterial cells that stick to a surface and are embedded in a self-secreted matrix  <cit> .
the proximity between cells is advantageous to the bacteria as it allows them to respond to environmental stresses more effectively, coordinate their behavior better and gain access to nutrients and public goods.
the proximity can, however, be disadvantageous as it intensifies the competition for nutrients and other resources between the bacteria  <cit> .
in natural habitats, formation of structured bacterial communities can occur concurrently with colonization of new environments and bacterial adaptation.
in the course of colonization, bacteria may be under natural selection to adapt to their new environments.
one way in which the necessary genetic variation for natural selection to act upon can be generated is natural transformation, the active uptake of naked dna fragments from the environment and their subsequent integration into the genome.
natural transformation has been reported in many species of bacteria, including some important pathogens like streptococcus pneumoniae and helicobacter pylori <cit> .
there is growing evidence that biofilm formation and natural transformation are interconnected processes reviewed in  <cit> .
the physical proximity of bacteria in space seems to facilitate horizontal gene transfer between them, as shown in s. pneumoniae <cit>  and h. pylori <cit> .
further, protein factors that induce natural transformation were found to also trigger biofilm formation, leading to an increased rate of transformation in the biofilm compared to the planktonic state in naturally transforming bacteria  <cit> .
finally, extracellular dna is known to be abundant in biofilms and also to be involved in biofilm formation  <cit> .
transformation has the potential to facilitate adaptation, owing to the creation of co-adapted combinations of genes  <cit>  but also the acquisition of beneficial genes.
however, some hypotheses for the evolution of natural transformation emphasize physiological advantages to transformation and regard any genetic effect as the by-product of these physiological benefits  <cit> .
natural transformation can also become costly depending on the composition of dna fragments in the environment  <cit> : while acquiring new genes can enhance the fitness of the adapting bacteria, transformation with defective dna that originate from bacteria that are selected against by natural selection can impede adaptation.
the interplay between costs and benefits of transformation and bacterial adaptation has been investigated in some previous studies  <cit> .
these studies, however, assumed that bacteria live in a planktonic state, and therefore, neglected the effect of spatial structure of bacterial populations.
since spatial restriction on population growth limits the availability of free dna to bacteria, we expect the impact of transformation on population dynamics to be different in spatially restricted compared to the planktonic populations.
to study the connection between transformation with external dna and structured population growth in bacteria, we developed a mathematical model for adaptation of a bacterial population during growth across space.
the bacterial population was assumed to undergo transformation with dna fragments released by dead bacteria.
this eco-evolutionary model incorporates several ecological and population genetic factors, such as bacterial migration and dna diffusion, that govern the rate of both population expansion and adaptation in space.
we demonstrate how the impact of transformation on adaptation varies in different parts of a growing population, depending on dna diffusion, bacterial migration and the source of free dna in the environment.
RESULTS
the dynamics of bacterial growth and dna diffusion
we first investigated the dynamics of a bacterial population expanding in space in the absence of adaptation.
figure  <dig> shows how a single bacterium gives rise to a bacterial colony across space over time.
the population expands symmetrically because bacteria invade adjacent grid cells at the same rate .
population growth stops when all grid cells are filled .
depending on the migration and growth rates, bacteria may migrate to adjacent cells before the carrying capacity of a focal grid cell is reached.
in this case, a less compact population structure is formed over time .
not surprisingly, high levels of bacterial migration lead to dynamics resembling those in a well-mixed planktonic population.upon death, bacteria release dna fragments into the environment.
in the absence of dna diffusion, the free dna remains at the release location and accumulates with time.
since the free dna has more time to amass in the initial grid cell, the dna concentration is higher there .
in our simulations, there is always some levels of dna diffusion and/or dna degradation so that free dna does not indefinitely accumulate in the environment.
adaptation with constant selection
we next considered a growing bacterial population that adapts to a new environment under a constant selection regime where allele  <dig> has a constant selective advantage s over allele  <dig>  the population starts from a bacterium of genotype  <dig>  which gives rise to an expanding population.
as the population grows, mutation creates bacteria of genotype  <dig>  which in the absence of transformation go quickly to fixation .
transformation delays the fixation of the beneficial allele in the population and impedes adaptation .
this occurs because the dna pool during adaptation is overrepresented by the free dna of type  <dig> released from the less fit bacteria of genotype  <dig>  this so-called ‘bad genes effect’ of transformation, also described in prior studies  <cit> , is more pronounced in central layers of the population.
this leads to the formation of a frequency gradient of bacteria of genotype  <dig> across different layers of the growing population .
in this gradient, the frequency of bacteria of genotype  <dig> is lower in the central layers of the population in the short term, because of the higher concentration of the free dna of type  <dig>
in order to better understand the impact of migration on the evolutionary dynamics of our model, it may be helpful to first consider the two extreme ends of the spectrum of migration rates.
in the complete absence of bacterial migration, there is only growth and adaptation in the initial grid cell, and this single subpopulation behaves as a planktonic population.
conversely, when migration rates are extremely high, the entire population becomes well mixed and allele frequencies will be the same in all grid cells.
both of these extreme cases can thus be understood from previous studies examining the impact of natural transformation in planktonic populations where the “bad genes” effect was previously described  <cit> .to understand how population structure affects the “bad genes” effect, we measured the overall frequency of bacteria of genotype  <dig> across the whole population at one specific time point, for different intermediate migration rates as well as different dna diffusion rates and transformation rates .
as anticipated, the bad genes effect becomes more pronounced with increasing transformation rate.
with decreasing bacterial migration rate, the “bad genes” effect is mitigated and adaptation proceeds faster.
this is because the lower the migration rate, the longer it takes until new grid cells are colonized.
this delayed colonization of new grid cells means that migrants spreading in new grid cells will be better adapted to start with and also encounter fewer deleterious alleles in the free dna pool.
with low migration rates adaptation is therefore impeded by the “bad genes” effect in grid cells close to the initial one but proceeds at an increasingly faster pace at the frontier of the spatially expanding population.
only at extremely low migration rates  is adaptation again impeded because the bacteria fail to colonize any grid cell other than the initial one over the time period under consideration.dna diffusion potentially has two opposing effects on the effect of transformation on adaptation.
on the one hand, dna diffusion spreads the free dna of type  <dig> in the population, and thus, impedes adaptation.
on the other hand, dna diffusion depletes free dna of type  <dig> and thus mitigates the bad genes effect.
these opposing effects can result in a non-monotonic impact of dna diffusion on the transformation impact, particularly with low bacterial migration rates .
high levels of migration make the non-monotonic effect of dna diffusion disappear since in this case, the bacterial population behaves like a planktonic population in which the bad genes effect is pronounced.
at very high dna diffusion rates, the free dna becomes unavailable to the bacteria, and thus the bad genes effect disappears.
in the appendix, we present the results of the simulations in the presence of different levels of dna degradation.
our results demonstrate that dna degradation monotonically reduces the bad genes effect but a relatively high dna decay rate  is required to completely remove the effect of transformation .
thus, the dynamics of transformation mentioned above are conceivable to be observed in natural circumstances.
adaptation with density-dependent selection
in spatially structured bacterial populations, selection is often expected to be heterogeneous across bacteria occupying different locations, depending on the density of the surrounding subpopulations.
for example, restriction on the diffusion of an antibiotic makes the interior bacteria less susceptible to the antibiotic, thus decreasing the strength of selection for resistance genes.
in an extreme case where no antibiotics reach the interior, there might even be selection against resistance genes due to costs of resistance, i.e., not only the strength but also the direction of selection might depend on the density of the surrounding subpopulations.
similar effects may arise if diffusion of nutrients is restricted by the bacteria.to emulate such effects, we next consider the dynamics of adapting populations under selection regimes that are dependent on population density in the vicinity of a focal grid cell.
we consider the effect of transformation on the distribution of genotype  <dig> in space in three scenarios.
the first scenario is the density-independent regime where genotype  <dig> is always disfavored by selection.
as anticipated in this case, transformation reduces the frequency of genotype  <dig> especially in the center of the transforming population during adaptation, due to the bad genes effect .the second scenario describes a density dependent regime where genotype  <dig> is selected against in an empty space but becomes selectively neutral in a full space.
in this case, genotype  <dig> becomes more frequent at the less dense frontier parts of the population in the absence of transformation.
dna diffusion mixes free dna fragments of type  <dig> and type  <dig> that are over-represented in the interior and frontier parts of the population, respectively.
transformation then reduces the number of bacteria of genotype  <dig> in the frontier of the population but increases them in the internal part .the third scenario features a density dependent regime where genotype  <dig> is favored in a free space but selected against as population density increases.
this results in an overrepresentation of bacteria of genotype  <dig> in the interior of the population .
since genotype  <dig> becomes more disfavored as population density increases, the free dna of type  <dig> becomes frequent in the environment.
transformation with free dna of type  <dig> lowers the frequency of genotype  <dig> in the population .
overall, the results of this section indicate that in addition to a constant selection regime, transformation also affects adaptation when the population is subject to heterogeneous selective forces.
competition between two species
thus far, we have assumed that one bacterial species colonizes an empty environment, and therefore, free dna originates from a single colony.
however, in natural situations bacteria may face already adapted competitor species, so that transforming bacteria are exposed to the exogenous dna fragments originating from the adapted species.
to examine how transformation affects adaptation in this case, we study the competition between a non-transforming adapted population and an adapting population, which potentially undergoes transformation.
the two populations grow across space under a constant selection regime.
the non-transforming population carries allele  <dig> and is thus assumed to be well adapted to the environment; no mutations occur in this population.
the adapted population therefore supplies the dna fragment pool with only the beneficial allele  <dig>  the adapting population consists of two genotypes  <dig> and  <dig> and undergoes mutation and potentially transformation.
this population has a higher growth rate than the non-transforming population.
however, bacteria of genotype  <dig> in the adapting population are selected against and are disfavored in competition with the adapted non-transforming bacteria.the two populations grow from different parts of the grid and compete with each other.
figure  <dig> reveals that in the absence of transformation, the adapted species is initially favored and occupies most of the space.
this happens because of selection against genotype  <dig> in the adapting population.
as adaptation proceeds, the adapting population outcompetes the non-transforming population, owing to its higher growth rate.transformation has two opposing effects on adaptation in the adapting population: transformation with the free dna of type  <dig> released by the adapting species impedes adaptation , but transformation with the free dna of type  <dig>  which is released by the adapted species and diffuses in space, facilitates adaptation.
these opposing effects result in varying spatiogenetic patterns in different parts of the transforming population over time .
the bacteria at the frontier of the transforming population are the first to become exposed to the beneficial free dna of type  <dig>  and therefore, undergo adaptation faster than the internal bacteria, which are predominantly exposed to the conspecific dna of type  <dig>  adaptation continues in the transforming population and more bacteria of genotype  <dig> are formed.
in the long term, owing to their higher growth rate, the transforming population gradually out-competes the non-transforming type.with a high compared to a low transformation rate, although transformation generates more bacteria of genotype  <dig> in the frontline of the population, the bad genes effect also becomes more pronounced and this outweighs the benefit of transformation.
as a result, adaptation is considerably decelerated in the transforming population .
altogether we conclude that transformation allows bacteria to take advantage of the beneficial free dna, especially at the frontier of the population, and this can outweigh the bad genes effect.
discussion
lysed bacteria are known to supply the free dna pool in the environment  <cit> .
this is thought to give rise to the “bad genes effect” of natural transformation, according to which there is an overrepresentation of deleterious mutations released by selectively dead cells into the dna pool.
previous models of planktonic bacteria considering the dynamics of a free dna pool have shown that this effect results in a fitness cost of natural transformation that often overcomes potential benefits of transformation  <cit> .
our model shows that spatial structure of bacterial populations in combination with dna diffusion strongly affects the bad genes effect.
specifically, we found that the bad genes effect is mostly mitigated for intermediate bacterial migration and either very high or low dna diffusion rates.
our model rests on the assumption that the genetic composition of the dna fragment pool can be different from that of the cell population.
this is justified because free dna is known to persist in the environment for long periods of time and can thus to some extent retain a record of genes from previous generations  <cit> .
in a spatial context, this also means that dna diffusion has the potential to disseminate genes within the population, thereby enabling gene flow without actual bacterial migration.
however, dna diffusion may be restricted to varying degrees.
for instance, extracellular dna is known to serve as an abundant structural polymer in biofilms and to be required for the integrity and stability of the extracellular matrix during biofilm formation  <cit> .
besides, bacteria can utilize free dna as a potential nutrient  <cit> .
these and other factors can potentially limit the diffusion of free dna in the environment, localize the effect of transformation and consequently reduce the extent to which transformation increases the level of genotypic homogeneity across the population.
beyond a transient effect of slowing down adaptation, transformation may also lead to a persistent reduction in mean fitness of the population when there is spatial heterogeneity, caused by the biofilm structure, in selection pressure.
one possible scenario that we examined assumes that selection for an allele becomes weaker or even negative at the center of a growing population.
a case in point is the situation seen in biofilms where bacteria in the interior are often immune to the action of antibiotics , so that resistance genes are only selected for at the exterior of the biofilm.
such heterogeneous selection can entail a migration load, i.e.
a reduction in the mean fitness of the population due to migration of non-adapted individuals.
our results show that transformation can produce an additional fitness load incurred through incorporating dna that has diffused from parts of the population that are under a different selection pressure.
we also explored a situation where transformation can become beneficial during adaptation due to the acquisition of free dna fragments originating from other, already adapted populations in the environment.
for example, consider a situation where a pathogen invades and adapts to a complex environment like the nasopharynx where the pathogen needs to compete with other bacteria and is exposed to environmental stresses, such as drug treatment.
our results suggest that in a multispecies environment transformation becomes advantageous by allowing bacteria to take advantage of the exogenous dna in the shared dna pool that originated from already adapted species.
in line with this, prior studies have shown that the rate of transformation increases during colonization of the nasopharynx by multiple strains of pneumococci  <cit> .
this effect of free dna originating from already adapted populations resembles the proposed benefit of transformation in using beneficial genes that the dna pool retains from the past   <cit> .
similarly, szollosi et al.
<cit>  suggested that horizontal gene transfer through bacterial migration may be beneficial by enabling bacteria to acquire genes from other spatially distinct populations to readapt faster to changing conditions.
our model does not include evolution at multiple loci, and therefore, does not involve any potential benefit of transformation due to the break up of non-random associations between alleles.
recombination can be beneficial during adaptation by bringing together beneficial mutations that are likely to arise on different backgrounds in finite populations   <cit> .
martens and hallatschek  <cit>  showed that recombination accelerates adaptation in spatially structured populations through the fisher-muller effect, but their model did not incorporate a free dna pool.
as an additional feature of bacterial recombination, our results suggest that transformation with the free dna pool potentially affects the fixation of beneficial alleles in structured populations.
these findings highlight the importance of considering the dynamics of the free dna pool to fully account for the dynamics of recombination in bacteria.
it should be noted that in our simulations we neglected the possibility that genes involved in dna uptake and recombination themselves are subject to homologous recombination.
in particular, transformation with non-functional alleles of such genes released into the environment by the non-competent bacteria will produce a self-reinforcing drive against transformation so that in the absence of any benefits of transformation the competent genotype will ultimately become extinct  <cit> .
although our model aims to provide insights into the dynamics of spatially structured bacterial populations undergoing transformation, our model is not specifically tailored to describe bacterial biofilms.
several previous models provide a much more realistic description of biofilm growth.
for example, these models explicitly track the concentration of different nutrients and growth limiting/stimulating compounds in different layers of the biofilm and account for heterogeneity in position, biophysical and physiological properties of bacteria during biofilm formation over time see  <cit>  for a review.
incorporating evolutionary dynamics such as those involving natural transformation into such individual-based biofilm models represents a substantial conceptual and computational challenge for future studies.
CONCLUSIONS
this study was an attempt to elucidate the connection between horizontal gene transfer and formation of structured population in bacteria.
there is growing interest among molecular microbiologists to understand this connection as researchers have realized that most bacteria live in highly structured populations and horizontal gene transfer plays a major role in determining the biological repertoire of microorganisms.
experimental tests of the above models are needed to gain a better understanding of the evolutionary dynamics of bacteria during colonization of new environments.

 bacterial populations often live in highly structured and dense populations, known as biofilms, in nature. biofilms are stable assemblages of bacterial cells that stick to a surface and are embedded in a self-secreted matrix. the proximity between cells is advantageous to the bacteria as it allows them to respond to environmental stresses more effectively, coordinate their behavior better and gain access to nutrients and public goods. the proximity can, however, be disadvantageous as it intensifies the competition for nutrients and other resources between the bacteria. in natural habitats, formation of structured bacterial communities can occur concurrently with colonization of new environments and bacterial adaptation. in the course of colonization, bacteria may be under natural selection to adapt to their new environments. one way in which the necessary genetic variation for natural selection to act upon can be generated is natural transformation, the active uptake of naked dna fragments from the environment and their subsequent integration into the genome. natural transformation has been reported in many species of bacteria, including some important pathogens like streptococcus pneumoniae and helicobacter pylori. there is growing evidence that biofilm formation and natural transformation are interconnected processes reviewed in. the physical proximity of bacteria in space seems to facilitate horizontal gene transfer between them, as shown in s. pneumoniae and h. pylori. further, protein factors that induce natural transformation were found to also trigger biofilm formation, leading to an increased rate of transformation in the biofilm compared to the planktonic state in naturally transforming bacteria. finally, extracellular dna is known to be abundant in biofilms and also to be involved in biofilm formation. transformation has the potential to facilitate adaptation, owing to the creation of co-adapted combinations of genes but also the acquisition of beneficial genes. however, some hypotheses for the evolution of natural transformation emphasize physiological advantages to transformation and regard any genetic effect as the by-product of these physiological benefits. natural transformation can also become costly depending on the composition of dna fragments in the environment: while acquiring new genes can enhance the fitness of the adapting bacteria, transformation with defective dna that originate from bacteria that are selected against by natural selection can impede adaptation. the interplay between costs and benefits of transformation and bacterial adaptation has been investigated in some previous studies. these studies, however, assumed that bacteria live in a planktonic state, and therefore, neglected the effect of spatial structure of bacterial populations. since spatial restriction on population growth limits the availability of free dna to bacteria, we expect the impact of transformation on population dynamics to be different in spatially restricted compared to the planktonic populations. to study the connection between transformation with external dna and structured population growth in bacteria, we developed a mathematical model for adaptation of a bacterial population during growth across space. the bacterial population was assumed to undergo transformation with dna fragments released by dead bacteria. this eco-evolutionary model incorporates several ecological and population genetic factors, such as bacterial migration and dna diffusion, that govern the rate of both population expansion and adaptation in space. we demonstrate how the impact of transformation on adaptation varies in different parts of a growing population, depending on dna diffusion, bacterial migration and the source of free dna in the environment.  the dynamics of bacterial growth and dna diffusion we first investigated the dynamics of a bacterial population expanding in space in the absence of adaptation. figure  shows how a single bacterium gives rise to a bacterial colony across space over time. the population expands symmetrically because bacteria invade adjacent grid cells at the same rate. population growth stops when all grid cells are filled. depending on the migration and growth rates, bacteria may migrate to adjacent cells before the carrying capacity of a focal grid cell is reached. in this case, a less compact population structure is formed over time. not surprisingly, high levels of bacterial migration lead to dynamics resembling those in a well-mixed planktonic population.upon death, bacteria release dna fragments into the environment. in the absence of dna diffusion, the free dna remains at the release location and accumulates with time. since the free dna has more time to amass in the initial grid cell, the dna concentration is higher there. in our simulations, there is always some levels of dna diffusion and/or dna degradation so that free dna does not indefinitely accumulate in the environment. adaptation with constant selection we next considered a growing bacterial population that adapts to a new environment under a constant selection regime where allele has a constant selective advantage s over allele the population starts from a bacterium of genotype which gives rise to an expanding population. as the population grows, mutation creates bacteria of genotype which in the absence of transformation go quickly to fixation. transformation delays the fixation of the beneficial allele in the population and impedes adaptation. this occurs because the dna pool during adaptation is overrepresented by the free dna of type released from the less fit bacteria of genotype this so-called ‘bad genes effect’ of transformation, also described in prior studies, is more pronounced in central layers of the population. this leads to the formation of a frequency gradient of bacteria of genotype across different layers of the growing population. in this gradient, the frequency of bacteria of genotype is lower in the central layers of the population in the short term, because of the higher concentration of the free dna of type in order to better understand the impact of migration on the evolutionary dynamics of our model, it may be helpful to first consider the two extreme ends of the spectrum of migration rates. in the complete absence of bacterial migration, there is only growth and adaptation in the initial grid cell, and this single subpopulation behaves as a planktonic population. conversely, when migration rates are extremely high, the entire population becomes well mixed and allele frequencies will be the same in all grid cells. both of these extreme cases can thus be understood from previous studies examining the impact of natural transformation in planktonic populations where the “bad genes” effect was previously described.to understand how population structure affects the “bad genes” effect, we measured the overall frequency of bacteria of genotype across the whole population at one specific time point, for different intermediate migration rates as well as different dna diffusion rates and transformation rates. as anticipated, the bad genes effect becomes more pronounced with increasing transformation rate. with decreasing bacterial migration rate, the “bad genes” effect is mitigated and adaptation proceeds faster. this is because the lower the migration rate, the longer it takes until new grid cells are colonized. this delayed colonization of new grid cells means that migrants spreading in new grid cells will be better adapted to start with and also encounter fewer deleterious alleles in the free dna pool. with low migration rates adaptation is therefore impeded by the “bad genes” effect in grid cells close to the initial one but proceeds at an increasingly faster pace at the frontier of the spatially expanding population. only at extremely low migration rates is adaptation again impeded because the bacteria fail to colonize any grid cell other than the initial one over the time period under consideration.dna diffusion potentially has two opposing effects on the effect of transformation on adaptation. on the one hand, dna diffusion spreads the free dna of type in the population, and thus, impedes adaptation. on the other hand, dna diffusion depletes free dna of type and thus mitigates the bad genes effect. these opposing effects can result in a non-monotonic impact of dna diffusion on the transformation impact, particularly with low bacterial migration rates. high levels of migration make the non-monotonic effect of dna diffusion disappear since in this case, the bacterial population behaves like a planktonic population in which the bad genes effect is pronounced. at very high dna diffusion rates, the free dna becomes unavailable to the bacteria, and thus the bad genes effect disappears. in the appendix, we present the results of the simulations in the presence of different levels of dna degradation. our results demonstrate that dna degradation monotonically reduces the bad genes effect but a relatively high dna decay rate is required to completely remove the effect of transformation. thus, the dynamics of transformation mentioned above are conceivable to be observed in natural circumstances. adaptation with density-dependent selection in spatially structured bacterial populations, selection is often expected to be heterogeneous across bacteria occupying different locations, depending on the density of the surrounding subpopulations. for example, restriction on the diffusion of an antibiotic makes the interior bacteria less susceptible to the antibiotic, thus decreasing the strength of selection for resistance genes. in an extreme case where no antibiotics reach the interior, there might even be selection against resistance genes due to costs of resistance, i.e., not only the strength but also the direction of selection might depend on the density of the surrounding subpopulations. similar effects may arise if diffusion of nutrients is restricted by the bacteria.to emulate such effects, we next consider the dynamics of adapting populations under selection regimes that are dependent on population density in the vicinity of a focal grid cell. we consider the effect of transformation on the distribution of genotype in space in three scenarios. the first scenario is the density-independent regime where genotype is always disfavored by selection. as anticipated in this case, transformation reduces the frequency of genotype especially in the center of the transforming population during adaptation, due to the bad genes effect.the second scenario describes a density dependent regime where genotype is selected against in an empty space but becomes selectively neutral in a full space. in this case, genotype becomes more frequent at the less dense frontier parts of the population in the absence of transformation. dna diffusion mixes free dna fragments of type and type that are over-represented in the interior and frontier parts of the population, respectively. transformation then reduces the number of bacteria of genotype in the frontier of the population but increases them in the internal part.the third scenario features a density dependent regime where genotype is favored in a free space but selected against as population density increases. this results in an overrepresentation of bacteria of genotype in the interior of the population. since genotype becomes more disfavored as population density increases, the free dna of type becomes frequent in the environment. transformation with free dna of type lowers the frequency of genotype in the population. overall, the results of this section indicate that in addition to a constant selection regime, transformation also affects adaptation when the population is subject to heterogeneous selective forces. competition between two species thus far, we have assumed that one bacterial species colonizes an empty environment, and therefore, free dna originates from a single colony. however, in natural situations bacteria may face already adapted competitor species, so that transforming bacteria are exposed to the exogenous dna fragments originating from the adapted species. to examine how transformation affects adaptation in this case, we study the competition between a non-transforming adapted population and an adapting population, which potentially undergoes transformation. the two populations grow across space under a constant selection regime. the non-transforming population carries allele and is thus assumed to be well adapted to the environment; no mutations occur in this population. the adapted population therefore supplies the dna fragment pool with only the beneficial allele the adapting population consists of two genotypes and and undergoes mutation and potentially transformation. this population has a higher growth rate than the non-transforming population. however, bacteria of genotype in the adapting population are selected against and are disfavored in competition with the adapted non-transforming bacteria.the two populations grow from different parts of the grid and compete with each other. figure  reveals that in the absence of transformation, the adapted species is initially favored and occupies most of the space. this happens because of selection against genotype in the adapting population. as adaptation proceeds, the adapting population outcompetes the non-transforming population, owing to its higher growth rate.transformation has two opposing effects on adaptation in the adapting population: transformation with the free dna of type released by the adapting species impedes adaptation, but transformation with the free dna of type which is released by the adapted species and diffuses in space, facilitates adaptation. these opposing effects result in varying spatiogenetic patterns in different parts of the transforming population over time. the bacteria at the frontier of the transforming population are the first to become exposed to the beneficial free dna of type and therefore, undergo adaptation faster than the internal bacteria, which are predominantly exposed to the conspecific dna of type adaptation continues in the transforming population and more bacteria of genotype are formed. in the long term, owing to their higher growth rate, the transforming population gradually out-competes the non-transforming type.with a high compared to a low transformation rate, although transformation generates more bacteria of genotype in the frontline of the population, the bad genes effect also becomes more pronounced and this outweighs the benefit of transformation. as a result, adaptation is considerably decelerated in the transforming population. altogether we conclude that transformation allows bacteria to take advantage of the beneficial free dna, especially at the frontier of the population, and this can outweigh the bad genes effect. discussion lysed bacteria are known to supply the free dna pool in the environment. this is thought to give rise to the “bad genes effect” of natural transformation, according to which there is an overrepresentation of deleterious mutations released by selectively dead cells into the dna pool. previous models of planktonic bacteria considering the dynamics of a free dna pool have shown that this effect results in a fitness cost of natural transformation that often overcomes potential benefits of transformation. our model shows that spatial structure of bacterial populations in combination with dna diffusion strongly affects the bad genes effect. specifically, we found that the bad genes effect is mostly mitigated for intermediate bacterial migration and either very high or low dna diffusion rates. our model rests on the assumption that the genetic composition of the dna fragment pool can be different from that of the cell population. this is justified because free dna is known to persist in the environment for long periods of time and can thus to some extent retain a record of genes from previous generations. in a spatial context, this also means that dna diffusion has the potential to disseminate genes within the population, thereby enabling gene flow without actual bacterial migration. however, dna diffusion may be restricted to varying degrees. for instance, extracellular dna is known to serve as an abundant structural polymer in biofilms and to be required for the integrity and stability of the extracellular matrix during biofilm formation. besides, bacteria can utilize free dna as a potential nutrient. these and other factors can potentially limit the diffusion of free dna in the environment, localize the effect of transformation and consequently reduce the extent to which transformation increases the level of genotypic homogeneity across the population. beyond a transient effect of slowing down adaptation, transformation may also lead to a persistent reduction in mean fitness of the population when there is spatial heterogeneity, caused by the biofilm structure, in selection pressure. one possible scenario that we examined assumes that selection for an allele becomes weaker or even negative at the center of a growing population. a case in point is the situation seen in biofilms where bacteria in the interior are often immune to the action of antibiotics, so that resistance genes are only selected for at the exterior of the biofilm. such heterogeneous selection can entail a migration load, i.e. a reduction in the mean fitness of the population due to migration of non-adapted individuals. our results show that transformation can produce an additional fitness load incurred through incorporating dna that has diffused from parts of the population that are under a different selection pressure. we also explored a situation where transformation can become beneficial during adaptation due to the acquisition of free dna fragments originating from other, already adapted populations in the environment. for example, consider a situation where a pathogen invades and adapts to a complex environment like the nasopharynx where the pathogen needs to compete with other bacteria and is exposed to environmental stresses, such as drug treatment. our results suggest that in a multispecies environment transformation becomes advantageous by allowing bacteria to take advantage of the exogenous dna in the shared dna pool that originated from already adapted species. in line with this, prior studies have shown that the rate of transformation increases during colonization of the nasopharynx by multiple strains of pneumococci. this effect of free dna originating from already adapted populations resembles the proposed benefit of transformation in using beneficial genes that the dna pool retains from the past. similarly, szollosi et al. suggested that horizontal gene transfer through bacterial migration may be beneficial by enabling bacteria to acquire genes from other spatially distinct populations to readapt faster to changing conditions. our model does not include evolution at multiple loci, and therefore, does not involve any potential benefit of transformation due to the break up of non-random associations between alleles. recombination can be beneficial during adaptation by bringing together beneficial mutations that are likely to arise on different backgrounds in finite populations. martens and hallatschek showed that recombination accelerates adaptation in spatially structured populations through the fisher-muller effect, but their model did not incorporate a free dna pool. as an additional feature of bacterial recombination, our results suggest that transformation with the free dna pool potentially affects the fixation of beneficial alleles in structured populations. these findings highlight the importance of considering the dynamics of the free dna pool to fully account for the dynamics of recombination in bacteria. it should be noted that in our simulations we neglected the possibility that genes involved in dna uptake and recombination themselves are subject to homologous recombination. in particular, transformation with non-functional alleles of such genes released into the environment by the non-competent bacteria will produce a self-reinforcing drive against transformation so that in the absence of any benefits of transformation the competent genotype will ultimately become extinct. although our model aims to provide insights into the dynamics of spatially structured bacterial populations undergoing transformation, our model is not specifically tailored to describe bacterial biofilms. several previous models provide a much more realistic description of biofilm growth. for example, these models explicitly track the concentration of different nutrients and growth limiting/stimulating compounds in different layers of the biofilm and account for heterogeneity in position, biophysical and physiological properties of bacteria during biofilm formation over time see for a review. incorporating evolutionary dynamics such as those involving natural transformation into such individual-based biofilm models represents a substantial conceptual and computational challenge for future studies.  this study was an attempt to elucidate the connection between horizontal gene transfer and formation of structured population in bacteria. there is growing interest among molecular microbiologists to understand this connection as researchers have realized that most bacteria live in highly structured populations and horizontal gene transfer plays a major role in determining the biological repertoire of microorganisms. experimental tests of the above models are needed to gain a better understanding of the evolutionary dynamics of bacteria during colonization of new environments. 
recent studies have demonstrated that natural transformation and the formation of highly structured populations in bacteria are interconnected. in spite of growing evidence about this connection, little is known about the dynamics of natural transformation in spatially structured bacterial populations. we found that in structured bacterial populations intermediate dna diffusion rates predominantly cause transformation to impede adaptation by spreading deleterious alleles in the population. we demonstrate how spatial restriction on population growth and dna diffusion in the environment affect the impact of transformation on adaptation. our model reveals that even with only a single locus under consideration, transformation with a free dna fragment pool results in complex adaptation dynamics that do not emerge in previous models focusing only on the gene shuffling effect of transformation at multiple loci. overall, our model highlights distinctive evolutionary consequences of bacterial transformation in spatially restricted compared to planktonic bacterial populations.
 recent studies have demonstrated that natural transformation and the formation of highly structured populations in bacteria are interconnected. in spite of growing evidence about this connection, little is known about the dynamics of natural transformation in spatially structured bacterial populations.  in this work, we model the interdependency between the dynamics of the bacterial gene pool and those of environmental dna in space to dissect the effect of transformation on adaptation. our model reveals that even with only a single locus under consideration, transformation with a free dna fragment pool results in complex adaptation dynamics that do not emerge in previous models focusing only on the gene shuffling effect of transformation at multiple loci. we demonstrate how spatial restriction on population growth and dna diffusion in the environment affect the impact of transformation on adaptation. we found that in structured bacterial populations intermediate dna diffusion rates predominantly cause transformation to impede adaptation by spreading deleterious alleles in the population.  overall, our model highlights distinctive evolutionary consequences of bacterial transformation in spatially restricted compared to planktonic bacterial populations. bacterial adaptationbacterial transformationbiofilmspatially structured populations 