The evolution of short- and long-range weapons for bacterial competition

Bacteria possess a diverse range of mechanisms for inhibiting competitors, including bacteriocins, tailocins, type VI secretion systems and contact-dependent inhibition (CDI). Why bacteria have evolved such a wide array of weapon systems remains a mystery. Here we develop an agent-based model to compare short-range weapons that require cell–cell contact, with long-range weapons that rely on diffusion. Our model predicts that contact weapons are useful when an attacking strain is outnumbered, facilitating invasion and establishment. By contrast, ranged weapons tend to be effective only when attackers are abundant. We test our predictions with the opportunistic pathogen Pseudomonas aeruginosa, which naturally carries multiple weapons, including CDI and diffusing tailocins. As predicted, short-range CDI can function at low and high frequencies, while long-range tailocins require high frequency and cell density to function effectively. Head-to-head competition experiments with the two weapon types further support our predictions: a tailocin attacker defeats CDI only when it is numerically dominant, but then we find it can be devastating. Finally, we show that the two weapons work well together when one strain employs both. We conclude that short- and long-range weapons serve different functions and allow bacteria to fight both as individuals and as a group.


Article
https://doi.org/10.1038/s41559-023-02234-2surface, intoxicating any susceptible cell(s) that are contacted (Fig. 1a), which is intended to simulate contact weapons including T6SSs 29,30 and CDI 13 .Alternatively, attacking cells can release a diffusible factor into the environment, which could represent a range of toxins, including a small-molecule antibiotic, a ribosomally synthesized bacteriocin or a tailocin.The rate at which toxins are exported out of attacking cells is matched for short-and long-range weapons, and is controlled via a secretion rate parameter, k sec .Toxins also have matched potencies: both contact and diffusible toxins are lethal once intracellular concentrations exceed a set threshold T c .We assume that producing either toxin incurs an equivalent growth-rate cost in attacking cells that is proportional to the secretion rate: that is, increasing the toxin secretion rate results in a lower growth rate (Fig. 1b and Methods) 34,35 .Our goal is to compare weapons that differ only in their range, while keeping all other features identical.As a result, we assume that the cost of use is equivalent for both short-and long-range weapons.
We begin by modelling competitions between an attacker strain, which either has a short-or a long-range weapon, and a second strain that is susceptible to the weapon.We look at a wide range of competition scenarios, varying the initial frequency of the attacker, initial density of cells and the amount that the attacker invests in its weapon (that is, toxin secretion rate).In each case, the two strains are allowed to grow and interact for a set period of time (10 h; Fig. 1c), after which we compare the final attacker:susceptible cell ratio to its initial value ('competitive advantage'; Methods).Both weapons tend to perform better when cells are seeded at high initial density, because this promotes cell-cell contact for short-range weapons 36 and toxin accumulation for long-range weapons.Nevertheless, there remains a clear difference between the two weapon types.Across the majority of scenarios tested, the contact-dependent weapon provided an advantage to the attacker (Fig. 1d and Extended Data Fig. 1a).By contrast, the long-range weapon is more sensitive to starting conditions, requiring a higher secretion rate to be effective (Supplementary Fig. 1b) and reaching its full potential only when the attacker is seeded at high frequency and high density.
The models suggest a particular advantage of contact-dependent weapons: they are effective even when users are at a numerical disadvantage.This benefit is likely to be most substantial when invading an established population, because here invaders will be outnumbered by residents.We explored this scenario further by modelling established biofilms of susceptible cells and simulating the late arrival of attacker cells (by replacing some of the susceptible cells at random with attackers).In this scenario, cells using the short-range weapon were able to successfully invade an established population, where increasing toxin secretion rate increased their success (Fig. 1e,f and Extended Data Fig. 1c).Conversely, long-range weapons never enabled invasion, as producer cells could never amass in sufficient numbers to kill the susceptible strain.
In summary, even though we closely matched the properties of the two weapon types, the models predict that they perform differently across the variety of competition scenarios we tested.In general, contact weapons work well across a range of frequencies, including cases when a strain is rare, allowing it to invade.By contrast, long-range weapons function well only when a producing strain is relatively abundant, but here they are an effective form of attack.

Using genome editing to generate strains for weapon comparisons
Our modelling predicts that a long-range weapon will perform poorly at low attacker frequency, which is consistent with the findings of several previous studies-both theoretical and empirical-showing that toxin production is most effective when attackers are abundant 35,[37][38][39][40][41] .However, to test our predictions on the relative benefits of short-versus long-range weapons, a well-controlled comparison of the two types of weapon is required.To do this, we turned to the opportunistic pathogen P. aeruginosa (strain PAO1), which naturally carries both short-and characterized in detail, many carry both short-and long-range weapons, including strains of Bacteroides fragilis 18,19 , Pectobacterium carotovorum 20,21 , Burkholderia cepacia 22,23 , Chromobacterium violaceum 24,25 and Myxococcus xanthus 26,27 .What is the evolutionary basis for the prevalence of multiple weapons?One argument is that bacteria are simply more aggressive than other species such as animals, and that this favours the simultaneous use of multiple weapons.Consistent with this hypothesis, experiments suggest that bacteria engage in combat much more regularly than animals 3 , which typically avoid using their weapons 2 .However, a general increase in aggression does not explain why bacteria carry multiple types of weapon, as opposed to simply just investing more in a single type.We hypothesized that bacteria carry multiple weapons because they serve different functions during competition.We further reasoned that this explanation is most compelling for weapons that function at different ranges, a factor that can strongly influence the outcome of bacterial contests 28 .We therefore sought to test this hypothesis by performing a direct comparison of the competitive benefits of short-versus long-range weapons.
We first employ a realistic agent-based model of bacterial competition that has previously been used to understand the evolutionary function of single weapons 29,30 .The power of this framework is that it allows one to rapidly study a wide variety of competition scenarios with relative ease, while being realistic enough to generate focused predictions for empirical testing.The model predicts that short-and long-range weapons do indeed have the potential to serve different functions.We test these predictions by genome editing P. aeruginosa strain PAO1 to generate strains that are susceptible to its own short-and long-range weapons (CDI and tailocins, respectively).This approach allows us to directly compare weapons' functioning in a controlled genetic background, and thereby investigate the relative benefits of the two weapon types.In support of the modelling, we find that shortand long-range weapons can provide different advantages during combat.Contact weapons remain effective when an attacking strain is outnumbered, facilitating invasion and establishment.By contrast, ranged weapons are most effective when attackers are abundant, but here they prove to be a devastating form of attack.

