Introduction

Bacteria navigate dynamic environments by actively modulating their run-and-tumble motility, a fundamental mechanism for sensing and responding to chemical gradients, known as chemotaxis18. This locomotion alternates between directed movement (“runs”), propelled by rotating flagellar bundles, and stochastic reorientation (“tumbles”), which randomize the cell’s direction915. By adjusting run duration in response to temporal changes in attractant concentration, bacterial cells bias their motion to migrate directionally along chemical gradients9,1619.

In homogeneous liquid environments, the chemotactic ability (χ) of a bacterium is often proportional to its translational diffusion coefficient (D) 1,2023, which is intrinsically set by the mean free runtime, τf. However, in natural habitats such as soil, porous gels, or mucous layers, bacteria encounter disordered landscapes where physical obstacles act as transient traps2427. These obstacles confine motility, introducing an external trapping timescale, τt, that operates alongside the intrinsic tumbling timescale. While theoretical and experimental studies have examined how this interplay affects diffusive transport24,26,2830, a critical question remains: how does it fundamentally shape chemotactic searching and navigation strategies?

Resolving this question is critical because chemotaxis often enables far more effective population expansion than simple passive diffusion. Bacterial groups can dynamically generate their own chemoattractant gradients by metabolizing local resources, facilitating coordinated migration and rapid colonization that outstrips classical growth-diffusion dynamics1,7. This capability confers a significant evolutionary advantage. Consequently, a central question arises: how do bacteria optimize their intrinsic motility parameters, such as τf , to maximize navigation efficiency under external constraints of a disordered landscape (Fig. S1)? Understanding this adaptive optimization is key to deciphering microbial ecology and holds promise for applications in bioremediation and synthetic biology.

In this work, we investigate how bacteria optimize chemotactic navigation in disordered environments. Through experimental evolution, we identified a density-dependent optimal mean free run time () that maximizes the population chemotacitc navigation speed. Using a strain with titratable τf, we demonstrate a non-monotonic relationship between the chemotactic navigation speed and τf , where shifts according to environmental trap density. Single-cell tracking reveals that trapping-escaping events are unbiased, with escapes occurring independently of tumbling. Motivated by this observation, we developed a theoretical model showing that while prolonged runs enhance diffusion, they paradoxically suppress chemotactic bias in disordered media. This trade-off between directional bias and diffusive exploration explains the observed non-monotonic dependence of chemotactic performance on τf. Our findings elucidate a key adaptive strategy by which bacteria tune their motility, balancing exploration and trapping to navigate complex environments.

Results

Phenotypic evolution of chemotactic bacteria in agar gels

To understand how chemotactic bacteria adapt to disordered environments, we performed a spatial evolution experiment selecting for rapid range expansion in E. coli MG1655 populations3133. We propagated populations on semi-solid agar plates at two concentrations (0.2% and 0.3%), which modulate the gel’s pore size and density, thereby creating random traps that impede bacterial motility34. Bacteria were inoculated at the center of each plate; nutrient consumption generated self-generated chemoattractant gradients that drove outward migration. After 24 hours—sufficient for full plate colonization—we transferred cells from the migration front to a fresh plate, repeating this selection process over 40 cycles (~500 generations) (Fig. 1a).

Phenotypic evolution of bacterial chemotaxis in disordered landscapes.

(a) Schematic of the experimental evolution protocol for selecting rapid chemotactic navigation in semi-solid agar gels. (b) Chemotactic navigation of the evolving populations as a function of selection cycle for the two agar concentrations. (c) The average intrinsic free run time τf of evolved populations, measured in liquid medium, converges to distinct, agar concentration-dependent values. Populations evolved in denser gels (0.3% agar) adapt a shorter optimal τf .

