## Introduction

In natural environments, microorganisms compete for resources, but also for space1. On solid surfaces, bacterial communities form organized structures2,3 that arrange with a wide spectrum of morphologies ranging from simple regular pancake shapes for domesticated strains or wrinkled colonies for natural isolates4,5 to streamers6, mushroom-like structures in Pseudomonas aeruginosa7 and fruiting bodies in Bacillus subtilis8 and Myxococcus xanthus9. The morphology of surface-attached communities depends on external parameters such as flow velocity6 or carbon sources10 and adapts to environmental structures like oxygen gradients11,12. As a result, spatial heterogeneities emerge inside these dense communities13,14 and induce patterns of proliferation rate15 and gene expression16,17,18.

Bacteria colonize surfaces at the solid–liquid7, solid–air12, or liquid–air11 interfaces. They are also able to invade very confined spaces, for instance porous media19, biological tissues20, or the surface of implanted medical devices21. During surface colonization, bacterial adhesion plays a central role in maintaining the physical contact between the bacteria and the substrate22. Therefore, the envelope of Gram-negative bacteria displays an arsenal of macromolecules and appendages23, spanning from surface adhesins24 to polysaccharides25, which mediate adhesion to biotic or abiotic surfaces26,27.

Surface-attached communities are seeded by single adhering bacteria, which after few division cycles form microcolonies. The physics of microcolony morphogenesis involves complex mechanical couplings between cell elongation forces28, adhesion, friction29, and also cell rearrangements and steric interactions30. Initially bacteria proliferate within a monolayer, the extent of which depends on the level of confinement: microcolonies quickly become 3D after very few divisions when growing at solid–liquid interfaces31, whereas they form wide monolayers when confined between glass and agarose32,33. During monolayer expansion, proliferating bacteria adhere to the surface. However, the turgor pressure that builds up within bacteria during cell elongation is quite large34,35 compared to forces that bacteria–substrate adhesions can sustain36,37,38. In consequence, when bacteria are crowded, they push on each other and are susceptible to detach neighboring cells and even rupture their own adhesions. Hence, it is not clear how cell adhesion and cell elongation forces dynamically and spatially coordinate in order to shape surface-attached communities.

Here we set out to understand how a microcolony can grow into a reproducible shape under different conditions and how bacteria maintain physical contacts with surface while proliferating on it. For this purpose, we measure the spatial dynamics of adhesion at both single cell and microcolony levels in surface-attached communities of rod-shaped bacteria. We show that adhesion to the substrate is stronger at the old pole of individual bacteria, creating adhesion foci at the scale of the microcolony. We further develop a quantitative model of microcolony morphogenesis that captures the mechanical rule explaining the transition from a monolayer of bacteria to a multilayered microcolony. Our results highlight how the distribution and the strength of adhesions on the bacterial surface shape the patterns of surface colonization.

## Results

### Substrate adhesion constrains microcolony morphogenesis

We started by investigating how elongation and adhesion combine to reproducibly shape microcolonies of Escherichia coli, a ubiquitous colonizer involved in nosocomial diseases. First, we examined if patterns of growth within the microcolony could contribute to its shape. We tracked individual bacteria in microcolonies growing between glass and agarose (Fig. 1a, Supplementary Fig. 1a and Supplementary Movie 1), and showed that bacteria elongate at the same rate regardless of their position within the microcolony (Supplementary Fig. 1b). As a result, bacteria are pushed outward during microcolony expansion (Supplementary Fig. 1c, d), and oldest cells39 remain at the periphery (Supplementary Fig. 2), where cells experience larger displacements (Supplementary Fig. 1e, f). Although cell elongation uniformly drives the expansion of the microcolony, steric interactions between rod-like bacteria contribute to microcolony shape anisotropy, since neighboring bacteria tend to align (Supplementary Fig. 3).