An agent-based model of short-and long-range weapons
We first employ an established computational model where each cell is simulated as an individual agent (hence, 'agent' or 'individual based' model; Methods) [29][30][31][32][33] .Bacterial cells are seeded onto a two-dimensional (2D) surface where they grow and divide to fill a vertical space, as can occur in a biofilm for example, or at the intestinal mucosa of a mammalian host.Cells interact with each other both physically-pushing and displacing each other as they grow and collide-and chemically, by producing toxins that can inhibit strains of a different genotype (Fig. 1 and Supplementary Video 1).When cells reach a specified height they are removed, mimicking dispersal or shedding from the top of the community.Bacterial weapons can vary substantially in a wide range of properties, including method of delivery (short-or long-range), quantity produced, deadliness, cost of production and, of course, the strain or species where they are found 3 .This can make like-for-like comparisons of different weapons empirically challenging.However, with a model one can precisely define, and systematically vary, such properties of bacterial weapons to study general principles (Methods).The model is also spatially explicit, which is particularly important for contact-based weapons whose action depends upon the occurrence of physical contact between cells 29,30 .

Modelling predicts distinct strengths of short-and long-range weapons
We use our model to compare short-and long-range bacterial weapons that-other than their range of effect-are as similar as possible.Attacking cells can 'fire' a short-range weapon at random from their cell Article https://doi.org/10.1038/s41559-023-02234-2long-range weapons.Of its long-range weapons, the mechanical tailocins (specifically its R-type pyocins) are known to be highly effective weapons under biofilm-like conditions 42,43 .For short-range weapons, P. aeruginosa has a dedicated antibacterial T6SS 17 , but it is under complex regulation and typically fires only in response to incoming attacks 29,44,45 .Therefore we instead chose to focus on a CDI system of P. aeruginosa 46 as a short-range weapon to test predictions.The fitness costs of these weapons potentially differ.Tailocins are induced by DNA damage and released through the self-lysis of a sub-population of cells 47 .CDI systems are regulated by unknown signals and are expected to be produced by all cells of a population, but their use does not require cell death 46 .The regulatory strategies of weapons can have important effects on their effectiveness 48 , which we do not study here.Nevertheless, both weapons have been shown to provide clear advantages to their users, which made them a good choice for representative short-and long-range weapons.
For both weapons, we used genome editing to generate a strain that is susceptible to the weapon but otherwise well-matched to the

Article
https://doi.org/10.1038/s41559-023-02234-2 attacker, allowing us to study the effects of each weapon on bacterial competition.For CDI, this was straightforward: deleting the three gene locus that encodes the CDI transporter, toxin filament and immunity (PA0040-PA0041), resulting in a strain that does not have CDI and is susceptible to CDI.For the tailocins, we selected pyocin R2, but here resistance is more complex as it is determined by the composition of the lipopolysaccharide (LPS) moieties of the outer membrane 49 .Here, we engineered a susceptible strain by deleting both the pyocin R2 locus and the gene wbpL, which causes a deficiency in the LPS that in our strain background leads to susceptibility to pyocin R2 (Extended Data Fig. 2).However, this deficiency in the LPS caused a competitive disadvantage to the susceptible strain, independent of the effects of tailocins (Extended Data Fig. 3).To generate a near-matched attacker strain, therefore we made a ΔwapR deletion in the wild-type strain, which causes a similar LPS deficiency but not one that leads to pyocin R2 susceptibility (Extended Data Fig. 2 and Methods).
In the absence of the weapon-mediated advantage of pyocin R2 (hereafter 'tailocin'), the wapR mutation puts the attacker at a moderate disadvantage relative to the wbpL mutation in the susceptible strain (Extended Data Fig. 4).We quantified this difference and used it to adjust the predicted competitive advantage of the attacker strain in our experiments, in order to estimate the effects of the weapon alone (Extended Data Fig. 4 and Methods).However, in practice this adjustment has little impact on the data because the benefits of the tailocin, when they are seen, massively outweigh this moderate cost of wapR deletion (for further discussion of these LPS mutations, see Methods).

Experiments with P. aeruginosa show distinct advantages to short-and long-range weapons
With these strains, we could then test our modelling predictions for a scenario where attackers armed with either a contact or diffusible weapon compete against a susceptible strain (Methods).Both weapons are probably influenced by the spatial structuring of the environment.With structured environments, for example, there is the potential for diffusion limitation that might constrain long-range weapons.Spatial structure can also limit short-range weapons if single genotypes are growing in distinct patches, because this can reduce contacts between attacker and target cells 30,50 .The spatial structure of the environment, therefore, may affect short-and long-range weapons differently.To include the potential for such effects, we performed competitions when cells are growing on agar (the 'colony biofilm model') 51,52 .This assay allows us to capture the dense, spatially structured conditions thought to be typical of bacterial communities 53 , and both weapons are expected to function well in this context (Methods).The interior and edge of bacterial colonies represent distinct competition scenarios, due to the much greater potential for population expansion at the edge 54,55 .We therefore decided to sample each region separately (Methods), although the competition outcomes show similar trends between the two.Consistent with previous work, we find that both weapon systems have the potential to provide large competitive benefits for an attacking strain 43,46,56,57 .As in the models, outcomes were quantified by comparing the final ratio of attacker:susceptible cells with its initial value (the 'competitive advantage').
Overall, we find good support for our modelling predictions, despite the potential for differences in the cost of using tailocins and CDI.As the models predict, high attacker frequency is most important for the effectiveness of the long-range weapon (tailocin; Fig. 2b).In comparison, the short-range weapon (CDI) almost always performs equivalently or better at intermediate and low frequencies, especially at the colony edge (Fig. 2c).The CDI experiments also include cases where weapon performance peaks at intermediate frequency as in the model (compare Fig. 1d, high density, with Fig. 2b, density 10 4 cells).For the tailocin competition, we observe an improvement in weapon performance as initial cell densities increase.This pattern is again predicted by the model (Fig. 1), although the effect is substantially stronger in the experiments, which cover much larger total numbers and ranges of initial cell density than are possible with the modelling.We note that previous work on long-range inhibition did not find this density-dependence 28 , but the inhibitory mechanism in this study relied on the diffusion of a quorum-sensing signal and a synthetic gene circuit, not a bacterial weapon, so it is not directly comparable.
Fluorescence micrographs of the colonies show how the competitions play out in space (Fig. 2a and Extended Data Fig. 5), and allow a finer assessment of spatial structure than can be achieved with sampling of the edge and the middle for counting.These images reveal a pattern where the tailocin performs worse at the very edge of the colony as compared to CDI (Fig. 2a middle bottom).This pattern is consistent again with the requirements for tailocins to build up to be effective, as this build up is expected to happen first in the colony interior and last at the colony edge.The genotypic patchiness seen in these images is also likely to help explain the variability in the quantification data.Patchiness, especially at low density, is more prominent at the edge, leading to variation between replicates due to the coarse nature of the sampling procedure.Nevertheless, the overall patterns and difference between weapon types remain clear and statistically significant (Fig. 2b,c).
In summary, our experiments show that both weapons can be highly effective, but that the two weapons perform best under different conditions.Tailocins are extremely effective at high frequencies and densities, while CDI performs more consistently across conditions, including the unique ability to provide a competitive advantage when a strain starts out rare and at low density.