We quantified the chemotactic navigation by imaging the expansion front, which advanced linearly with time. Over successive cycles, evolved populations at both agar concentrations exhibited a progressive increase in chemotactic navigation (Fig. 1b). Crucially, the growth rate of the evolving populations, measured every 5 cycles, remained constant throughout the experiment (see Methods and Fig. S2a). Given that chemotactic navigation is governed by the chemotaxis coefficient (χ) when growth rate is unchanged1, these results indicate that selection specifically enhanced chemotactic performance in these obstructed environments.

To identify the mechanistic basis of this adaptation, we analyzed single-cell trajectories of evolved populations using a customized tracking platform8,18,19,35. This revealed agar concentration-dependent shifts in motility parameters. Cells evolved in higher-concentration agar (0.3%) exhibited a shorter mean free run time (τf) and mean free run length compared to those evolved at 0.2% (Fig. 2c, Fig. S2b). Notably, the tumble duration (τtmb) and mean run speed (υ0) remained constant across all conditions (Fig. S2c,d). Consequently, tumble bias increased accordingly (Fig. S2e). Key motility parameters of the evolved strains including run times, run lengths, and tumble durations, retained Poisson-distributed dynamics after 40 evolutionary cycles (Fig. S3a-c). Meanwhile, tumble bias and run speed exhibited unimodal distributions after evolution (Fig. S3d,f), indicating that evolutionary tuning of τf occurred without destabilizing the core chemotaxis regulatory network22,23.

Non-monotonic navigation speed reveals an optimal run time.

(a) Design and validation of the τf-titratable strain. Left: Genetic circuit for anhydrotetracycline (aTc)-inducible control of cheZ expression. Right: The mean free run time (τf) of the engineered strain increases linearly with the logarithm of the aTc concentration. (dashed red line is the linear fit). More than 8000 cells were tracked at each aTc concentration, the standard error of the mean (SEM) of τf is smaller than marker size in all conditions. (b) Chemotactic navigation exhibits a non-monotonic dependence on the intrinsic free run time. Three replicates were performed for each condition with error smaller than marker size. The optimal free run time that maximizes chemotactic navigation is larger in 0.3% agar than in 0.2% agar.

Together, these findings demonstrate that adaptation to disordered landscapes involves the precise modulation of the intrinsic run time, τf. This evolutionary tuning optimizes motility by balancing the exploratory benefit of long runs against the increased risk of trapping. This raises a central question: how does environmental trap density mechanistically define the optimal mean free run time for efficient chemotactic navigation?

Non-monotonic dependence of chemotactic navigation on run time

The evolutionary tuning of τf suggests the existence of an optimal free runtime for bacterial chemotactic navigation in disordered landscapes. To test this hypothesis, we used a τf titratable strain in which τf increases linearly with the logarithm of the external inducer (aTc) concentration (Fig. 2a & Methods). Using this strain, we measured the population chemotactic navigation (Vd) in agar gels of 0.2% and 0.3%. We observed a pronounced non-monotonic dependence of Vd on τf: the speed initially increased with longer run times but declined after surpassing a distinct optimum (Fig.2b). This non-monotonic dependence implies a fundamental trade-off: while prolonged runs enhance diffusion exploration and gradient sensing in open environments, they concurrently increase the probability of becoming trapped in a disordered landscape that penetrates chemotactic navigation.

Critically, the value of is itself dependent on the properties of the environment. Competition assays revealed that in denser agar (0.3%), shifts to a significantly smaller value than in softer (0.2%) agar (Fig. S4).

This inverse relationship between and gel density allowed strains with values closer to the environment-specific to gain a selective advantage during range expansion. These results are in qualitative agreement with our evolutionary trajectories (Fig. 1c), confirming that selection drives populations toward the τf that maximizes the chemotactic navigation in a given landscape 7,33. The discrepancy between the measured (Fig. 2b) and the τf in evolved strains in Fig. 1c can be partially attributed to the concurrent evolution of mean swimming speed which enabled evolved strains to cover a longer distance within the same time interval (Fig. S2d).

Bacterial motion within random traps