We then determined the contribution of bacteria–substrate adhesion to colony morphogenesis by comparing the wild-type strain (WT) with mutants of adhesion. We studied the effect of the absence of proteinaceous surface appendages (Δ4adh: absence of flagella, Ag43, type 1 fimbriae and curli) and exopolysaccharides (Δ4pol: absence of Yjb polysaccharide, cellulose, poly N-acetylglucosamine or PGA and colanic acid). We quantified the shape of microcolonies by measuring their aspect ratio (Fig. 1b) and showed that reduced levels of cell–substrate adhesion generate more elongated microcolonies (Fig. 1c and Supplementary Movie 2). Past a certain size, a second layer of cells (Fig. 1b, d) forms at the center of the microcolony32. The transition from one monolayer to multilayers has been shown to depend on the rigidity of the gel33 and simulations have suggested that adhesion must be involved40. For a given rigidity, we showed that this transition occurs at larger microcolony size in adhesion mutants (Fig. 1e). Therefore, the level of bacterial adhesion influences both the shape of the microcolony and the transition from two-dimensional (2D) to three-dimensional (3D) growth. However, the size at second layer formation does not correlate with microcolony shape. To gain an understanding of microcolony morphogenesis, we performed single cell experiments.

### Asymmetric adhesion at cellular level induces mechanical tensions

Heterogeneity in bacterial adhesion at the single cell level could also influence microcolony shape. Since cell elongation and steric repulsion cause collective rearrangements in the microcolony, that may screen the influence of adhesion, we monitored isolated bacteria. For the first cell cycle, we measured the movement of the center of mass (CM), ΔX and cell elongation, ΔL, in order to quantify the asymmetry of adhesion Acell through the relationship ΔX(t) = AcellΔL(t) (Fig. 2a). Since isolated bacteria elongate symmetrically around their CM41,42,43,44,45, uniform adhesion must yield a null asymmetry parameter (Acell = 0). On the contrary, we noted that the CM moves during cell growth (Supplementary Movie 3), indicating that adhesion is not uniform along the cell envelope (Supplementary Fig. 4a, b). We measured that the level of asymmetry Acell is reduced in adhesion mutants (Fig. 2b). Our results are consistent with previous observations that showed polar localization of several adhesion factors46,47,48,49. We further evidenced by immunofluorescence that Ag43, one of the deleted factors in Δ4adh, is localized at one of the two poles in E. coli cells (Supplementary Fig. 4c). Noticeably, the degree of asymmetry correlates with microcolony shape. To test if asymmetric adhesion is a particular trait of the enterobacteria E. coli, we conducted the same experiments on P. aeruginosa, a Gram-negative bacteria which belongs to a different genus. We compared a WT P. aeruginosa strain to the cupA1 fimbriae mutant, and found the same trend (Fig. 2b), suggesting that asymmetric polar adhesion could be a general feature of rod-shaped Gram-negative bacteria.

To determine which pole carries most of the adhesion, we tracked successive divisions while preventing steric interactions between daughter cells. To do so, we ablated one of the two daughter cells after each division. We first performed laser ablations on the same side of the pair of daughter cells, so that the same old pole was conserved throughout the experiment (Fig. 2c, Supplementary Movie 4 and Supplementary Fig. 5). After the first division, we were able to identify new and old poles, and orient the cell axis. The positive signed asymmetry Acell shows that adhesion is stronger at the old pole (Fig. 2c). To rule out possible artifacts due to the geometry of the ablation procedure, we performed ablations on alternating sides, so that the old pole was renewed at each generation (Supplementary Movie 4 and Supplementary Fig. 5a). Even in this configuration, Acell remained positive (Fig. 2c). The similar values obtained in the two configurations show that adhesion at the old pole fully matures over one cell cycle. This rapid maturation enables bacteria to re-attach once they have been detached by growing neighbors.

Upon division, the old poles of two daughter bacteria are located on the opposite sides of the cell pair (Fig. 2d). Since bacteria adhere more strongly at their old pole, they tend to elongate toward each other. This situation favors buckling instability30,50 that triggers rapid reciprocal repositioning of the two daughter bacteria (Supplementary Fig. 4d, Supplementary Movie 5). For WT E. coli, we observed that the magnitude of this reorganization was correlated with the level of asymmetry of the mother cell (Supplementary Fig. 4e). These results illustrate how polar adhesion, coupled with bacterial elongation, can generate mechanical tensions.