Head-to-head contests of short-and long-range weapons
Our first experiments examine the performance of each weapon type against susceptible cells that do not fight back.We next explore the case where users of the two weapons meet.In this situation, a weapon can potentially take on new significance, as eliminating competitor cells also serves to reduce incoming attacks.The agent-based model again predicts that both initial frequency and cell density can be critical to the performance of the weapons (Fig. 3a,b, Extended Data Fig. 6 and Supplementary Video 2).At low cell density, the impact of both weapons is limited, but the contact weapon user does gain an advantage when it starts in the majority.At high cell density, the long-range weapon user can win but, as in the single weapon competitions (Fig. 1d), this requires it to start at high frequency.When the long-range strain is at low or equal initial frequency, the contact weapon performs the best.
To test these predictions, we competed a strain susceptible to CDI against a strain susceptible to tailocins (pyocin R2; Fig. 3c,d).The CDI attacker was thus an LPS mutant (ΔwbpL; see above and Methods), which renders it susceptible to the tailocin.As this mutation causes changes to the cell envelope, we first checked that the CDI system remained functional.The gene deletion (ΔwbpL) did not prevent CDI from functioning, but it did reduce the advantage provided by CDI at lower initial densities (Extended Data Fig. 7).Going forward, therefore, we only provide data from the two highest initial cell densities (10 6 or 10 5 cells µl −1 ).We also focus on data from the interior of the colony going forward, as they are most reflective of typical biofilm growth 33 , but data from the colony edge are similar (Extended Data Fig. 8).As predicted by the high-cell-density model, only the CDI-using strain gains a significant advantage in equal-frequency competitions (Fig. 3d).Moreover, again as predicted, both weapon users are able to win when they start in the majority.This effect is particularly strong for the tailocin, which provides a large competitive advantage when starting from high frequency.

Contact and diffusible weapons are complementary
Our findings thus show that short-and long-range weapons can provide distinct advantages, which helps to explain why bacteria would carry both types.However, it is possible that these advantages are not provided simultaneously in practice.Therefore, we sought to experimentally study a single strain using both weapons, compared to each   weapon being used alone.To allow susceptibility to tailocins and make the comparison as fair as possible, we put all attacker strains in the same LPS genetic background (ΔwapR), and all susceptible strains in the ΔwbpL background.All competition outcomes are again adjusted for the moderate disadvantage caused by the ΔwapR mutation, and we focus on high initial cell densities as before (see above and Extended Data Fig. 9).As predicted by the study of each weapon individually, across the competitions and contexts, the two weapons function in a complementary fashion, providing an equivalent or greater benefit than either weapon alone (Fig. 4 and Extended Data Figs. 9 and 10).
That is, we find that using both CDI and tailocins can allow a strain to receive benefits from both.

Discussion
Bacteria use a vast variety of weapons to inhibit and kill competitors.
Here we have shown that two major categories of weapon-short-and long-range-can provide distinct and complementary advantages to bacteria.We find that weapons that rely on contact between cells are generally effective whether a strain is rare or common, which is consistent with previous work on the CDI systems of Escherichia coli 58 .Conversely, weapons that diffuse across long ranges are more reliant on high producer cell frequency and density.However, under these conditions, long-range weapons can be particularly powerful in eliminating both armed and unarmed competitors.These observations help to answer two related questions.First, why do short-and long-range weapons exist at all in bacteria?Here, our work suggests that a strain may benefit more from one weapon type or another, depending on its ecology.For example, if bacterial fitness is more determined by the ability of a given strain to invade communities than persist in a community, contact-dependent weapons may be most useful.This matches with observations showing that pathogens including Salmonella 59 and Vibrio cholera 60 use the T6SS during invasion of established communities, although gut-resident Bacteroides fragilis can also use its T6SS to repel invaders 61 and the H1-T6SS of P. aeruginosa fires only in response to incoming attacks 44 , underlining the flexibility of short-range weapons (Figs.1-3).
The second question is this: why do many bacteria carry both short-and long-range weapons?Again, the fact that the two weapon  5 for exact P values).Stars indicate a significant competitive advantage.The genotype of the CDI-using, tailocin-susceptible strain (blue) is ΔR2ΔwbpL.The genotype of the tailocin-using, CDI-susceptible strain (magenta) is ΔwapRΔCDI.
https://doi.org/10.1038/s41559-023-02234-2types can perform distinct functions provides an answer to why a cell would carry both.However, the possession of multiple weapons may also carry other non-mutually exclusive advantages.If two weapons are simply more potent than one, this can also favour carrying several of them 62 .In addition, if a given competitor is likely to carry resistance to some of the available weapons, natural selection may favour using multiple weapons simply to increase the likelihood that the competitor is susceptible to at least one.This explanation may be most important for cases where bacteria carry several of the same weapon type and functional differences are less pronounced, for example, P. aeruginosa releasing multiple S-type pyocin protein toxins and tailocins simultaneously via cell lysis 16 .If the use of short-and long-range weapons can be so beneficial, why is it not more widely seen in organisms other than bacteria?Short-range weapons, like CDI and T6SSs, can be used against competitors by lone cells and remain effective at low densities 58 .However, the effectiveness of long-range weapons rests upon the strength in numbers that comes with group living.Mounting evidence suggests that bacteria commonly live, and fight, as part of large groups 3 .Our work suggests that it is this propensity for group living that has led to the widespread evolution of both short-and long-range weapons.