To elucidate bacterial navigation in porous hydrogels, we sought to distinguish intrinsic behavioral states—running and tumbling—from extrinsic immobilization caused by physical confinement (trapping). In E. coli, running is driven by the rotation of a bundled flagellar motor, while tumbling is triggered by flagellar unbundling. We hypothesized that a third state exists: cells with bundled flagella that are physically arrested by the gel matrix. To differentiate these states, we employed an E. coli strain with modified FliC proteins, enabling specific fluorescent labeling of flagella15 (Fig. 3a & Methods).

Single-cell analysis of bacterial motility.

(a) Fluorescent labeling of bacterial flagella is achieved by incorporating an unnatural amino acid (UAA) into the FliC protein, followed by conjugation with AFDye-tetrazine, enables visualization of flagellar structure and dynamics. (b) Representative fluorescence time-laps micrograph of an E. coli cell embedded in a 0.2% agar gel, showing three distinct behavioral states: Run (cell in motion with bundled flagella); Trap (cell stopped with bundled flagella); Tumble (cell stopped with split flagella). (c) Left: Representative image frames with cells automatically identified and classified as having bundled or split flagella using an in-house trained YOLOv5 detection model. Right: Cells were tracked across frames to reconstruct trajectories, and velocities were calculated and annotated with corresponding flagellar states. The normalized swimming speed (normalized to the 95th percentile speed of each individual trajectory) is displayed as probability density distributions for each flagellar configuration: bundled (running or trapped) and split (tumbling), in both liquid medium (red curves) and in 0.2% agar gel (blue curves), revealing distinct motility dynamics across environments. (d) Probability density functions (PDF) of reorientation angles following tumbling (red) and trapping (blue) events in agar (see Methods).

Using high-resolution time-lapse fluorescence microscopy, we simultaneously tracked flagellar dynamics and cellular trajectories (Fig. 3b, Movies S1 and S2). A custom machine-learning pipeline, based on the YOLOv5 architecture, was trained to automatically classify flagellar configurations as “bundled” or “split” states (Fig. 3c, left). Instantaneous swimming velocities were computed and normalized to the 95th percentile speed of each trajectory to account for cell-to-cell variability8 (see Methods). This revealed a distinct bimodal velocity distribution for the bundled state in agar, contrasting with the unimodal distribution in liquid. A new peak emerged near zero velocity, corresponding to cells with active, bundled flagella whose motion was physically restrained by the gel—defining the “trapped” state (Fig. 3c, right). By integrating flagellar morphology classification with a dual Gaussian distribution model to differentiate between states, we resolved three distinct motility states within individual trajectories: running, tumbling, and trapping (Fig. S5a).

We next investigated the kinetics of these states. Run and tumble durations followed exponential distributions, consistent with memoryless, intrinsic stochastic processes. In stark contrast, trapping durations exhibited a stretched exponential distribution with a heavy tail (Fig. S5b), indicating heterogeneous escape kinetics governed by variations in local pore geometry. To determine the escape mechanism from traps, we analyzed over 9,000 run-trap-run transitions. Only 295 of these escapes (<3%) were associated with a tumble event, demonstrating that tumbling is not the primary escape mechanism. We quantified directional persistence by measuring the angular change between the incoming and outgoing run directions. While post-tumble reorientation angles were uniformly distributed, angles following trap release showed a strong bias toward the original direction of motion (Fig. 3d).

This pronounced asymmetry reveals that the agar gel does not function as a rigid barrier. Instead, bacteria appear to navigate around or through transient, deformable traps without significantly altering their heading or relying on tumbling to execute detours. This observation challenges the classical view— supported by studies in rigid polymer environments—that bacteria primarily rely on tumbling to escape confinement and reorient29,3638. Consequently, our findings redefine the role of tumbling in confined landscapes: rather than serving as an essential escape mechanism, tumbling appears to play a more nuanced role in the broader chemotactic strategy within disordered environments.

Modeling bacterial chemotaxis in disordered landscapes

