Efficient assembly and long-term stability of defensive microbiomes via private resources and community bistability

Understanding the mechanisms that promote the assembly and maintenance of host-beneficial microbiomes is an open problem. Empirical evidence supports the idea that animal and plant hosts can combine ‘private resources’ with the ecological phenomenon known as ‘community bistability’ to favour some microbial strains over others. We briefly review evidence showing that hosts can: (i) protect the growth of beneficial strains in an isolated habitat, (ii) use antibiotics to suppress non-beneficial, competitor strains, and (iii) provide resources that only beneficial strains are able to translate into an increased rate of growth, reproduction, or antibiotic production. We then demonstrate in a spatially explicit, individual-based model that these three mechanisms act similarly by selectively promoting the initial proliferation of preferred strains, that is, by acting as a private resource. The faster early growth of preferred strains, combined with the phenomenon of ‘community bistability,’ allows those strains to continue to dominate the microbiome even after the private resource is withdrawn or made public. This is because after a beneficial colony reaches a sufficiently large size, it can resist invasion by parasites without further private support from the host. We further explicitly model localized microbial interactions and diffusion dynamics, and we show that an intermediate level of antibiotic diffusion is the most efficient mechanism in promoting preferred strains and that there is a wide range of parameters under which hosts can promote the assembly of a self-sustaining defensive microbiome. This in turn supports the idea that hosts readily evolve to promote host-beneficial defensive microbiomes.