Agent-based modelling
A major challenge in comparing bacterial weapons is that even within the broad categories of contact and diffusible, their method of deployment varies substantially.The T6SS can be fired at random intervals to deliver toxins or only in response to incoming attack 44 , whereas CDI filaments are produced to decorate attacking cells in unknown numbers, but toxin translocation occurs only in response to receptor binding on a target cell.The small-molecule antibiotics of Streptomyces are secreted from intact cells, whereas E. coli's colicins and the pyocins of P. aeruginosa require cell lysis for release.These examples also demonstrate the high variability in the cost of using weapons.The use of computational models is very amenable to these challenges, as we can unify the production of both contact and diffusible weapons under a single parameter 'secretion rate' and make their growth costs (per unit secretion) equal.
The behaviours of cellular groups are often emergent, in the sense that they can only be understood in terms of collective effects that arise whenever there are many interacting organisms 63 .A strength of our modelling approach is that it is able to capture emergent and spatial effects, such as the importance of cell shape for bacterial competition 31,33 , the importance of lytic toxins for T6SS attack 30 and the need for strong reciprocation when the T6SS is used in response to incoming attacks 30 .For each of these examples, the models predicted novel biology that was subsequently validated empirically using experimental work 29,30,33 , giving us confidence in our modelling approach.
All simulations were carried out using CellModeller 32 , an open-source software platform for running agent-based models of bacterial growth.To model contact-based and diffusible toxin secretion, we implement additional python-based CellModeller modules, whose source codes are available at https://github.com/WilliamPJSmith/CellModeller.The key processes incorporated in our model are summarized below; model variables and parameters are summarized respectively in Supplementary Tables 1 and 2.
Model description.Cell growth and division.In our simulations, bacterial cells are represented as short capsules with a fixed radius R = 0.5 µm, and a birth segment length of 0.01 µm (equivalent to a birth volume V 0 = 0.54 µm 3 ).Cells grow through elongation, dividing after doubling their birth volume V 0 , plus a small random noise term ξ V ≈ U(0, 0.05)V 0 .Each simulation timestep Δt, each cell grows by an amount proportional to that cell's current volume, V' = k grow V, discretized as V(t + Δt) = V(t) (1 + k grow Δt).Here, k grow (s −1 ) represents the net per capita growth rate.The production of ranged or contact toxins is assumed to be costly, such that weapon users suffer a growth penalty proportional to their toxin secretion rate, k grow = k max (1-ck sec ), with c, k max and k sec the pro rata toxin cost, maximum growth rate and equivalent contact toxin secretion rate, respectively.For simplicity and computational expediency, we assume throughout that nutrient access is non-limiting, such that k max is independent of cells' positioning in a community.

Mechanical interactions.
Mechanically, cells are modelled as rigid, elastic particles that push on one another as they grow and divide.Each simulation timestep, immediately following the growth stage outlined above, an energy penalty method is used to compute cell movements necessary to minimize total cell-cell overlap, subject to viscous drag forces acting on each cell.This process, described previously in detail 32,33,64 , approximates the elastic repulsion forces acting between cells in physical contact.