Informed by our single-cell characterization of trapping and tumbling events (Fig.3 & Fig. S5), we model bacterial motility in disordered landscapes as a combination of two independent stochastic processes: run-tumble and run-trap dynamics (Fig. 4a). The intrinsic run-tumble process is governed by switching rates λrt (run to tumble) and λtr (tumble to run), which define the mean free run time τf = 1/λrt and the mean tumble duration τtmb = 1/λtr . Simultaneously, the extrinsic run-trap process interrupt runs at a rate rrtt = 1/rrt, mean runtime between traps) and detain cells for a mean trapping time τtrp = 1/rtr. The effective duration of an uninterrupted run in the gel, τR, is thus determined by the combined probability of intrinsic tumbling and extrinsic trapping: .

A minimal model reveals a diffusion-bias trade-off.

(a) Schematic of the stochastic model combining intrinsic run-and-tumble dynamics with extrinsic trapping by the environment. (b) Predicted diffusion coefficient D as a function of the intrinsic mean free run time τf for different mean trap intervals τt. In the absence of a chemo-attractant gradient, D increases monotonically with τf but is suppressed as the trap density increases (red line: low trap concentration, τt = 0.6s ; blue line: high trap concentration, τt = 0.2s). (c) Modeling chemotaxis: cells extend runs () when moving up a gradient (blue) and shorten them () when moving down (red), creating a directional bias. (d) The bias coefficient, representing the deviation of free run durations, decreases with mean free runtime τf. (e) the product of the diffusion coefficient and the bias coefficient yields the chemotactic ability χ, which exhibits a non-monotonic dependence on the mean free runtime τf. (f) Heatmap of chemotaxis ability χ in the (τft) parameter space. The optimal mean free runtime as a function of τt is shown as a red line. The external gradient G was assumed to be 1μm-1 for simplicity.

Assuming, for simplicity, uniform reorientation angles for both tumbling and trapping events, the diffusion coefficient D in a 1D system is given by: D = , where υ0 is the run speed and τS is the mean stop time, τS = Ptmbtmb + Ptrptrp, with probabilities and Ptrp = . For a fixed trapping time τtrp at a given agar concentration, this model predicts the diffusion coefficient D increases monotonically with τf(Fig. 4b). Crucially, because trapping events do not induce a directional bias (negative reorientation angles, Fig. 4d), this model alone cannot explain the non-monotonic behavior observed in our experiments, in contrast to previous models that proposed tumbling as a mechanism for bacteria to escape traps 29,36,39.

To elucidate the non-monotonic relationship between chemotactic navigation speed (χ) and mean free runtime (τf), we introduced biased runs to model chemotaxis in agar gels. Cells extend their runs when moving up gradients () and shorten them when moving down () (Fig. 4c). Reflecting the fundamental principle of bacterial chemotaxis with sensory adaptation4042, we assume runtime deviation (δτf) is proportional to mean free runtime: , where α is a constant representing the strength of the internal chemotactic response and G denotes the external chemoattractant gradient. The effective free runtimes in gradient-aligned (±) directions becomes .

This asymmetry generates a drift velocity: , where δτR (see methods), which further defines the chemotaxis ability . This chemotaxis ability χ can be decomposed into the product of a diffusion coefficient D and a bias coefficient B: χ = D · B, where .

This formulation reveals the core trade-off: while the diffusion coefficient D increases with τf (Fig. 4b), the bias coefficient B decreases inversely with τf (Fig. 4d). Their product, chemotaxis ability χ, therefore exhibits a maximum at an intermediate optimal mean run time (Fig. 4e). Analytically, this optimum scales with the environmental trapping time: (Fig. 4f & method).

This scaling explains why the evolved τf decreases with agar concentrations (Fig. 2c). A phase diagram of χ(τtf) highlights (Fig. 4f), underscoring how environmental constraints shape evolutionary tuning of motility. The observed non-monotonic navigation efficiency thus emerges from a fundamental competition between enhanced diffusion and diminished bias with increasing τf. This trade-off defines an adaptive optimum, enabling bacteria to balance exploration and directional sensing in disordered landscapes—a principle that is generalizable to microbial navigation in a wide range of heterogeneous environments.