Introduction
A growing number of studies show that microbiome composition is structured by competition [1][2][3][4][5][6][7], and it is hypothesized that a host could evolve to bias competition in order to promote the establishment of host-beneficial microbes [6,[8][9][10][11][12][13]. Indeed, such microbes need support because, first, it is inherently difficult to establish a colony of host-beneficial microbes in the face of competition against the huge pool of available host-neutral or host-harmful species [1,[14][15][16][17], and second, while host-beneficial microbes can produce antibiotics that are employed in direct competition against other microbes, providing protection against harmful microbes both for themselves and for the host, the cost of production can reduce host-beneficial microbial growth rates to below those of non-beneficial and parasitic microbes [18]. Here, we focus on defensive microbiomes, in which case the trait that equips the bacterial strains to be successful during the establishment of such a microbiome [9], the production of antibiotics, is essentially the same trait that benefits the host by suppressing pathogens.
We distinguish three mechanisms by which a host can selectively favour beneficial strain(s), namely by (1) providing a habitable space that the desired bacterial partner has preferential access to, (2) producing specific compounds that selectively poison undesired bacteria, and (3) providing a food resource that the desired partner is better able to metabolise. We now briefly review examples of each: Providing a habitable space that the desired bacterial partner has preferential access to Vertical and pseudo-vertical transmissions fall into this category [1,[19][20][21][22][23]. In strict vertical transmission, host germline cells are infected with symbionts [22,24]. Less strict transmission ('pseudo-vertical') is achieved by keeping non-colonised host offspring in isolation after birth until the parental microbiome can colonise it, which then shapes the composition of subsequent colonists from the environment [9,11,22]. In either case, the host ensures a competitorfree space for inherited microbes, which are allowed time and resources to grow on a newborn host before being exposed to competition with other colonists. For example, newly emerging Acromyrmex leafcutter ants are inoculated with antibiotic-producing Pseudonocardia bacteria within a 24-hour window after hatching [8,25]. Mature worker ants serve as the source by carrying Pseudonocardia on their propleural plates, which grow to a high density around specialised exocrine glands that likely provide nutrients for bacterial growth [26,27] (thus also serving as an example of a resource that can be metabolized by the preferred bacteria, discussed in 3. below). Similarly, female beewolf digger wasps (Philanthus, Philanthinus, Trachypus) inoculate their brood cell walls with a species of Streptomyces that they maintain in their antennal glands [28][29][30]. These bacteria become directly incorporated into the larval cocoon, where they dominate and produce an array of antibiotics that protect the developing larva against infection [29][30][31]. Analogous to the above examples, the agricultural process of applying bacteria, such as antibiotic-producing Pseudomonas and nitrogen-fixing Rhizobia, to crop seeds before sowing mimics pseudo-vertical-transmission, by ensuring that high densities of beneficial bacteria have better access to root exudates and are favoured during establishment on the plant [32,33]. Priority effects have also been demonstrated for mycorrhizae [34], bees [35][36][37][38], wasps [28], leafcutter ants [25,39], birds [40], plants [41], and humans [42]. A unique structure for symbiont transmission, called a ''symbiont capsule," which serves as a private space and resource, has been described for the stinkbug Megacopta punctatissima [43][44][45]. These capsules are deposited next to the eggs and provide food and protection for the symbionts until the hatchlings open the capsules and ingest the symbionts [44,45].

Producing specific compounds that selectively poison undesired bacteria, whilst allowing desired strains to grow
A wide range of plant species secrete compounds, known as allelochemicals, which are toxic to a broad range of bacteria, fungi, and invertebrates in the rhizosphere, as well as toward other plants growing nearby [46][47][48][49]. For example, the compound 2,4-dihydroxy-7-methoxy-1,4-benzoxazin-3-one (DIMBOA) is an antimicrobial produced by maize seedlings [48], which the plant-beneficial species Pseudomonas putida is able to degrade, thus avoiding its effects. P. putida also uses this compound as a chemoattractant and a signal for upregulating the production of the broad-spectrum antibiotic phenazine [48]. Together, these mechanisms allow P. putida to colonise maize roots in the presence of mostly DIMBOAintolerant, competitor bacteria [48]. Similarly, the rhizobial species, Mesorhizobium tianshanense, which forms root nodules on liquorice plants, is able to outcompete other bacteria in the rhizosphere due to an efflux mechanism that confers resistance to the antimicrobial compound canavanine. Canavanine is abundant in liquorice root exudates and thus allows the host to filter out non-beneficial rhizobial species [50]. As another example, nitric oxide (NO), a potent oxidising agent and antimicrobial, can play an important role in dictating symbiont specificity [51,52]. A classic example arises during the symbiosis between the bobtail squid, Euprymna scolopes, and bioluminescent bacteria in the species Vibrio fischeri. V. fischeri are the exclusive colonisers of the squid's light organ, where they emit light to deceive predators, and are acquired horizontally from the environment within 48 hours after squid hatching [53]. High nitric-oxide synthase (NOS) activity and its product NO can be detected in the epithelial mucus of the light organ during the early stages of bacterial colonisation [54], which V. fischeri are able to tolerate via the activity of two proteins, flavohemoglobin (Hmp) and a heme NO/oxygen-binding protein (H-NOX) [55][56][57][58]. Eliminating the genes for these proteins in V. fischeri leads to colonisation deficiency [56,58], and diminishing the concentration of host NO results in a greater diversity of non-mutualistic bacterial species in the light organ epithelium [54]. Similar mechanisms of host selection are also reported for other animal species. For example, members of the Hydra family produce antibacterial arminins that help them to shape the establishment of the bacterial microbiota during their embryogenesis [59]. Hydra not only suppresses undesired strains [59] but also modifies the quorum-sensing signals by which bacteria communicate, hence manipulating the social behaviour of bacteria [60].

Providing a food resource that the desired partner is better able to metabolise
Enhanced metabolic activity from consuming a private resource can confer competitive superiority on a preferred microbial strain. Besides acquiring higher reproduction and growth rates, the beneficial bacteria can also achieve a higher rate of antibiotic production that results in the suppression of competitors [61] or achieve a higher production of other factors that promote colonization and symbiotic interaction with the host, such as adhesive molecules facilitating biofilm formation on the host surface [62,63]. The provision of specific metabolites is thought to play a key role in structuring the species-specific microbial communities associated with marine corals [64,65]. Coral juveniles, as well as their dinoflagellate symbionts, produce large quantities of the compound dimethylsulfoniopropionate (DMSP) [66]. In vitro and metagenomic studies have shown that several coral-associated bacterial groups can specifically metabolise the DMSP and use it as a sole carbon and sulphur source [64,65,67]. Such species are also amongst the first bacteria to colonise coral larvae, suggesting a nutritional advantage for them over bacteria that cannot degrade DMSP [64,68]. This includes a species of Pseudovibrio which can additionally use DMSP as a precursor for the production of antibiotics that inhibit coral pathogens [65]. Another example of a specific host-derived resource is human breast milk, which contains a large number of complex oligosaccharides that are preferentially consumed by a single species of co-adapted gut bacterium Bifidobacterium longum subsp. infantis [69]. In plants, experiments have shown that root exudates can be directly metabolised by the microorganisms that live endophytically within the plant roots [70][71][72][73]. Different species exude different groups of metabolites, and studies suggest that plant hosts may be able to tailor root exudate composition in order to recruit bacteria with particular metabolic traits [46,70,73]. For example, the concentration of the plant phytohormone salicylic acid (SA) has been shown to correlate with the abundance of several bacterial taxa, including the antibiotic-producing genus Streptomyces [73,74], which can use SA as a sole carbon source [74,75]. As discussed earlier, leaf-cutter ant exocrine glands, which provide a nutrient source for Pseudonocardia bacterial growth, also fall into this category [26]. These mechanisms achieve one of two effects: (I) they either ensure the protected growth of the preferred strains and/or (II) they enhance the competitive abilities of preferred strains against non-preferred strains, for example by increasing the rate of antibiotic production or the rate of growth of the beneficial strain, for certain duration of time. Taken together, these examples show that hosts have access to multiple mechanisms that can provide a 'private resource', in the form of space and/or food, to a subset of bacterial strains, and if those strains are beneficial to the hosts, the host is selected to apply one or more of these mechanisms to assemble host-beneficial microbiomes.
However, once the private resource is withdrawn, the host becomes a public habitat on which a diversity of microbes can thrive, either feeding on generally available resources coming from the host (for example, secretions, excretion, or dead epithelium) or from the physical environment. The question therefore is whether and how a time-limited private resource can be translated into a persistent host-beneficial microbiome.
To answer this question, we now abstract these mechanisms into an individual-based, spatially explicit model of host-associated defensive microbiomes (Fig 1A and 1B) (reviews in 9, 29, 30), which typically contain antibiotic-producing bacteria [76,77]. In our model, dispersal and direct competition for empty sites is limited to small numbers of neighbouring individuals, in accordance with experimental results [78]. At the same time, due to diffusion, indirect, antibiotic-mediated competition can occur amongst distant bacteria. We show that a host is indeed able to assemble a defensive microbiome, by providing a private resource that has the effect of exploiting the community bistability which emerges when bacterial species engage in interference competition [9]. We also show that the host only needs to provide the private resource until the beneficial microbe's colony reaches a self-sustaining size, that bacterium-produced antibiotic defends the colony most effectively at an intermediate level of diffusion rate, and that the antibiotic-efflux resistance mechanism is the most efficient mechanism for achieving competitive superiority.
We focus our modelling on the community dynamics of the bacteria, and therefore we only model the host indirectly. This is because bacterial community dynamics play out much more quickly (hours to days) than does the coevolutionary response of a host lineage to the fitness consequences of its achieved microbiomes. In other words, a host might evolve a new privateresource trait that changes the trajectory of microbiome assembly, which then affects host fitness and either selects for or against that new trait. Our focus is on the first half: how differences in the host-provisioning of private resources affect microbiome assembly, which is not well understood. We also simplify the modelling by binning multiple bacterial species into two archetypes, beneficial and parasitic, because we are interested in whether (any number of) beneficial species can coexist with or even competitively exclude (any number of) parasitic species. The same approach has long been used in community ecology, such as in modelling the coexistence of pioneer vs. shade-tolerant trees and superior competitors vs. superior dispersers [e.g. [79][80][81]. Typically, once two types can be shown to coexist, subsequent modelling shows that the same coexistence mechanism can be extended to allow the coexistence of multiple species [e.g. 82], or additional mechanisms can be invoked.
Our take-home message is that there is a wide range of conditions under which hosts can successfully promote the assembly of a self-sustaining defensive microbiome, which, in turn, supports the general idea that hosts can readily evolve to promote host-beneficial defensive microbiomes.

Models
We are interested in how the host influences the population dynamics of two different bacterial strains: an antibiotic-producing, antibiotic-resistant beneficial strain (B), and a non-producing, sensitive parasitic strain (P). (Note that antibiotic producing bacteria must also be antibiotic resistant, or the production would be suicidal.) We model the host implicitly by assuming that it is able to manipulate the composition of its microbiome through resource supply on its surface, upon which colonising individual bacteria compete for space with their neighbours according to their reproduction rates. The host surface further serves as a medium for spatially limited diffusion of the antibiotic. For this, we employ an individual-based model in which we model the host surface as a rectangular grid with toroidal boundary conditions (N = M � M) serving as the habitat for colonising bacteria (Fig 1B). Each grid point can be empty or inhabited by a single individual, and interactions take place within the immediate neighbourhood of the focal grid point. Time is measured in units of update steps. We assume that the dynamics of cell reproduction and death processes are much slower than small-molecule dynamics, so the cell populations are updated after u (u�1) update steps in antibiotic dynamics, during which the whole grid is updated in all relevant intracellular and extracellular processes related to the small-molecule (antibiotic) dynamics (N number of sites). In the cellular update steps, εN number of randomly chosen grid cells is updated in the birth and death processes, where ε is a small positive number ( Fig 1C).
The private resource(s) provided by the host can confer two kinds of benefits to the beneficial strain. We call the first kind (I) Protected Growth (mechanisms 1 and 2 from Introduction), because the parasitic strain is prevented from colonising (certain regions of) the host until time τ. Accordingly, in the model, B is given preferential access to host-provided space or is solely resistant to host-produced allelochemicals protecting the habitat until time τ, after which the host resource is made 'public' by also giving the parasitic strain access to the space or by withdrawing the host-produced compounds that have been facilitating B and poisoning P. We call the second kind of benefit (II) Enhanced Metabolism because, in the model, although P is allowed to invade from the beginning, B's metabolism is enhanced until time τ, after which this enhancement lapses (mechanism 3 from Introduction). The simplest outcome of enhanced metabolism is that B's advantage in metabolising host-provided food causes its reproduction rate to be increased by an amount of r B,pr (t) until time τ, after which r B,pr (t) = 0 (e.g. r B,pr (t)�0|t<τ and r B,pr (t) = 0|t�τ), where index pr denotes the private resource. An alternative outcome is that B is able to use the host-provided food to increase its own antibiotic-production rate (ρ B (t) = ρ B,pr (t)+ρ B,0 ), without incurring higher unit costs. Thus, similar to above, we distinguish a higher production rate fuelled by host-provided resource (ρ B,pr (t)�0|t<τ), and a lower, baseline production rate when the resource is not supplied after time τ (ρ B,pr (t) = 0|t�τ). Naturally, ρ B,0 >0, while the production rate of the non-producing strain is always zero (ρ P (t) = 0). (Alternatively, but not modelled here, the resource could allow the antibiotic to be effective at a lower threshold concentration before τ and at higher level after τ, which would give similar results to the previous).

Dynamics of the antibiotic molecules
The beneficial strain produces and exports antibiotic at rate ρ B , into the extracellular environment, resulting in a distribution of concentrations A Ext (i,t) at position i at time t.
The molecules are taken up by the cells at rates α B and α P (α B �α P ) by the B and the P strains, respectively, resulting in an A Int (i,t) interior concentration within the cell at position i at time t. The cells decompose the intracellular antibiotics at rates γ B and γ P (γ B �γ P ), and they can also perform active outbound transport, i.e. controlled efflux, to release intracellular antibiotics at rates β B and β P (β B �β P ). The antibiotics decay at rate φ in the environment.
We first assume that the antibiotic molecules are point-like particles moving on a host-surface plane. Consequently, we can use reaction-diffusion dynamics to describe change in the extracellular antibiotic concentration A Ext (x,t) at points x = (x,y) (representing the coordinates on a surface) and time t where the first term on the right hand side is the diffusion term, and F(A Ext (x,t)) is the reaction term, which depends on the extracellular antibiotic concentration (A Ext (x,t)) and the positions and types of the cells. Using the above defined parameters and dynamical processes, we can write where the antibiotic sources and sinks are summed in the parentheses, i is the position of a cell among the N cells, which can either be B or P denoted by � in the bottom index where applicable, A Int (i,t) is the intracellular concentration of the antibiotic at position i, and δ is the Dirac delta [87]. Since in our case the birth and death processes and the spatial positions of particles are given by other complex interaction dynamics, writing down the complete dynamics of the system leads to an analytically intractable model. Therefore, we next implement the time-andspace-discretised dynamics of antibiotic concentration at site i on the rectangular grid and at time t+Δt in the extracellular environment as where the first term corresponds to the diffusion of antibiotics according to the discretised diffusion algorithm between the four nearest neighbouring points (v = 4) (Neumann-neighbourhood: north, south, east, west); Δx is the spatial resolution, and Δt is the time resolution. The diffusion rate of the antibiotics, D, is measured in the unit of x 2 /t, where x denotes the spatial resolution, here one cell of the grid, and t stands for time measured as an update step. θ(i) takes the value one if there is a cell at the site i, else being zero. The dynamics of intracellular concentration of the antibiotic at the site i can be written as Naturally A Int (i,t+Δt) = A Int (i,t) = A Ext (i,t) = 0 if there is no cell at site i.

Growth dynamics of the cells
For the birth and death processes, we define the reproduction or growth rate of the antibioticproducing (B) and non-producing (P) strains respectively as r B ði; tÞ ¼ r B;0 þ r B;pr ðtÞ À c; where c is the decrease in reproduction rate because of the costly processes of antibiotic production and resistance. The reproduction rates r B,0 , r P,0 , and r B,pr (t) correspond to normal (baseline) and temporarily increased resource conditions, respectively. We assume r B,0 = r P At the beginning of the simulation, the beneficial strain is represented in low numbers (n B,0 ), and the parasitic strain is missing (n P,0 = 0).

Invasion tests
We carried out two sets of invasion tests to demonstrate how host-provided private resources can result in self-sustaining, beneficial microbiomes, even if the private resource itself eventually diminishes. In the first test, we used time, while in the second, we used colony size as the signal to switch from private to public resources, or in other words, to stop the host's selective support for the beneficial strain.
Invasion test 1. Time-limited supply of private resources. We model the two kinds of benefits conveyed by the private resources, as discussed earlier, the (I) Protected Growth of the beneficial strain for τ time and (II) the Enhanced Metabolism of the beneficial strain for τ time, either leading to (IIa) a higher population growth rate by the beneficial strain or to (IIb) an increased antibiotic production by the beneficial strain.
In the Protected Growth scenario, before τ, an s + proportion of cohesive space on the host surface (s + = ss/N, where ss is the number of protected sites) provides a safe growth opportunity for the beneficial strain, as individuals from the parasitic strain are prevented from invading (strict and pseudo-vertical transmission), or parasitic individuals invading this region get killed off (via host-provided allelochemicals). However, after τ time has passed, the parasitic strain is finally allowed to gain a foothold on the grid. In other words, the private space resource is made public at time τ. During an invasion attempt, we place n P,t number of individuals around a randomly selected focal grid point in a connected cluster with probability f in each time step (if there are empty places, subsequent individuals will be placed next to the focal site, but non-empty grid points can also be occupied if no empty place is available). In the Enhanced Metabolism scenario, the beneficial strain experiences increasing advantages of r + = (r B,pr (t)+r B,0 )/r B,0 or ρ + = (ρ B,pr (t)+ρ B,0 )/ρ B,0 for τ time, respectively, and n P,t number of parasitic-strain individuals are allowed to invade with probability f in each time step, starting from the beginning (κ = 1).
Invasion test 2. Protected growth of the beneficial strain to a minimum colony size. Here, we let the host resource, the habitat, be private until the beneficial strain reaches a minimum colony size, which we call the Colony Size at Invasion (CSI). We only allow the parasitic strain to start invading empty places after the resident B strain's colony size has grown to the CSI (CSI = q/N, where q is the number of sites inhabited by B). The invasion proceeds with probability f starting from κ and with n P,t number of invaders until the grid is fully occupied by individuals. As a motivating example, one can think of a small host 'crypt' or 'symbiont capsule' [43][44][45] in which the beneficial strain is initially housed. The strain eventually outgrows the crypt, or the new-born host opens up the capsule, releasing the symbionts, which then colonise the host surface [43][44][45]; at this point, the host can only provide resources in a way that makes them publicly available. The capsule serves de facto as a private resource, as the symbionts are, through specialized mechanisms, encapsulated from the progenitor's symbiont community, and these capsules are only broken upon the inhabitation of the new habitat [43][44][45], which is now available to all bacterial strains.

Results
The colony growth follows a logistic growth dynamic in the model (Fig 1C). Depending on the choice of ε, we observe full colonisation of the surface within a given timeframe. Without involving the effects of the host-provided private resources for the beneficial strain, and without the reproduction-rate reducing effect of the antibiotic on the parasitic strain, the faster growing type would quickly become dominant in the habitat, which, in our case, is the parasite, as it pays no cost of producing any compounds. To better investigate the competition dynamics between the two types on a fine timescale, we choose ε = 0.01 for our further investigations.

Invasion test 1. Time-limited supply of private resources
As discussed in the Introduction, the host has multiple mechanisms by which it can provide private resources. We find that protecting initial growth (Fig 2A and 2B), increasing the reproduction rate (Fig 2C and 2D), and/or enhancing the antibiotic effectiveness (Fig 2E and 2F) of the beneficial strain, can all result in a self-sustaining, beneficial-strain-dominated microbiome that is resistant to invasion even after the host resource is made public (at time τ) and the beneficial strain starts to experience a competitive disadvantage due to its costs of antibiotic production and of expressing its antibiotic-resistance traits. In all three scenarios, the longer the time τ that the resource is private (Fig 2, x-axis), the less of an advantage, in the form of protected growth (s + ), increased population growth (r + ), or increased antibiotic production (ρ + ) (Fig 2, y-axis), is required for the beneficial strain to be able to resist invasion after the resource becomes public. This is because invasion resistance increases with the size of the beneficial colony and with the concentration of antibiotic that the colony produces and transports into the environment.
We also observe that if the physiological mechanism of resistance by the beneficial strain to its own antibiotic is efflux, this can additionally enhance invasion resistance, even if the supply time is short and the advantage conferred by the private resource is small (Fig 2A, 2C, 2E vs. 2B, 2D and 2F). The reason is that re-exporting any ingested antibiotic increases the environmental concentration of antibiotic, which aids suppression of invading parasitic strains.  a limited time τ (Invasion test 1). Black areas indicate parameter space where the non-producing parasitic strain can invade, and the yellow shading indicates that the beneficial strain is able to resist invasion. Orange to red colours indicate mixed outcomes. In general, the beneficial strain dominates over a larger proportion of the parameter space as the duration of the private resource supply lengthens, regardless of whether the beneficial strain enjoys outright protected growth (a, b), an increased rate of population growth (c, d), or an increased rate of antibiotic production (e, f). The efflux of accumulated intracellular antibiotic in the antibiotic-producing beneficial strain also aids beneficial-strain dominance (β B = 0 for a, c, e, and β B = 0 .25 for b, d, f). Simulations were run with 5 replicates for 100 000 generations or until the population was homogenous. Model parameters are: r B,0 = 0.8, r P,0 = 0.8, c = 0.1, ρ B,0 = 1, α B = 0.5, α P = 0.5, β P = 0, γ B = 0.4, γ P = 0.4, φ = 0.3, D = 5, a = 1, T = 1, k = 25, N = 10 000, n B,0 = 100, n P,t = 10, κ = 1 f = 0.01, Δt = 1/10, u = 100, ε = 0.01, and r + = 0, s + = 0, ρ + = 0 when applicable.

Invasion test 2. Protected growth of the beneficial strain until a minimum colony size
Consistent with the results from Invasion test 1, if the beneficial colony successfully reaches a critical size (the Minimum Sustainable Colony size: MSC), it becomes resistant to invasion over a wide range of parameters after the private resource is made public (Fig 3). Again, having antibiotic efflux as the resistance mechanism promotes invasion resistance (Figs 3 and 4), whereas (and intuitively) a higher rate of extracellular decay of antibiotic counteracts this effect (Figs 3 and 4). When a large amount of antibiotic is in the environment, because efflux is high and decay is low (Fig 3A and Fig 4A and 4C), the beneficial strain is able to dominate over a wide range of diffusion rates. However, when the extracellular-decay rate is high, only high diffusion rates allow the beneficial strain to dominate (Fig 4D). This is because at low diffusion rates, the antibiotic produced in the centre of the colony is lost due to decomposition before it diffuses to the colony edge, where it would have attacked invaders. In contrast, at high diffusion rates, more of the antibiotic produced by cells deeper in the colony reaches the invasion front at the edge (Figs 3, 4, and 5).
The complement to this result is that if the diffusion rate is low, then even a large colony size does not necessarily guarantee success unless the efflux rate is also high enough (Fig 4A  and 4B). Essentially, if antibiotic efflux is used as the resistance mechanism by the beneficial cells, this can substitute for outright diffusion of the antibiotic, allowing the antibiotic to reach the colony edge, where it can suppress invaders (Fig 4).

Non-monotonous effect of diffusion
Interestingly, under some conditions there is a non-monotonous effect of diffusion rate on invasion resistance, such that the Minimum Colony Size (MSC) can be much smaller for medium-level diffusion rates. For example, looking at Fig 3B, for low antibiotic diffusion rates (values 0−1 on the x-axis), the MSC is close to 100%; that is, the colony can resist invasion only if more than 95% of the available habitat is already occupied by the producers; otherwise, parasites displace the whole population of antibiotic producers. Similarly, for high diffusion rates (values D = 80−100 on the x-axis), although smaller, a considerable colony size still has to be reached. However, the MSC curve reaches a minimum between low and high diffusion rates, such that only a 1−10% MSC is enough to resist invasion (Fig 3B).
The important result is that for any intermediate efflux and decay parameters coupled with intermediate diffusion rates, colonies with practically any non-zero initial size can withstand parasite invasion (Fig 3A, 3B and 3D). This nonlinearity occurs because, in general, diffusion carries antibiotic to the edge of the antibiotic-producing colony, where it can act against invading P strains, but diffusion also carries antibiotic away from the edge of the colony. An intermediate diffusion rate turns out to maximise the amount of antibiotic at the fighting front (see S1-S6 Figs in the Supplementary Information for further results of different parameter combinations).

Discussion
The composition of host-associated microbiomes has been shown to correlate with host health status and fitness [4,[88][89][90][91][92][93][94], and thus, there is likely to be strong selection on host species to evolve mechanisms that favour the assembly of certain kinds of microbiomes over others [11,12,27]. Here we have explored how a host can favour the assembly of a defensive microbiome that is persistently dominated by antibiotic-producing bacteria [7,23,77,95].
We argue that a host can take advantage of an ecological phenomenon known as 'community bistability': when two species compete via interference, such as when a bacterial species uses antibiotics to hinder a competitor, the winner depends partially on the initial population sizes of the two competitors [9]. If the antibiotic-producer initially establishes a larger population in the new habitat, it can collectively produce a sufficient amount of antibiotic to suppress its competitor and grow until the space of opportunity vanishes for the non-producer. In contrast, if the non-producer species starts with the larger or competitively superior population, then the small amount of antibiotic produced by a small colony of a producer is insufficient to suppress the non-producer, and the non-producer wins. It follows that by using an antibioticproducer as the initial (or 'priming') strain of the microbiome, a host can narrow down the variety of strains able to invade this already established environment [4,5,9,11]. The host is thus efficiently able to canalise the composition of the emerging microbiome. Such priming effects have been demonstrated in various experimental systems [25,37,39,96]. Our argument, in a nutshell, is that an effective way for hosts to guide microbiome assembly is by manipulating initial conditions, resulting in a cascade of bacterial community dynamics that ultimately favour some kinds of microbiomes over others, which will, in turn, affect host fitness. Another way of thinking about this is through the lens of game theory [9,13]. The host is able to 'screen-in' antibiotic-producing bacteria by exploiting a fundamental correlation: bacterial strains that make lots of antibiotics are both superior interference competitors against other bacteria and also likely to produce compounds that are useful for host defence.
In this study, we have integrated local interactions and the explicit spatial dynamics of cellular and chemical components with the original phenomenological model that laid the foundations of the theory [9]. In this now more realistic model, even for large populations, the number of directly interacting cells is relatively modest, and thus, the spatial correlations of active agents determine dynamics meaningfully [5,78]. Furthermore, such an integrated, spatially-explicit model allows us to understand the effect of different antibiotic-resistance mechanisms [75,[83][84][85][86]97] on the microbiome assembly, and to investigate how attributes of the host surface, which govern the diffusion dynamic of the antibiotic, can modify the outcome. We have also widened the applicability of Scheuring and Yu's original model [9] by reviewing multiple mechanisms allowing a host to prime a defensive microbiome, even if the beneficial strain can only be recruited from the environment (horizontal transmission); the original model made the restrictive assumption that the beneficial strain is strictly vertically transmitted.
We have corroborated the earlier results [9,13] that antibiotic producers and non-producers can form a bistable system and that the outcome of competition depends on their reproduction rates, how effectively the host is able to selectively promote the beneficial strain, and the initial ratio of the two strains [9]. Once the antibiotic producer is able to gain dominance, in such a system it can remain dominant for a lifetime, even if the host-provided private resource vanishes or becomes public. The current model also shows that localized interactions, which is an important realism that had been ignored in the simpler model [9], do not impede this dominance because the antibiotic itself can diffuse to the colony edge to inhibit invaders. This effect is strengthened when the mode of resistance employed by the producers is antibiotic efflux.
We also show with the current model that the host resource only needs to remain private for a finite critical time, basically until the beneficial colony reaches a Minimal Sustainable Colony Size (MSC), at which point it becomes resistant to a given rate of invasion. The critical time and/or the MSC depends on the physiochemical properties of the system, most importantly the decomposition, decay, diffusion, and efflux rates of the antibiotic, and the advantage provided to the beneficial colony by the private resource, all deriving from the fact that colony size determines the amount of antibiotic produced.
Our brief review of the literature suggests that multiple forms of 'private resource' exist, including food, space, and host-provided compounds that harm undesired strains. Nonetheless, privacy of resources is inherently difficult and costly to achieve, and it is therefore realistic to assume that any host-provided resources will eventually become public. This inevitable transition from private to public, which intuitively might be expected to allow the successful invasion and establishment of parasitic strains, does not in fact do so, because of bistability. After a beneficial colony establishes itself, a public resource is in practice only enjoyed by the winner, the beneficial colony.
Finally, we show that an intermediate diffusion rate can maximise the amount of antibiotic accumulating at the colony edge. Our findings suggest that the attributes of the host surface, for example the diffusion rate, can either increase or reduce the effect range of the antibiotic [98]. As there is no conflict of interest between antibiotic-producer and host, their coevolution is expected to optimise the diffusion speed, and hence the effectiveness, of the antibiotic. Overall, evolutionary optimisation can act by minimising the host investment required to attain a beneficial microbiome, by reducing the duration of a private resource supply, and by evolving the optimal physiochemical properties of the habitat, the host surface. If so, then we might also expect that the co-evolution of host and preferred strains results in an efficient and well-conducted build-up of a beneficial microbiome, an orchestrated symbiosis that efficiently narrows down the enormous number of possible scenarios to canalise the emergence of a microbiome towards the most favourable one.
Supporting information S1 Fig. The effect of different decay rates (φ) on the effectiveness of the private resource for the beneficial strain in the form of increased antibiotic-production rate for τ time. High extracellular decay rates reduce the effectiveness of the antibiotic and thus decrease the effectiveness of the help provided by the host to the beneficial microbe for τ time. Therefore, to compensate for higher decay rates, higher effort is needed from the host either in the form of more help (along the y-axis) or in the form of same amount of help provided for longer time (x-axis). Results are shown for (a) zero (β B = 0) and for (b) modest (β B = 0.25) efflux rates. The upper right areas correspond to beneficial-dominated outcomes, while the bottom left corners correspond to parasite-dominated outcomes. The light (ochre) shadings represent the regions in which the beneficial strain wins for more than 50% of the simulations, and the darker (black) shaded areas mark the parameter combinations in which the parasitic strain wins for the majority of simulations. The black lines mark the boundaries separating these two regions.  a). The higher the cost of producing the antibiotic (x-axis), the more effective the antibiotic (yaxis) must be to secure the dominance of the beneficial strain (where effectiveness is measured as reducing the growth rate of the parasitic strain). Also, the higher the efflux rate (β), the larger the cost can be tolerated. Very low (a; D = 0.5) and very high (c; D = 50) diffusion rates hinder the effectiveness of the antibiotic, hence the highest costs are tolerated at medium (b; D = 5) diffusion rates. The upper left corners correspond to beneficial-dominated outcomes, while the right-hand and bottom right areas correspond to parasite-dominated outcomes. The light (ochre) shadings represent the regions in which the beneficial strain wins for more than 50% of the simulations, and the darker (black) shaded areas mark the parameter combinations in which the parasitic strain wins for the majority of simulations. The black lines mark the boundaries separating these two regions. Model parameters are: r B,0 = 0.8, r P,0 = 0.8, ρ B,0 = 1, α B = 0.5, α P = 0.5, β P = 0, γ B = 0.4, γ P = 0.4, φ = 0.3, T = 1, k = 25, N = 10 000, n B,0 = 100, n P,t = 10, κ = 1, f = 0.01, Δt = 1/10, u = 100, τ = 2000, r + = 0.4, s + = 0, and ρ + = 0.  (r B,0 ) and the cost of producing the antibiotic by the beneficial strain (c). High reproduction rates allow for higher costs, as the competitive disadvantage caused by the costly antibiotic production can be compensated by higher reproduction rates compared to that of the parasitic strain's (r P,0 = 0.8). Higher efflux rates (β B = 0 ! β B = 1) can also help to compensate for a competitive disadvantage caused by lower reproduction rates and costly antibiotic production. Results are shown for (a) low (D = 0.5), (b) medium (D = 5), and (c) high (D = 50) diffusion rates. Increasing the diffusion rate further improves the effectiveness of the antibiotic, and hence the beneficial can dominate even with relatively high cost and low reproduction rates, until a certain point. Very high diffusion rates, on the other hand, hinder the effectiveness of the antibiotic. The upper left areas correspond to parasite-dominated outcomes, while the bottom right corners correspond to beneficial-dominated outcomes. The light (ochre) shadings represent the regions in which the beneficial strain wins for more than 50% of the simulations, and the darker (black) shaded areas mark the parameter combinations in which the parasitic strain wins for the majority of simulations. The black lines mark the boundaries separating these two regions. Model parameters are: r P,0 = 0.8, c = 0.1, ρ B,0 = 1, α B = 0.5, α P = 0.5, β P = 0, γ B = 0.4, γ P = 0.4, φ = 0.3, D = 5, a = 1, T = 1, k = 25, N = 10 000, n B,0 = 100, n P,t = 10, κ = 1, f = 0.01, Δt = 1/10, u = 100, τ = 2000, r + = 0.4, s + = 0, and ρ + = 0. (TIF)

S6 Fig. The relationship between invasion probability per update (f) and the start of invasion of the parasitic strain (τ).
During these simulations, the invasion of the parasitic strain is blocked on the entire host surface, thus directing the host-provided resource entirely to the beneficial strain, until time τ (τ = κ). The higher the probability of invasion by the parasite (yaxis), the more time is necessary for the beneficial to reach a colony size big enough to resist invasion (x-axis). The higher the extracellular decay rate is (φ), the more time is required for the beneficial colony to become resistant to invasion, but this disadvantage can be compensated by high efflux rates (β B = 0 for a and β B = 0.25 for b). There is a limit, however, to how much invasion pressure the system can withstand; as can be seen, for high decay rates and above a certain invasion pressure (high f values along the y-axis), even long-lasting host support cannot result in dominance of the beneficial strain. The upper left corners correspond to parasite-dominated outcomes, while the bottom right areas correspond to beneficial-dominated outcomes. The light (ochre) shadings represent the regions in which the beneficial strain wins for more than 50% of the simulations, and the darker (black) shaded areas mark the parameter combinations in which the parasitic strain wins for the majority of simulations. The black lines mark the boundaries separating these two regions. Model parameters are: r B,0 = 0.8, r P,0 = 0.8, c = 0.1, ρ B,0 = 1, α B = 0.5, α P = 0.5, β P = 0, γ B = 0.4, γ P = 0.4, D = 5, a = 1, T = 1, k = 25, N = 10 000, n B,0 = 100, n P,t = 10, Δt = 1/10, u = 100, r + = 0, s + = 1, and ρ + = 0. (TIF)