Contact-dependent toxins.
As in previous publications 29,30 , we use a custom Python module to represent cell-cell antagonism via contact-dependent toxins.While this module was previously used to study T6SS-mediated interference, it is a generic representation of contact-dependent warfare that allows us to make general predictions Fig. 4 | The benefits of short and long-range weapons combine positively in P. aeruginosa.Quantification of competition outcomes in the colony centre for two initial cell densities (mean inoculum density 1.9 × 10 5 , 10 6 CFU µl −1 ).Competitive advantage assesses the fold change in the attacker strain compared with its competitor from the beginning to end of the competition.Competitions where the attacker has just CDI (blue, left), just tailocins (magenta, centre) or both weapons (purple, right) show the advantage gained from using two weapons together as compared to just one.Data are adjusted to account for differences in competitiveness of the strain backgrounds (ΔwapR relative to ΔwbpL; see Methods and Extended Data Fig. 2).Horizontal bars indicate the mean from independent biological replicates, n ≥ 6; see Supplementary Table 5 for exact values of n).Stars above the double weapon data indicate a significant difference between the combination of weapons and either single weapon (blue and magenta), or just CDI (blue) (two-sided Welch's t-test, P < 0.05, Benjamini-Hochberg correction for multiple testing; see Supplementary Table 5 for exact P values).that should apply to many mechanisms, including CDI.Each simulation timestep, cells armed with contact toxins fire needles of length R, projecting orthogonally from randomly chosen sites on their cell surface.
The number of secretion events per cell per unit time is drawn from a Poisson distribution, whose mean is the secretion rate k sec .After firing, each needle is checked to determine if it comes into contact with any other cell in the population (line-segment method).Successful hits are logged for each target cell and result in cell death if their number (excluding hits by kin cells) exceeds a lethal threshold N hits = 1 (ref.65).
Diffusible toxins.We assume toxins to be freely diffusible solutes that kill susceptible cells when their local concentration u T exceeds a lethal threshold T C (controlled by N hits ; see below).To represent natural variability in toxin susceptibility [66][67][68] , lethal toxin threshold is drawn for each cell from a normal distribution, N(1, 0.2) at birth (we ignore this stochasticity in the discrete contact toxin model, because with mean N hits = 1, the chances of any cell surviving more than one hit are approximately 1:130,000).To model the toxin concentration field u T = u T (x, y) (kg T m −3 ) for a given cell configuration, we use the reaction-diffusion equation ∂u T /∂t = D T ∇ 2 u T + k T ɑ⍴ɸ(x, y) 69 .Here, D T , k T , ɑ, ⍴ and ɸ(x, y) are respectively the toxin diffusivity (m −3 ), the specific toxin production rate (s −1 ), the toxin yield per unit cell biomass (kg T kg X −1 ], the cell biomass density (kg X m −3 ) and the cell volume fraction function (unitless).In non-dimensional form, pseudo-steady-state solutions to this equation are given by ∇ 2 u T = D T ɸ(x, y).The behaviour of this equation is governed by a single parameter grouping, the Damköhler number D T = l 2 k T ɑ⍴/D T T C .Conceptually, we vary D T by changing the toxin production parameter k T , such that increases in production always incur proportional increases in production cost.We compute pseudo-steady-state solutions with the finite element method, using the FEniCS Python library and supporting CellModeller modules.Solutions are evaluated on a 2D rectangular domain of dimensions L x by L y with crossed mesh element size h = 5 µm.Solutions are subject to mixed boundary conditions: periodic boundary conditions (left and right edges), Neumann boundary conditions (base edge) and Dirichlet boundary conditions (u T = 0 along top edge).As in previous studies 69 , we assume that toxin is not subject to degradation or removal as part of its activity; toxin is only lost from the domain via leakage along the top edge.
Parity between diffusible and contact-dependent toxins.Our model aims to compare diffusible and contact weapons in a like-for-like manner.For this comparison to be as fair as possible, we assume in all cases that both weapons involve the secretion of the same (hypothetical) toxin, at the same rate k T,cell , with the same potency (lethal concentration) T C , and at the same growth cost c.For simplicity, the secretion rate is fixed within each simulation, while in reality many bacteria responsively upregulate toxin production via competition sensing 70,71 and other mechanisms 72 .Here we outline the equations that link these properties between the two models, bridging the (discrete) contact model with the (continuum) diffusible toxin model.For contact weapons, the per-cell secretion rate k T,cell is given by k T,cell = k sec T sec , with k sec (h −1 ) the per-cell secretion rate, and T sec (kg T ) the mass of toxin released by each secretion event.For diffusible toxins, this can be expressed as k T,cell = k T ɑ⍴l 3 (terms defined as above) with l 3 approximating the cell volume.The contact-dependent secretion rate k sec can therefore be related to the diffusible toxin Damköhler number, D T , as D T = T sec k sec /D T T C l.To relate the potencies of contact and diffusible toxins, we assume that N hits is equivalent to the minimum number of contact events required to raise the intracellular toxin concentration to the lethal threshold T C :N hits = T C l 3 /T sec , with l 3 approximating a cell's volume as before.Moreover, by combining these equations, we can eliminate the (unknown) contact toxin load T sec and compute D T = k sec (l 2 /N hits D T ) for the two weapons operating at equivalent secretion rates.This relation highlights that toxin diffusivity D T is a crucial parameter for our model, because increasing D T is equivalent to reducing effective diffusible toxin production while keeping contact toxin production the same.While previous work has explored the interplay between toxin diffusivity, cost and environmental structure 69 , here we assume a fixed value for D T (that for colicin Ia 73 ), which is towards the lower limit of the range explored by previous work 69 .
Simulation domain and protocols.All model simulations are run on an L x -by-L y rectangular domain with lateral periodic boundary conditions, representing a vertical 2D slice through a bacterial community.The base of the domain, y = 0, is an impenetrable substrate.The domain width L x is fixed; its height L y is set to track the maximum height p y of bacterial cell groups as L y = max(p y ) + δ, with δ the diffusive boundary layer thickness.To represent cell detachment through mechanical sloughing, cells are removed from the simulation once they reach a height h slougher .This provides a simple representation of a biofilm with a limited carrying capacity, and (by capping the number of simulated cells) allows simulations to be run for longer than if the population were allowed to increase indefinitely.All simulations are initiated by randomly scattering cells along the base edge of the simulation domain.Unless otherwise indicated, simulations run for a fixed duration of 400 steps (10 h of simulated time, timestep Δt = 0.025 h).Invasion simulations involve a two-step process: first, the domain is inoculated as above using only susceptible cells, which are then allowed to divide until the cell group reaches the slougher height h slougher .Then, a random sub-population of the susceptible cells is converted to the invading cell type, and the simulation is allowed to run for up to 1,000 steps (25 h), terminating early if either cell type is lost from the simulation.

Computation and postprocessing.
All agent-based simulations were run using a 2017 Apple MacBook Pro laptop computer, with concurrent simulations distributed between an Intel 3.1 GHz quadcore i7-7920HQ CPU, an Intel HD 630 Graphics card and an AMD Radeon Pro 560 Compute Engine.Simulation data were visualized using Paraview software (5.4.0), and analysed using custom MATLAB and R scripts.

Experiments
Strain construction.Deletion mutants were constructed using standard two-step allelic exchange methods using the vector pEXG2 and Gibson assembly 74,75 .Strains constructed and used are summarized in Supplementary Table 3. Primer sequences for up/downstream regions and exterior confirmation primers are listed in Supplementary Table 4. Constructed deletion vectors were introduced into P. aeruginosa PAO1 by conjugation with E. coli JKE201 (ref.76) and transconjugants were selected on lysogeny broth (LB) agar with 50 µg ml −1 gentamycin.After counter-selection on LB no salt, 10% sucrose, colony PCR positive clones were confirmed by Sanger sequencing (Source Bioscience) and gentamycin sensitivity confirmed.Stocks in LB 20% glycerol were stored at −80 °C.For strains with multiple deletions, they are listed in the order the deletions were made.Strains were subsequently constitutively tagged with eYFP and mScarlet (Sujatha Subramoni, unpublished) using pUC18-mini-Tn7-GmR 77 delivered by conjugation with E. coli S17λ and selected on Pseudomonas Isolation Agar with 100 µg ml −1 gentamycin.
Engineering strains for weapon comparisons.For CDI-mediated competition, we deleted the three gene locus that encodes the CDI transporter, toxin filament and immunity (PA0040-PA0041), which resulted in a strain that does not have CDI and is susceptible to CDI.For pyocin R2, we found that deletion of wbpL led to susceptibility.wbpL is a transferase that initiates the formation of LPS chains by adding the first sugar to the undecaprenol-phosphate carrier, and in a previous study a cosmid library-derived insertional inactivation mutant was found to be resistant to pyocin R2 (ref.49).For our purposes, we made an in-frame deletion mutant of wbpL from scratch, which grew poorly in liquid media.We reasoned that this was due to inhibition by its own pyocins.Consistent with this, making the wbpL mutant in a pyocin R2 Article https://doi.org/10.1038/s41559-023-02234-2deletion background restored growth.Moreover, this strain was then found to be susceptible to pyocin R2 from its parent.Finally, to confirm that wbpL was responsible for this susceptibility we complemented the in-frame deletion mutant of wbpL with a copy of wbpL on a plasmid, which restored pyocin resistance (Extended Data Fig. 4).On this basis, we are confident that, in our strain background, deleting wbpL leads to pyocin susceptibility.
wbpL was PCR-amplified from P. aeruginosa PAO1 genomic DNA and inserted into the expression vector pSEVA524 (Rubén de Dios, Eduardo Santero and Francisca Reyes-Ramírez, unpublished) 78 by Gibson assembly (NEB Hifi Assembly, NEB Location).After conjugation with E. coli JKE201 and selection on LB 10 µg ml −1 tetracycline a positive clone and a clone carrying the empty vector were tested for susceptibility to pyocin R2.Strains were grown overnight at 37 °C in LB (with 10 µg ml −1 tetracycline), then 1 ml mixed with 7 ml 0.75% LB agar and poured onto a warm LB plate to generate an overlay.Attacker cultures were also grown similarly and R pyocins were prepared by filter sterilizing supernatant from overnight cultures.Twenty microlitres was spotted on the overlays, which were then dried and incubated overnight at 37 °C prior to photographing using a Gel Doc imager.
We also made a deletion of wapR, which attaches the first L-rhamnose to the LPS core, initiating LPS capping, which did retain resistance to pyocin R2.We then had two strains, ΔwbpL and ΔwapR, that are LPS defective, but one is susceptible to pyocin R2 and one is not.These strains were thus used for the long-range diffusible weapon experiments.To account for all fitness differences due to these LPS biosynthesis mutations in the absence of effects from pyocin R2, ΔR2ΔwapR was competed against ΔR2ΔwbpL (Extended Data Fig. 4), and this difference was used as a baseline for comparison when the pyocin was present in the ΔwapR strain.All strains are available upon request.
Culturing and the colony biofilm model.Strains were recovered from cryo stocks by streaking on LB 1.5% agar and incubating overnight at 30 °C.LB 1.5% agar for competitions was prepared immediately prior to competition setup by pouring 20 ml into a Petri dish and allowing it to set for 15 min in a laminar flow hood.Colony competitions were prepared as previously by scraping cells off the overnight plate and resuspending cells to an initial OD600 of 1 (ref.51).Strains were mixed at defined ratios of 1:10, 1:1 and 10:1 then serially diluted 10-fold and 1 µl spotted on the prepared plate to generate competitions at various initial ratios and densities.Initial culture density was determined by serially diluting and spot plating.Independent biological replicates were performed with each attacker/susceptible combination carrying opposite fluorescent markers.
We performed competitions when cells were growing on agar (the 'colony biofilm model') 51,52 .In nature, most bacteria live in densely packed communities, such as surface-associated biofilms, which are densely packed and spatially structured 53,63,79 .These high-density conditions are where both short-and long-range weapons are expected to function at their best, because they ensure plentiful cell-cell contacts and the potential for factors released in the cells to build up to high concentrations 40,41,80,81 .Bacterial weapons can also strongly influence the spatial structure of competing strains, and vice versa; effects that are not captured in liquid culture 28,63,82,83 .Finally, P. aeruginosa's CDI system is upregulated in structured static cultures, as compared to shaking culture, again suggesting these are the conditions where it has most impact 46 .Growing bacteria on agar captures these dense and structured conditions in a highly tractable manner, allowing large numbers of competitions and conditions to be studied and imaged 33,51,84 (Fig. 2).Colonies also represent a good match to our model framework, which is again focused on high-density, biofilm-like conditions.

Imaging of colonies and quantification of competition outcomes.
After 48 h of growth at room temperature, colonies were imaged using a Zeiss Axio Zoom V16 microscope with a Zeiss MRm camera, 0.5X PlanApo Z air objective and HXP 200 C fluorescence light source.Forty-eight hours allowed colonies inoculated from the lowest initial densities to grow sufficiently to be observed.All colonies from a single set of frequencies and densities were imaged at the same zoom (between ×1 and ×2.5).To make the composite images shown in the figures, the display histograms of each channel were scaled to the minimum and maximum values found in the entire set of frequency and density, meaning images can be compared within sets (that is, weapon competitions) but not between.For Extended Data Fig. 5, all images were treated as a set, so comparisons can be made across all images.After microscopy imaging, colonies were sampled with a 10 µl pipette at both the centre and edge of the colony into 0.9% saline.Samples were homogenized, serially diluted and 5 µl spotted onto LB or LB 50 µg ml −1 gentamycin and incubated at 30 °C overnight.Colonies were counted to determine the final ratio of the two strains.
Calculation of competitive advantage.Using the initial density counted from the original inoculum cultures and the known inoculum ratios, the initial ratio of attacker:susceptible strains was determined.The final ratio was determined from the colony forming unit (CFU) counts of the serially diluted centre and edge samples, with a detection limit of 2,000 CFU ml −1 used to replace zeros and prevent dividing by zero.Competitive advantage was defined as the final ratio/initial ratio and is plotted on log axes.
Statistical tests.Data were checked for normality by inspecting histograms and quantile-quantile plots, then confirmed using the Shapiro-Wilk test.As most (≥75% in each set) groups were normal, two-sided t-tests (Welch's) were used to find significant differences between weapons.To account for multiple hypothesis testing, each group of tests was corrected using the Benjamini-Hochberg method.Data analysis and figures were carried out in R version 3.6.

Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.
Extended Data Fig. 1 | Agent-based modelling shows differences between weapons due to initial density of competitions, weapons depend differently on toxin secretion rate and that contact weapons better facilitate invasion than diffusible weapons at equivalent secretion rates.a Quantification of competition outcomes for all tested densities (secretion rate: 100).Densities of 10 and 100 cells correspond respectively to 'Low' and 'High' starting densities shown in Fig. 1.Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the simulation (Methods).Horizontal lines indicate the mean from multiple simulations (n = 6).b Outcomes of competition simulations over a range of secretion rates and initial attacker frequencies (10%, 30%, 50%, 70%, 90%); initial density: 150 cells.Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the simulation (Methods).Horizontal lines indicate the mean from multiple simulations (n = 7).c Quantification of competition outcomes for invasions as a function of secretion rate.Invasion outcome is the same as competitive advantage (the fold change in the attacker strain compared to its competitor from the time of invasion to the end of the simulation).Horizontal lines indicate the mean from multiple simulations (n ≥ 6, see Supplementary Table 5 for more details; only invasions where the invader was still present at the end of the simulation were analyzed).5 for exact n values).The mean (−0.637) across all replicates from all densities and inoculum ratios for the center was significantly different from 0 (One sided Welch's t-test, t = 20.48,df = 111, p = 2.2e-16), so was used as the baseline advantage of ΔwbpL over ΔwapR.This difference in advantage was subtracted from all competitions involving strains with these LPS biosynthesis gene deletions.

Extended Data Fig. 5 | Colony competitions of contact dependent inhibition (CDI) and tailocins highlight differences between contact and diffusible toxins.
Representative microscopy images of colony competitions inoculated from different starting densities (mean inoculum density 1.9 * 10 3 , 10 4 , 10 5 , 10 6 CFU/µL).and initial ratios of attacker to susceptible cells taken after 48 h of growth.All strains are expressing constitutive fluorescent protein genes and false-coloured either blue (CDI attacker, top), magenta (tailocin attacker, bottom) or yellow (susceptible, top and bottom).Scale bar indicates 500 µm.For the CDI competitions the attacker was wild-type and the susceptible has the CDI toxin and anti-toxin deleted.For the tailocin competitions, the attacker is ΔwapR and the susceptible strain is ΔR2ΔwbpL.Images shown here are representative, images were taken for every colony sampled (data presented in Fig. 2), exact values of n are detailed in Supplementary Table 5.      5 for exact p values).Stars indicate a competitive advantage significantly different from 0 (one-sided Welch's t-test, p < 0.05, Benjamini-Hochberg correction for multiple testing, see Supplementary Table 5 for exact p values).Competitions were inoculated with different initial densities (mean inoculum density 2.3 * 10 5 , 10 6 CFU/µL).The genotype of the CDI using, tailocin susceptible strain (blue) is ΔR2ΔwbpL.The genotype of the tailocin using, CDI susceptible strain is ΔwapRΔCDI.Extended Data Fig. 9 | Short and long-range weapon benefits can combine positively at the colony edge.Quantification of competition outcomes in the colony edge for two initial cell densities (mean inoculum density 1.9 * 10 5 , 10 6 CFU/µL).Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the competition.Competitions where the attacker has just CDI (blue, left), just tailocins (magenta, centre) or both weapons (purple, right) show the advantage gained from using two weapons together as compared to just one.Data are adjusted to account for differences in competitiveness of the strain backgrounds (ΔwapR relative to ΔwbpL; see methods and Supplementary Fig. 2).Horizontal lines indicate the mean from biological replicates (n ≥ 6, see Supplementary Table 5 for exact n values).The star above the double weapon data indicates a significant difference between the combination of weapons and just tailocins (two-sided Welch's t-test, p < 0.05, Benjamini-Hochberg correction for multiple testing, see Supplementary Table 5 for exact p values).Data from colony edge are noisier than in the colony center but patterns are consistent with the colony interior.

Extended Data
Extended Data Fig. 10 | Microscopy images of colony competitions with doubly-armed attackers.Representative microscopy images (taken after 48 h of growth) of colony competitions inoculated from different starting densities (mean inoculum density 1.9 * 10 5 , 10 6 CFU/µL).and initial ratios of attacking and dual CDI/tailocin susceptible cells.All strains are expressing constitutive fluorescent protein genes and false-coloured either purple (attacker) or yellow (CDI and tailocin susceptible).Scale bar indicates 500 µm.The genotype of the attacker is ΔwapR.The genotype of the susceptible strain is ΔCDIΔR2ΔwbpL.Images shown here are representative, images were taken for every colony sampled (data presented in Fig. 4).

Fig. 1 |
Fig. 1 | Agent-based modelling predicts that contact weapons are more robust to changes in frequency, density and secretion rate.a, Contact toxins (top): producing cells can deliver toxins to neighbouring cells.If a susceptible cell (yellow) is within range, the toxin is injected (left dashed circle) and the susceptible cell dies; otherwise the toxin is wasted (right dashed circle).Diffusing toxins (bottom): when the local concentration of a diffusible toxin exceeds a threshold (within dashed line), susceptible cells die.b, Cells secrete toxins, incurring a growth-rate penalty proportional to the amount of toxin being secreted (secretion rate).c, Snapshots of competition outcomes for attackers with contact-dependent toxins (blue cells, left column) or diffusible toxins (magenta cells, right column).Unarmed susceptibles (yellow cells) die upon lethal toxin exposure (black cells).The contact weapon performs better at lower frequencies than the diffusible weapon.Snapshots show cropped (150 µm) sections of the 300-µm-wide, 2D simulation domain; below the black

Fig. 2 |
Fig. 2 | Experiments show the importance of high density and high frequency for long-range weapons.Colony competitions with P. aeruginosa PAO1 between wild-type and mutants susceptible to either CDI (short range) or pyocin R2 (tailocin, long range) inoculated from different densities (mean inoculum density 1.9 × 10 3 , 10 4 , , 10 6 CFU µl −1 ).a, Representative microscopy images from equalfrequency (1:1) competitions after 48 h of growth.All strains express constitutive fluorescent protein genes and are false-coloured either blue (CDI attacker, top), magenta (tailocin attacker, bottom) or yellow (susceptible, top and bottom).Scale bar, 500 µm.b, Quantification of competition outcomes at the colony centre.One-way ANOVA showed that initial density and ratio significantly affected both weapons in the centre (CDI, density: P = 1.45 × 10 −6 , n = 80; CDI, ratio: P = 1.45 × −6 ; tailocin, density: P = 3.68 × 10 −8 , n = 91; tailocin, ratio: P = 5.01 × 10 −10 ).c, Quantification of colony competition outcomes at the colony edge.One-way ANOVA showed that initial density and ratio significantly affected both weapons at the edge (CDI, density: P = 6.54 × 10 −4 , n = 80; CDI, ratio: P = 2.29 × 10 −10 ; tailocin, density: P = 1.89 × 10 −6 , n = 92; tailocin, ratio: P = 1.43 × 10 −9 ).For b and c, competitions were assessed via counts of CFUs.Competitive advantage assesses the fold change in the attacker strain compared with its competitor from the beginning to end of the competition.The tailocin attacker advantage in b and c has been adjusted for a disadvantage in the background genotype of the attacking strain (see Methods and Extended Data Figs. 3 and 4).Horizontal bars indicate the mean of independent biological replicates (n ≥ 6; see Supplementary Table5for exact values of n).Top brackets indicate a significant difference between the weapons (two-sided Welch's t-test, P < 0.05, Benjamini-Hochberg correction for multiple testing; see Supplementary Table5for exact P values).

Fig. 3 |
Fig. 3 | Head-to-head competitions between short-and long-range weapon users.a, Modelling: snapshots of competition outcomes for cells armed with contact-dependent toxins, but susceptible to diffusible toxins (blue cells) or cells armed with diffusible toxins, but susceptible to contact-dependent toxins (magenta cells).Both cells die upon lethal toxin exposure (black cells).Snapshots show cropped (150 µm) sections of the 300-µm-wide, 2D simulation domain; below the black lines (arrows) represents the lethal concentration for the diffusible toxin.Scale bars, 50 µm; initial densities were 'low' (10 cells) or 'high' (100 cells).b, Modelling: quantification of competition outcomes for two initial cell densities: 'low' (10 cells) and 'high' (100 cells).Competitive advantage assesses the fold change in the attacker strain compared with its competitor from the beginning to end of the simulation (Methods).Horizontal bars indicate the mean from independent simulations (n = 6).c, Experiments: representative microscopy images of competitions between mutually susceptible CDI and tailocin-producing cells after 48 h inoculated from different densities (mean

Fig. 2 |
Lipopolysaccharide biosynthesis genes affect susceptibility to pyocin R2.Images of agar overlay assays showing pyocin R2 zones of clearing (arrows) for different LPS mutants.The strain in the overlay is indicated in the center of each plate.The source strain for the pyocin R2 is indicated at the corners.Pyocins were prepared by sterile filtering supernatant from overnight cultures.Overlays were prepared by mixing 1 mL of overnight culture with 7 mL 0.75% LB agar then thoroughly drying.a ΔwapR shows no zones of clearing.b ΔR2 ΔwbpL (the entire pyocin R2 gene cassette was first deleted from this strain, then wbpL deleted second) shows zones of clearing from WT and ΔwapR, but not when pyocin R2 is deleted.c Complementing ΔR2ΔwbpL with empty vector pSEVA-524 does not rescue clearing.d Complementing ΔR2ΔwbpL with pSEVA-524 carrying wbpL shows no clearing from WT or ΔwapR.Extended Data Fig. 3 | Lipopolysaccharide biosynthesis gene deletions affect competition outcomes in the absence of pyocin R2.Microscopy shows that the ΔwbpL strain cannot compete with wild-type P. aeruginosa, even in the absence of killing by tailocins (pyocin R2).Conversely, ΔwbpL and ΔwapR (second from top) are closely matched and look similar to wild-type competed against ΔR2 (top).Competitions were inoculated with ~2 × 10 6 cells/µL.Images are representative from three independent experiments.Extended Data Fig. 4 | Deletion of lipopolysaccharide biosynthesis gene wapR causes a disadvantage compared to deletion of wbpL when both strains have pyocin R2 deleted.Quantification of colony competition outcomes between lipopolysaccharide biosynthesis mutants in the absence of pyocin R2.Colonies were inoculated at the stated initial ratios and densities (mean inoculum density 1.8 * 10 3 , 10 4 , 10 5 , 10 6 CFU/µL).Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the competition.Horizontal lines indicate the mean from biological replicates (n ≥ 6, See Supplementary Table

Fig. 6 |
Agent-based modelling of head-to-head weapon competitions between short and long-range weapon users.Quantification of simulated direct weapon competition outcomes started at different initial densities, ratios and secretion rates.Density indicates the initial number of cells in the simulation.Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the competition.Horizontal lines indicate the mean from multiple simulations (n = 6).Densities of 10 and 100 cells, with secretion rate 100, correspond respectively to 'Low' and 'High' starting densities shown in Fig. 3. Extended Data Fig. 7 | Outcomes of colony competitions shows that CDI remains functional in LPS biosynthesis gene mutants, but its effectiveness is diminished at low densities.Outcomes of CDI mediated competitions in wildtype (WT, green) or asymmetric LPS backgrounds.For these cases, both strains also have tailocins (pyocin R2) deleted.The attacking CDI+ strain is either ΔwapR against a CDI susceptible ΔwbpL (mauve) or CDI+ ΔwbpL against CDI susceptible ΔwapR (orange).Colonies were inoculated at the denoted initial densities (mean inoculum density 2.0 * 10 3 , 10 4 , 10 5 , 10 6 CFU/µL) and quantified by sampling, plating and counting colony forming units after 48 h of growth.Horizontal lines indicate the mean from biological replicates (n ≥ 4, see Supplementary Table 5 for exact n values).Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the competition.Top brackets indicate a significant difference between each single weapon and the combination of weapons (two-sided Welch's t-test, p < 0.05, Benjamini-Hochberg correction for multiple testing, see Supplementary Table

5
for exact p values).Extended Data Fig. 8 | Head-to-head weapon competitions between short and long-range weapon users at the colony edge.Quantification of direct weapon colony competition outcomes at the colony edge by sampling, plating and counting colony forming units.Competitive advantage assesses the fold change in the attacker strain compared to its competitor from the beginning to end of the competition.Values above 1 (10°, dashed line) indicate an advantage for CDI, while values below 1 (that is 10 −2 , 10 −4 ) indicate an advantage for tailocins.Horizontal lines indicate the mean from biological replicates (n = 8).Top brackets indicate a significant difference between the initial ratios (two-sided Welch's t-test, p < 0.05, Benjamini-Hochberg correction for multiple testing, see Supplementary Table

Table 5
for exact values of n).Top brackets indicate a significant difference between the weapons (two-sided Welch's t-test, P < 0.05, Benjamini-Hochberg correction for multiple testing; see Supplementary Table5for exact P values).