While this simplified model successfully captures the core trade-off for optimal chemotactic navigation, we also constructed a more rigorous framework incorporating detailed chemotaxis signaling dynamics11,17,20,4248. This model integrates the adaptation dynamics of chemoreceptor free energy with the kinetics of CheY-P concentration and motor rotation, using experimentally measured constants (see Methods). From this, we derive the effective run-time deviation (δτR) as: , where τ is adaptation time of bacterial chemotaxis signaling systems, reflects sensitivity to chemoattractant gradient, F0 is the baseline signaling state20,48. Numerical simulations confirm the chemotactic navigation speed retains its non-monotonic dependence on τf , validating our core theoretical insight (Fig. S6). In this detailed model, the chemotaxis bias (B) decreases with τf across biologically relevant regimes, though weak gradient sensing at very low τf can introduce a secondary non-monotonic trend.

The non-monotonicity of chemotaxis ability χ can be understood intuitively by considering two asymptotic limits. For long τt (τf≪τt), runs are primarily terminated by tumbles (PtrpPtmb). The bias coefficient B approximates its value in a homogeneous liquid, but the short τf severely limits the effective run time τR and thus the diffusion coefficient D , constraining overall performance. For short τt (τfτt), runs are overwhelmingly interrupted by traps (Ptrp ≫ Ptmb), which impart no directional bias. Consequently, the bias coefficient B — now dominated by rare tumbling events—becomes negligible. Cells thus achieve a high diffusion coefficient but an insignificant drift velocity, rendering them unable to climb gradients effectively.

Discussion

In this study, we demonstrate that bacterial populations evolving under selection for rapid chemotactic navigation in agar gels adapt by tuning their mean free runtime (τf), with distinct optimal values () emerging for different environmental constraints. Using a τf-titratable strain, we validated that this evolutionary outcome arises from a non-monotonic relationship between the chemotactic navigation speed and τf , where represents a trade-off between diffusion exploration and preserved directional bias. Single-cell tracking with flagellar visualization characterized the bacterial run, trap, and tumble states and revealed that bacteria primarily escape confinement without tumbling or reorientation. By modeling chemotactic navigation as a competition between intrinsic run-tumble and extrinsic run-trap processes, we showed that the non-monotonic chemotaxis ability (χ), emerges from the antagonistic scaling of the diffusion coefficient (D) and the chemotactic bias coefficient (B) with τf.

Our findings extend the understanding of bacterial navigation in porous media by examining soft and compliant gels. Whereas studies in rigid hydrogels have highlighted “trapping-hopping” mode that may require active reorientation 24,25,49. our work in softer agar gels reveals that tumbling is not a primary escape strategy29,36,39, but is instead essential for to generating chemotactic bias. This discrepancy likely stems from material differences: the flexible, transient nature of agar pores permits passive escape via mechanical yielding, whereas rigid environments may necessitate active reorientation to escape immutable traps.

Our work underscores a fundamental distinction between active and passive particles. Passive systems obey linear fluctuation-dissipation relations (VDD), whereas active particles like bacteria can exhibit a non-monotonic relationship between drift velocity and diffusion coefficient. This is a direct consequence of the internal regulation of motility parameters in response to external cues. In contrast, a passive modification of bias, such as by applying an external force G, would yield a monotonic dependence, VD ∝ G.

By integrating evolutionary adaptation, single-cell biophysics, and theoretical modeling, we elucidate how bacteria optimize motility parameters to navigate disordered landscapes. Our findings advance the understanding of microbial ecology in porous media (e.g., soils, biofilms) and inform the design of bioengineered systems7,8,5052. Future work could explore how trap geometry and material elasticity modulate , and whether similar principle governs navigation in complex in vivo environments like mucosal layers or tumor microenvironments.

Materials and Methods

Evolution protocol