### Physical model for surface colonization by rod-shaped bacteria

Bacteria growing in close contact on a surface exert repulsive and adhesive forces. During monolayer expansion, repulsive and adhesive energies rise with the number of cells in the microcolony. Bacteria continue to proliferate within a monolayer until the energy cost that a single bacterium must pay to deform the gel above becomes lower than increasing the mechanical energy within the monolayer. To understand the transition from 2D expansion to 3D growth, we investigated how elastic energy stored in adhesive links Eadh and repulsive energy between bacteria Erep scale with the size of the microcolony Ncells and the force at adhesion foci Ffoci. We found that $$E_{{\rm adh}} = \alpha F_{{\rm foci}}^2N_{{\rm cells}}$$ and $$E_{{\rm rep}} = \left( {\beta _0 + \beta _1F_{{\rm foci}}} \right)N_{{\rm cells}}^2$$ (Supplementary Fig. 11e, f). Through these scalings, we derived an analytical expression (see Methods) for the size of the microcolony at the 2D–3D transition, N2D/3D(E, Ffoci) that depends on the Young modulus E of the soft gel and the force at adhesion foci Ffoci (Eq. (20) in Supplementary Materials, Fig. 4b and Supplementary Fig. 12). For the Young modulus E of PAA gel, this analytical expression describes the 2D–3D transition measured in force microscopy experiments (Fig. 4c inset).

Using the Young modulus E of agarose gel (Fig. 4c), we tried to infer the adhesion forces in glass–agarose experiments where they cannot be directly measured. We thus inverted the expression of N2D/3D(E, Ffoci) and deduced the force at adhesion foci Ffoci corresponding to the experimental value of N2D/3D measured at the onset of second layer formation in glass–agarose experiments (Fig. 4c). To test the validity of our model, we performed simulations with Flink set to the value corresponding to the predicted Ffoci. The simulations were able to reproduce both the organization and the shape of real microcolonies growing between glass and agarose (Fig. 4d, e).

In order to address the significance of polar adhesion, we further performed simulations using the same value for Flink but in which adhesive links were homogeneously distributed along the cell envelope. For the same set of parameters, we showed that uniform adhesion generates more elongated microcolonies (Fig. 4d) because bacteria are aligned over larger length scales (Fig. 4e). Besides providing an estimate of adhesion forces from the size of the microcolony at second layer formation, our model thus demonstrates that the subcellular distribution of adhesive links influences the shape of the microcolony.

## Discussion

We show that both the forces at adhesion foci and their asymmetric distribution on the cell envelope contribute to microcolony shape. Thus, decreasing either adhesion forces or the asymmetry in their distribution generates more elongated microcolonies. The force at adhesion foci depends on the nature and the number of adhesive links engaged in the interaction with the surface. WT E. coli exert weaker forces in PAA–agarose experiments than in glass–agarose experiments, where forces are computed from N2D/3D. Accordingly they form more elongated microcolonies in PAA–agarose experiments. On both substrates, Δ4pol exert weaker forces than Δ4adh. However, Δ4adh, which displays a higher value of Ffoci but a lower asymmetry Acell than Δ4pol in glass–agarose experiments, forms more elongated microcolonies. Hence, asymmetry appears to be the dominant factor that sets the microcolony shape.

Our results illustrate how spatial dynamics of adhesion on the cell envelope controls the shape of bacterial communities, and how these levels of organization are coupled. Surface adhesion is highly dynamic, allowing bacteria to maintain contact with the surface as the microcolony expands. The shape of the microcolonies depends on the strength of adhesion, but first and foremost on its subcellular localization. Higher asymmetry generates more circular microcolonies. The similar behavior observed for two rod-shaped species belonging to very different genera suggests that asymmetric polar adhesion is broadly relevant. Asymmetric adhesion promotes the formation of circular microcolonies where differentiation strategies can emerge, as the inner and outer bacteria experience different local environments15,61.