Exponentially growing E. coli cells MG1655 (ancestor) were inoculated at the center of tryptone medium agar plate with 2different agar concentrations (0.2%, 0.3%). After 24 hour incubation at 37 °C, bacteria colonized the entire plate. 2 μl cell-agar mixture was taken at the edge of the plate (25mm away from the center) and were inoculated at the center of a fresh plate of the same agar concentration. The cycle was repeated for more than 40 times. After each 10 cycles, evolved strains are saved in glycerol stocks. And the motion of the strains are tracked under microscope.

Quantification of bacterial motion in liquid

To quantify the phenotypic variation during the evolution process, evolved bacteria are cultured in tryptone broth and then tracked under microscope with 10X phase contrast object. The tracks were then separated into run stat and tumble stat by a clustering in 3 dimensions (speed, acceleration, and angular velocity) 18. more than 10,000 cells were tracked in each case, so that the statistics is creditable. The distributions and the cellular averaged values of the run time, run length, tumble times, mean speed, mean run speed are then calculated and plotted in Fig. S2 & Fig. S3.

Chemotactic navigation and competition with CheZ titration strains

we use a synthetic strain that the free runtime is titrated by the expression level of CheZ protein. The titration of CheZ protein was released by introducing negative feedback gene circuit of ptet-tetR or plac-lacI to replace the original promotor of cheZ genes on chromosome as in reference3. In these engineered strains, CheZ expression is controlled by externally added inducers (e.g., aTc for the ptet-tetR system and IPTG for the plac-lacI system), allowing fine-tuned titration of CheZ levels.

To assess the chemotactic performance of this run-time-tunable strain, semisolid agar plates were prepared with varying concentrations of the appropriate inducer (aTc or IPTG) uniformly mixed into the agar. Identical initial cell densities of the strain were inoculated at the center of each plate to ensure consistent and comparable conditions. Bacterial chemotactic navigation was monitored over time using time-lapse camera imaging, and the chemotactic navigation was quantified by tracking the outward movement of the colony edge.

Quantification of bacterial motion in soft agar

To understand how bacteria interact with soft agar, bacteria motions were tracked in agar gels. We first labeled the flagella of bacteria, with the method established in reference15. This labelled strain was then cultured in M9 glycerol medium to exponential growing phase, and then was mixed with the prewarmed soft agar medium with corresponding concentration so that the final OD600 was 0.04-0.06. 5 ul of this mixture was then dripped on a slide and was sealed by a cover glass. This sample was freezed in 4 °C for 5mins so that the agar solution was congealed. And then was rewarmed in 37 °C for 3mins to reactivate the bacteria before they are tracked under microscope with 60X fluorescent object. So that the flagella conformation was filmed with its position.

Using an algorithm based on YOLO v5, the images of flagella conformation were clustered into 2 stats: bundled or split. With the position of each time point of acquisition, we get the instantaneous velocity. With this information the bacterial motion in agar gel were classified into 3 stats, where run stats with bundled flagella and high velocity; tumble stat with split flagella and low velocity; trap stat with bundled flagella and low velocity.

After identifying the swimming states of bacterial motion, we determined the run time, tumble time, and trap time for each cell in agar gel by counting consecutive segments classified as running, tumbling, or trapped. Cells with short trajectory durations (<5s) or maximal displacements smaller than one flagellar length (< 10 μm) were excluded from the analysis, as they likely represent out-of-focus tracks or tethered cells that do not contribute meaningfully to bacterial chemotactic navigation dynamics.

To quantify reorientation during trapping and tumbling events, we segmented trajectories into distinct motifs: run-trap-run, run-tumble-run, and run-traptumble-run. A comparison of the frequencies of run-trap-run versus run-traptumble-run events revealed that cells typically escape traps without resorting to tumbling. The swimming direction of each run was defined by the vector from its start to end position. The reorientation angle was then computed as the angular difference between the directions of the runs immediately preceding and following each trap or tumble event.

Minimal model of bacterial chemotaxis in disordered landscape

We assume that bacteria control its intrinsic free runtime τI by adding or deducting a portion α when going up or down the chemoattractant gradient , with δτI = ατI. Although simple, this assumption captures the principle of the bacterial chemotaxis strategy. This assumption approximates the more realistic model integrating bacterial chemotaxis pathway. As the biasing factor is small, we can use a Taylor expansion to get the biased effective mean run time of the run-tumble particle:

Following this framework, the drift velocity Vd is defined as: , where υ0 is the run speed, d is the dimension factor and τs = defines the mean stop time contributed by weighted tumble time Ptmbτtmb and trapping time Ptrpτtrp .

Subscribing the τRS,δτR from the model, the drift velocity then simplifies to:

Plotting this drift velocity, we observe non-monotonic dependent on the intrinsic property τI at given disordered environment defined by τEtrp and at fixed tumble time τtmb.

Complete model with bacterial chemotaxis pathway

The free energy of the receptor then determines the CheY-P concentration Yp(t) by . the switching rate of the bacteria from run stat to tumble stat λrt and from tumble stat to run stat λtr writes λrt = ,, where ω,g,K are experimentally measured constants that describe the motor kinetics.

The bacterial receptor’s free energy was adapted to an intrinsic value F0

The run time in agar gel writes:

with

At shallow gradient limit where F is close to its steady stat value F0, one may get:

The drift velocity writes:

These results confirms that the optimal navigation strategy of bacteria on disordered landscape requires a match between the innate free runtime τf and the mean free runtime between traps τt. Cells with smaller τf didn’t use up all the free space that the environment allows it; Cells with larger τI has almost the same same runtime whether go up or down the gradient as they are trapped to a smaller free runtime defined by τE. This effect was more clearly illustrated by the response curve of τR0(F) as the climbing or sliding gradient modifies the internal free energy F by a linear manner.

Supplementary figures

Schematic illustration of bacterial chemotaxis in a porous agar gel environment.

This diagram depicts the movement of E. coli through a network of pores in agar gel, highlighting the three primary behavioral states: run (straight swimming with bundled flagella), tumble (reorientation via flagellar unbundling), and trap (a newly identified state where cells become temporarily immobilized due to physical confinement). The mean run duration between successive tumbles (τf) and mean run duration between successive traps (τt) are indicated by red arrows, representing key parameters governing motility dynamics. The orange lines represent the pore structure of the gel, while the gray background denote chemoattractant gradients. This spatially constrained environment imposes selective pressures on motility strategies of bacterial and raises questions on the optimal chemotactic navigation strategy to maximize the chemotactic navigation Vd in porous agar gel.

Evolutionary dynamics of motility and growth parameters in liquid culture across selection cycles.

Time courses of key phenotypic traits as measured in evolved E. coli populations over 40 selection cycles under two agar concentrations (0.2% and 0.3%). (a) Growth rates remain stable throughout the selection process, where error bars represent std of 3 independent measurements. (b) Mean run length declines slightly in the 0.3% agar line. (c, d) Tumble duration and mean run speed are maintained at a consistent level across cycles. (e) Tumble bias increases steadily in the 0.3% agar line, while remaining relatively constant in the 0.2% line. Motility related data represent averages from more than 4,800 individual cell tracks and over 100,000 run or tumble events per condition, with standard errors of the mean (SEM) smaller than the symbol size.

Distributions of key motility parameters in evolved strains compared to the ancestral population.

Probability density functions (PDFs) depict five fundamental motility traits measured for the ancestral strain (black lines) and two independently evolved lines selected under 0.2% (blue lines) and 0.3% (red lines) agar concentrations, with data collected from over 100,000 run or tumble events per condition. Panels (a-c) illustrate that distributions of run times, run lengths, and tumble durations all exhibit approximately exponential decay across all strains, indicating consistent stochastic processes underlying these traits. In contrast, panels (d) and (e) show that tumble bias and mean run speed are unimodally distributed, suggesting selective pressures lead to more uniform adaptations in these parameters