In addition to the spatial organization of adhesive molecules on the cell wall, cell shape also contributes to establish the success62 and the patterns of surface colonization63. Bacterial microcolonies exhibit a wide spectrum of shapes that vary from filaments to circular structures. Although the shape of rod-like bacteria constrains cell orientation within microcolonies, asymmetric adhesion introduces orientational disorder, which enables microcolonies to become rounder in shape. Since orientational disorder introduces gaps within the microcolony, rod-shaped bacteria with asymmetric adhesion can colonize larger territories using less biomass.

Finally, since the spatial distribution of adhesive molecules on the cell envelope can tune the balance between cell-to-cell and cell–environment interactions at the scale of the community, one can speculate that bacteria could actively regulate it in order to promote different patterns of surface colonization in diverse ecological contexts. Yet, understanding the mechanisms that generate the asymmetry awaits resolved spatiotemporal descriptions of the factors involved at the cell envelope64.

## Methods

### Bacterial strains

Strains and primers are described in Supplementary Tables 1 and 2. All E. coli strains were derived from strain MG1655 (E. coli genetic stock center CGSC#6300) and were constructed by the λ red linear DNA gene inactivation method using the pKOBEG plasmid65,66 followed by P1vir transduction into a fresh E. coli background or alternatively by P1vir transduction of a previously constructed and characterized mutation or insertion. We targeted the four major cell surface appendages of E. coli, i.e., flagella, type 1 fimbriae, Ag43, and curli, and the four known exopolysaccharides of E. coli, i.e., Yjb, cellulose, PGA, and colanic acid. For P. aeruginosa, the reference strain PA14 was used, as well as its fimbriae-deficient mutant cupA1::MrT7, obtained from the PA14 transposon insertion mutant library (Ausubel lab67).

### Microscopy and image analysis

Strains were inoculated in lysogeny broth (LB) from glycerol stocks and shaken overnight at 37 °C. The next day, cultures were diluted and seeded on a gel pad (1% agarose in LB). The preparation was sealed on a glass coverslip with double-sided tape (Gene Frame, Fischer Scientific). A duct was previously cut through the center of the pad to allow for oxygen diffusion into the gel. Temperature was maintained at 34 or 28 °C using a custom-made temperature controller68. Bacteria were imaged on a custom microscope using a 100×/NA 1.4 objective lens (Apo-ph3, Olympus) and an Orca-Flash4.0 CMOS camera (Hamamatsu). Image acquisition and microscope control were actuated with a LabView interface (National Instruments). Segmentation69 and cell lineage were computed using a MatLab code developed in the Elowitz lab (Caltech)70. For microcolony analysis, cultures were diluted 104 times in order to obtain a single bacterium in the field of view. Typically, we monitored four different locations; images were taken every 3 min in correlation mode56.

### Morphological measurements

Experiments were performed using a confocal microscope (Leica, SP8). The aspect ratio is defined as $$\frac{b}{a}$$, where a and b are, respectively, the large and small characteristic sizes of the microcolony. We measured a and b by fitting the mask of the microcolony with an ellipse having the same normalized second central moments. The aspect ratio accounts for the anisotropy of the shape. It is close to zero for a linear chain of bacteria and close to one for a circular microcolony. All measurements listed in Supplementary Table 3 are performed before the appearance of the second layer, which is detected manually in the time-lapse sequence.

### Force microscopy

For experiments carried out at 34 °C, bacteria were grown overnight in LB (37 °C, 200 rpm), diluted 100-fold in 5 mL of fresh LB and grown again in the same conditions for 2 h prior to experiments. Then, the fresh culture was diluted 500 times and seeded on a 2% LB-agarose pad. To promote expression of curli fibers, some experiments were also carried out at 28 °C and bacteria were taken from cultures at saturation. In that case, a 104 dilution from an overnight culture at 28 °C was directly seeded on the 2% LB-agarose pad. Under both conditions, a 4-kPa PAA gel with 200 nm fluorescent beads (FC02F, Bangs Laboratories) embedded below the surface was prepared51. The PAA gel bound to a glass coverslip was sealed onto the agarose pad with a double-sided tape. Imaging was performed through the glass coverslip and the PAA gel with an inverted Olympus IX81 microscope. Fluorescence excitation was achieved with a mercury vapor light source (EXFO X-Cite 120Q). Beads were imaged through a 100×/NA 1.35 objective lens (Apo-ph3, Olympus) and an Orca-R2 CCD camera (Hamamatsu) with a YFP filter set (Semrock). The microscope, camera, and stage were actuated with a LabView interface (National Instruments). Bacteria were imaged using phase microscopy. Force calculations were performed as previously described51,71. A Fourier transform traction cytometry (FTTC) algorithm, with 0-order regularization, was used to calculate the stress map from the substrate deformation, measured via the displacements of fluorescent beads embedded in the gel. After correction for experimental drift, the fluorescent beads were tracked to obtain a displacement field with high spatial resolution. The first frame of the movie, taken after seeding the sample with bacteria, was taken as the reference for non-deformed gel. The displacement field was measured by a combination of particle imaging velocimetry (PIV) and single particle tracking (SPT). PIV was used to take a first measurement of the displacement field induced by the mechanical interactions between the microcolony and the micro-environment. The obtained displacements were then applied to the reference bead image obtained for non-deformed gel. Relative displacement between this PIV-corrected image and the deformed image was then analyzed using SPT to measure residual displacement with subpixel accuracy. The final displacement field was interpolated on a lattice of characteristic size 510 nm. Stress reconstruction was conducted with the assumption that the substrate was a linear elastic half-space medium. We set the regularization parameter to 10−9. To estimate the noise in stress reconstruction, we compared the average stress outside the colony where no forces are physically exerted, to the average stress beneath the microcolony (Supplementary Fig. 6a). We derived the force Fcolo exerted by the microcolony on the substrate by integrating the mechanical stress over the surface covered by the microcolony. We then quantified the average stress σcolo beneath the microcolony by fitting the linear relation between Fcolo and the change in microcolony area. The maximal force was then simply obtained by multiplying the maximal value of the stress on the grid by the lattice elementary size (510 nm × 510 nm). To measure the asymmetry in force at the scale of the microcolony, we compared the maximal forces at new and old poles, rather than the average forces, because most of the poles slide on the substrate. Asymmetry of the microcolony was thus defined as follows: Acolo = $${\textstyle{{{\rm max}\{ F_{{\rm old pole}}\} _{{\rm cells}} - {\rm max}\{ F_{{\rm new pole}}\} _{{\rm cells}}} \over {F_{{\rm foci}}}}}$$.

### Single cell assays

Asymmetric adhesion assays: Overnight cultures were diluted 102 times in order to obtain on average of 150 bacteria over 10 different fields of view; images were taken every 3 min in phase contrast. Because the two poles of a bacterium are not equivalent in terms of their history39, we projected the displacement of the CM ΔX along the cell axis oriented toward the pole formed after the last division, i.e., the new pole. Since we cannot know pole history until a division has occurred, we measured the absolute value of the parameter of asymmetry $$\left| {A_{{\rm cell}}} \right|$$ in a population of isolated cells. Then, we quantified the absolute value of the average $$\left| {\left\langle {A_{{\rm cell}}} \right\rangle } \right|$$ by fitting the cumulative distribution of $$\left| {A_{{\rm cell}}} \right|$$ with a folded normal distribution (Supplementary Fig. 4b).

Single cell ablation: Ablations were performed using a UV pulsed laser (Explorer 349 nm, Spectra Physics). A train of 30 impulsions at 1 kHz was sent, each delivering to the sample a power density of about 35 kW.μm−2. Using a custom algorithm on correlation images, live image analysis enabled automatically positioning the laser spot on a chosen bacterium by moving the stage with an X,Y accuracy of 40 nm (Thorlabs, MLS203). In the Z direction, the bacterium is placed at the resolution of our autofocus, i.e., 200 nm. We used a laser with a short wavelength in order to minimize the volume of the focal spot, so that its extension is not larger than the cell width. These experiments were carried out on wild type E. coli, the larger size of which, compared to P. aeruginosa, enables successive ablations without perturbing the remaining cell (Supplementary Fig. 5b). Since we could not distinguish poles until one division had occurred, we computed the absolute value $$\left| {A_{{\rm cell}}} \right|$$ for the first generation.

Reorganization after division: Overnight cultures were diluted 103 times in order to obtain on average of 2–3 bacteria in each field of view; phase contrast images were taken in phase contrast every 30 s before septum formation and every second once the septum was visible.

Immunostaining: Bacteria were grown to OD 0.2 and anti-ag43 was used at a dilution of 1:10,000. Immunostaining was performed in 1.5 mL Eppendorfs. Bacteria were then seeded between an agarose gel and a glass coverslip before image acquisition.

### Model for microcolony morphogenesis

Bacteria are modeled as spherocylinders that elongate exponentially at rate g, $$\dot d_{\rm c} = gd_{\rm c}$$, where dc is the cell length. They are allowed to divide at a constant rate α once they have reached size dL. Division is forced if bacterial length exceeds 30% of dL. The dynamics of bacterial arrangement in the microcolony is driven by the two following effects: (i) cell–cell interactions are modeled with a Yukawa-like potential; and (ii) cell–substrate adhesion is modeled by punctual elastic links that detach above a critical force. Adhesive links are created at the two poles at the same rate. In our model, asymmetric adhesion is a consequence of cell division that gives birth to new poles free of adhesive links. Once they detach, adhesive bonds are lost.

The interaction force between bacteria is derived from a Yukawa potential. For simplicity, each bacterium is modeled as 6 adjacent balls (b = 1, …, 6) equally distributed along its length:

$$F_{{\rm cell}_{i,j}}^{b,b{\prime}}\left( {r_{bb{\prime}}} \right) = \left\{ {\begin{array}{*{20}{l}} {k_{{\rm rep}}\left( {r_0 - r_{bb{\prime}}} \right)} \hfill & ; \hfill & {r_{bb{\prime}} < r_0} \hfill \\ { - V_0\left( {\frac{1}{{r_{bb{\prime}}}} + \frac{1}{{r_1}}} \right)\frac{1}{{r_{bb{\prime}}}}{\mathrm{exp}}\left[ { - \left( {\frac{{r_{bb{\prime}} - r_0}}{{r_1}}} \right)} \right]} \hfill & ; \hfill & {r_{bb{\prime}} \ge r_0} \hfill \end{array}} \right.$$
(1)

$$F_{cell_{i,j}}^{bb{\prime}}$$ is the interaction force between two adjacent balls that belong to two distinct bacteria (i, j) and distant from rbb. krep is the elastic constant for cell–cell repulsion. The distance of repulsion r0 sets the cell width. V0 sets the potential depth and r1 sets the range of attraction.

Elastic links form at rate kon and their density saturates at nl links per ball. In the polar case, they randomly appear at either pole in a disk of diameter r0. In the uniform case, they randomly appear all along the spherocylinder. Like polymers, adhesins or polysaccharides elasticity is described by the worm-like-chain model72. The force applied on an individual link l in a given ball b is expressed as:

$$F_{{\rm adh}}^{b,l}(L) = - \frac{{kT}}{{L_{\rm p}}}\left( {\frac{L}{{L_0}} + \frac{1}{4}\left( {1 - \frac{L}{{L_0}}} \right)^{ - 2} - \frac{1}{4}} \right),$$
(2)

where L0 and L p are, respectively, the total and persistence lengths of the polymer. L is the link extension.

The links detach at a rate that depends on the tension exerted on them:

$$r_{{\rm detach}}\left( {F_{{\rm adh}}^{b,l}} \right) = k_{{\rm off}} \times \left\{ {\begin{array}{*{20}{l}} {1 + {\mathrm{arctanh}}\left( {\frac{{F_{{\rm adh}}^{b,l}}}{{F_{{\rm link}}}}} \right)} \hfill & ; \hfill & {F_{{\rm adh}}^{b,l} \le F_{{\rm link}}} \hfill \\ \infty \hfill & ; \hfill & {F_{{\rm adh}}^{b,l} > F_{{\rm link}}} \hfill \end{array}} \right.$$
(3)

The threshold in force, Flink, is a parameter used to vary the strength of adhesion.

We performed overdamped molecular dynamics simulations to model the motion of bacteria:

$$\nu _{\rm t}\frac{{{\rm d}\vec X_i}}{{{\rm d}t}} = \mathop {\sum}\limits_{b = 1}^6 \left( {\mathop {\sum}\limits_{j \in V(i)} {\kern 1pt} \mathop {\sum}\limits_{b{\prime} = 1}^6 {\kern 1pt} \vec F_{{\rm cell}_{i,j}}^{b,b{\prime}} + \mathop {\sum}\limits_l {\kern 1pt} \vec F_{{\rm adh}}^{b,l}} \right),$$
(4)
$$\nu _{\rm r}\frac{{{\rm d}\theta _i}}{{{\rm d}t}}\vec e_z = \mathop {\sum}\limits_{b = 1}^6 \left( {\mathop {\sum}\limits_{j \in V(i)} {\kern 1pt} \mathop {\sum}\limits_{b{\prime} = 1}^6 {\kern 1pt} \vec r_{bb{\prime}} \times \vec F_{{\rm cell}_{i,j}}^{b,b{\prime}} + \mathop {\sum}\limits_l {\kern 1pt} \vec r_{bl} \times \vec F_{{\rm adh}}^{b,l}} \right),$$
(5)

where i,j are the indices of the cells; V(i) designates the neighboring cells of i; b,b′ and l are respectively the indices of the balls that constitute cells and the adhesive links between the cell and the substrate; νt and νr are translational and rotational friction coefficients, respectively, for cylinders in a viscous fluid of viscosity η73:

$$\nu _{\rm t} = \frac{{3\pi \eta d_{\rm c}}}{{{\mathrm{ln}}(p) + C_{\rm t}(p)}},$$
(6)
$$\nu _{\rm r} = \frac{{\pi \eta d_{\rm c}^3}}{{3\left( {{\mathrm{ln}}(p) + C_{\rm r}(p)} \right)}},$$
(7)

where $$p = \frac{{d_{\rm c}}}{{r_0}}$$ is the aspect ratio of bacteria. Ct and Cr are given by:

$$C_{\rm t} = 0.312 + \frac{{0.565}}{p} - \frac{{0.1}}{{p^2}},$$
(8)
$$C_{\rm r} = - 0.662 + \frac{{0.917}}{p} - \frac{{0.05}}{{p^2}}.$$
(9)

When bacteria elongate, adhesive links are extended and surrounding bacteria are pushed. As a result, elastic and repulsive energies increase during the 2D expansion of the microcolony. We compute elastic and repulsive energies as follows:

$$E_{{\rm adh}}^i = \mathop {\sum}\limits_{b = 1}^6 \left( {\mathop {\sum}\limits_l {\kern 1pt} {\int}_{\hskip -5pt 0}^{L_{{\rm link}}} {\kern 1pt} F_{{\rm adh}}^{b,l}(L){\mathrm{d}}L} \right),$$
(10)
$$E_{{\rm rep}}^i = \frac{1}{2}\mathop {\sum}\limits_{b = 1}^6 \left( {\mathop {\sum}\limits_{j \in V(i)} \mathop {\sum}\limits_{b{\prime} = 1}^6 {\kern 1pt} k_{{\rm rep}}H\left( {r_0 - r_{bb{\prime}}} \right)\left( {r_0 - r_{bb{\prime}}} \right)^2} \right),$$
(11)

where, H is the Heavyside function.

We performed simulations at different values of Flink and deduced the scalings for adhesion and repulsion energies in the microcolony as a function of microcolony area, A, and force at adhesion foci, Ffoci (Supplementary Fig. 11e, f):

$$E_{{\rm adh}}(A) = \alpha F_{{\rm foci}}^2A,$$
(12)
$$E_{{\rm rep}}(A) = \left( {\beta _0 + \beta _1F_{{\rm foci}}} \right)A^2.$$
(13)

As a result, the energy of the microcolony scales as follows as a function of its area A:

$$E_{{\rm colo}}(A) = E_{{\rm adh}}(A) + E_{{\rm rep}}(A) = \alpha F_{{\rm foci}}^2A + \left( {\beta _0 + \beta _1F_{{\rm foci}}} \right)A^2.$$
(14)

Bacteria proliferate in 2D until it is energetically less favorable for the microcolony to exclusively raise the energy in the plane rather than paying the cost required for a bacterium to deform the gel and go 3D. We compared a situation in which the entire increase in surface area dA remains confined in the monolayer to a situation in which a bacterium elongates in the third dimension. For each situation, the mechanical energy of the microcolony increases by Δ2DEcolo(A → A + dA) and Δ3DEcolo(A → A + dA), respectively.

When a bacterium goes 3D, a small surface element δA does not contribute anymore to monolayer expansion and the repulsive energy of the bacterium is released. But the bacterium has to pay an energetic cost Eg to deform the gel above and a mechanical work W to extend its adhesive links in the third dimension. Δ2DEcolo(A → A + dA) and Δ3DEcolo(A → A + dA) are expressed as follows:

$${\mathrm{\Delta }}_{2{\rm {D}}}E_{{\rm {colo}}}(A \to A + {\rm d}A) = E_{{{\rm {colo}}}}(A + \mathrm{d}A) - E_{{\rm {colo}}}(A),$$
(15)
$$\begin{array}{*{20}{l}} {{\mathrm{\Delta }}_{3{\rm D}}E_{{\rm colo}}(A \to A + \mathrm{d}A)} = {{\mathrm{\Delta }}_{2{\rm D}}E_{{\rm colo}}(A \to A + \mathrm{d}A - \delta A)} { + E_{\rm g} - E_{{\rm rep}}^0(A) + W} \end{array}.$$
(16)

The average repulsion energy $$E_{{\rm rep}}^0$$ per bacterium is simply the total repulsion energy Erep (Eq. (13)) divided by the number of bacteria $$N_{{\rm cells}} = \frac{A}{{A_0}}$$ with A0 being the average area of bacteria after division:

$$E_{{\rm rep}}^0(A) = \frac{{E_{{\rm rep}}(A)}}{{N_{{\rm cells}}}} = \left( {\beta _0 + \beta _1F_{{\rm foci}}} \right)AA_0.$$
(17)

The work W of the adhesive links is proportional to the rupture force of individual links Flink, itself proportional to Ffoci and to the elongation of the links z corresponding to the indentation of the gel. Thus, W = γzFfoci. Similarly, we estimate that δA = zr0.

Knowing the Young modulus E and the Poisson ration ν of the deformable gel, we used the Hertz model to compute the energy required to deform the soft interface.

$$E_{\rm g}(z) = {\int}_{\hskip -5pt 0}^z {\kern 1pt} \frac{4}{3}\frac{E}{{1 - \nu ^2}}\left( {\frac{{r_0}}{2}} \right)^{1/2}z{\prime}^{3/2}\mathrm{d}z{\prime} = \frac{8}{{15}}\frac{E}{{1 - \nu ^2}}\left( {\frac{{r_0}}{2}} \right)^{1/2}z^{5/2}.$$
(18)

At the 2D–3D transition, the two situations have the same energy. Hence,

$${\mathrm{\Delta }}_{2{\rm D}}E_{{\rm colo}}(A \to A + \mathrm{d}A) = {\mathrm{\Delta }}_{3{\rm D}}E_{{\rm colo}}(A \to A + \mathrm{d}A).$$
(19)

By inserting $$N_{{\rm cells}} = \frac{A}{{A_0}}$$ into Eq. (19), we compute the number of bacteria at double layer formation N2D/3D:

$$N_{2{\rm D}/3{\rm D}}\left( {E,F_{{\rm foci}}} \right) = \frac{{E_{\rm g}(E) + \gamma zF_{{\rm foci}} - \alpha F_{{\rm foci}}^2zr_0}}{{A_0\left( {2zr_0 + A_0} \right)\left( {\beta _0 + \beta _1F_{{\rm foci}}} \right)}}.$$
(20)

Using this equation, we fitted the experimental data obtained by force microscopy with two parameters in order to estimate the values of the critical indentation z and γ. Values of the parameters used in this study are referenced in Supplementary Table 4.

### Data availability

The datasets generated during the current study are available from the corresponding author.