Competitive fitness assay reveals environment-dependent selection of optimal run duration (τf).

(a) Schematic representation of two genetically engineered E. coli strains, each with distinct inducible control over the mean run duration (τf), achieved via independent expression of CheY from the tetR and lacI systems using aTc and iPTG, respectively. The strains are fluorescently labeled (green and red) for spatial tracking during competition. (b,c) Competitive range expansion assays on 0.2% agar (b) and 0.3% agar (c), where both strains were co-inoculated at equal initial density and allowed to expand overnight at 37 °C. Fluorescence imaging reveals the spatial distribution of each strain across the expanding colony. On 0.2% agar (b) the green one dominates the outer edge of the colony, indicating superior dispersal in less confined environments. In contrast, on 0.3% agar (c), this red strain is enriched toward the center expands outward, demonstrating that shorter run durations are favored under higher physical confinement.

Motility behavior of E. coli in agar gel.

(a) Representative trajectory of a single bacterial cell moving through a 0.2% agar gel, with automatically detected behavioral states annotated: runs (blue line), tumbles (red dots), and traps (green dots). The trajectory reveals frequent reorientations and prolonged pauses indicative of physical confinement and interaction with the gel matrix. (b) Probability density functions (PDFs) of the duration for run, tumble, and trap events in 0.2% agar gel, showing distinct temporal signatures. Runs exhibit a broad exponential decay, consistent with stochastic motility, while tumbles are brief and sharply peaked. Trap durations are longer and more variable, reflecting transient immobilization due to pore entrapment.

Prediction of the model with complete chemotaxis pathway.

Simulations incorporating the full bacterial chemotaxis network reveal how key motility metrics depend on the mean trap intervals τt and intrinsic run duration τf. (a) Effective drift velocity in a chemoattractant gradient peak at intermediate values of τf, with optimal chemotaxis occurring when τf is tuned relative to τt(black line). (b) Contour plot of chemotactic ability (χ) across a range of τf and τt, revealing an increasing trend of over τt. This predicted dependence decreases with agar concentration, in quantitative agreement with experimentally observed behavioral (Fig. 1c and Fig. 2b).

Data availability

All data required to support this article is available in Zenodo at https://zenodo.org/records/17475731.

Acknowledgements

This work is partially supported by NSFC (T2525031, 32571666, 32371492), the National Key Research and Development Program of China (2024YFA0919600, 2021YFA0910703), Strategic Priority Research Program of Chinese Academy of Sciences (XDB0480000), and General Project of Basic Research under the Shenzhen Science and Technology Plan (JCYJ20230807140810022), Natural Science Foundation of Guangdong Province, China (2025A1515011919).

Additional information

Author contribution

Y. Bai & X. Fu initiated this project; Y. Bai performed the data analysis and theory deduction; C. He imaged single cell behavior in agar gel, quantified the migration rate of titrated cells and performed the competition assay; W. Liu performed the directed evolution of bacteria; S. Cheng helped in single cell imaging and analysis; P. Chu helped to construct the titration strain; L. Luo helped in the theory deduction.

Funding

MOST | National Natural Science Foundation of China (NSFC) (T2525031)

  • Xiongfei Fu

MOST | National Natural Science Foundation of China (NSFC) (32571666)

  • Yang Bai

MOST | National Natural Science Foundation of China (NSFC) (32371492)

  • Weirong LIU

MOST | National Key Research and Development Program of China (NKPs) (2024YFA0919600)

  • Xiongfei Fu

MOST | National Key Research and Development Program of China (NKPs) (2021YFA0910703)

  • Yang Bai

Shenzhen Municipal Science and Technology Innovation Council | Shenzhen Science and Technology Innovation Program (JCYJ20230807140810022)

  • Caiyun He

GDSTC | Natural Science Foundation of Guangdong Province (2025A1515011919)

  • Yang Bai

Additional files

Movie S1. Trapping stat of bacteria in agar gel

Movie S2. Tumble stat of bacteria in liquid