Introduction

Changing course effectively is fundamental to exploration and navigation by motile organisms. Although the mechanisms that underlie motility are diverse, the motile strategy of many organisms can be described as a biased random walk, in which the statistics of reorientation (turns) determine how the organism explores space, and are modulated to achieve navigation Berg (1993); Codling et al. (2008). An ubiquitous yet underappreciated aspect of turning, as implemented in these strategies, is the need to overcome inherent asymmetries in the actuating anatomy and control physiology to optimise performance. The biased random walk is effective as a motile strategy precisely because the bias is imposed in response to the environment. Biases arising from internal factors uncorrelated with the environment can thus generically be expected to diminish performance and in turn act as constraints in optimizing behavior.

One simple strategy for overcoming such biasing constraints is to randomise the direction of the bias relative to the environment. This is implemented, for example, in the swimming kinematics of E. coli bacteria, which effectively eliminate the effects of anatomical asymmetry (due e.g. to the random positioning of flagella on the cell surface) by incessantly rolling their cell body about the direction of motion as they explore their environment by swimming (runs), thereby eliminating correlations between any turning bias and the environment Berg (2004). As a result, the bacterium can optimise its exploration and navigation performance by tuning only two variables — the temporal frequency at which erratic turns (tumbles) are generated, and the average (unsigned) angle of tumble-induced turns Berg and Brown (1972).

By contrast, within the animal kingdom, the kinematics of locomotion tend to more faithfully reflect the asymmetries of animal anatomy. The vast majority (> 99%) of animal species have a bilateral body plan, meaning radial symmetry about the anterior-posterior (A-P) axis is broken to yield two more orthogonal axes: the dorso-ventral (D-V) and left-right (L-R) axes Levin (2005). This three-axis anatomical frame has tangible advantages for directed locomotion as it enables distinct motor patterns in the vertical (i.e. gravitational) and lateral directions, across which resource distributions tend to be very different Holló and Novak (2012). But these advantages also come with a cost: breaking rotational symmetry eliminates the possibility of removing detrimental directional bias by rotation about the locomotion direction. Indeed, the statistics of turning behaviour demonstrate some degree of lateral bias (handedness) across the immense diversity of bilaterian animals, from invertebrates Gray et al. (2005); Peliti et al. (2013); Buchanan et al. (2015); Ayroles et al. (2015); Helms et al. (2019) to humans Souman et al. (2009); Bestaven et al. (2012).

The causal factors that underlie turning biases are not well understood, but are likely to be diverse in origin, given the broad spectrum of reported phenomenologies. Some instances of reported turning bias were in the gradual reorientation (path curvature) during intervals of relatively smooth forward or backward motion Souman et al. (2009); Peliti et al. (2013); Helms et al. (2019). In other examples, turning bias was observed in the more discrete sharp-turn behaviours that occur either spontaneously during unbounded locomotion Gray et al. (2005) or upon forced decisions in a Y-maze Buchanan et al. (2015); Ayroles et al. (2015). Some of these turning biases persisted throughout the lifetime of an individual Gray et al. (2005); Buchanan et al. (2015); Ayroles et al. (2015), whereas at least one example ofa gradual turning bias was found to vary, and even change sign, over relatively short time scales Souman et al. (2009). The mechanistic origins are therefore likely different from case to case, and relatively few studies have been able to directly address causal factors experimentally. Nevertheless, the available data point towards neural control physiology Gray et al. (2005); Buchanan et al. (2015); Bestaven et al. (2012), rather than hard constraints at the anatomical level, as causative factors for turning bias during locomotion.

In this study, we investigate bias in the turning behaviour of the nematode C. elegans, arguably the simplest and best characterised animal model for locomotion Gjorgjieva et al. (2014). The adult hermaphrodite body plan comprises just 959 somatic cells White (1988), of which 302 are neurons with a fully mapped connectome White et al. (1986); Cook et al. (2019); Witvliet et al. (2021). Despite this compact anatomy, these worms perform a variety of locomotion tasks, such as exploration for food, chemotaxis, and escape. The relative simplicity of its anatomy, control physiology, and postural kinematic repertoire positions C. elegans as a compelling minimal model system to address fundamental questions about behavioural strategies of animal locomotion and the underlying neural control mechanisms. Previous work has identified significant orientational biases in C. elegans turning behavior Gray et al. (2005); Peliti et al. (2013); Helms et al. (2019), but how such biases affect performance in specific locomotion tasks remains an open question.

Turning during C. elegans locomotion occurs both abruptly and gradually as the worm crawls on surfaces. C. elegans crawls while lying ‘on its side’, with its L-R body axis normal to the surface. Crawling is driven by undulatory propulsion, in which body bends in the D-V direction are initiated near the head and propagated along the length of its anatomy towards the tail, resulting in postures and trajectories of motion that are approximately sinusoidal in shape. Occasionally, these forward runs are interrupted by sharp reorientation events in which the body bends deeply to generate a large change in orientation Croll (1975b), as well as brief reversal events in which propagation direction of the body wave (and hence also the worm’s movement direction) is inverted but do not otherwise change the direction of motion. When navigating environmental gradients by chemotaxis, reversals and sharp turn events are often clustered in time, generating short intervals of frequent turning (pirouettes) that interrupt otherwise smooth crawling trajectories. Modulating the temporal frequency of pirouettes in response to the environment provides C. elegans with one mechanism for biasing its random walk to achieve chemotaxis Pierce-Shimomura et al. (1999). Between these abrupt reorientation events, more gradual changes in orientation also occur, resulting in trajectories that are curved and meandering over length scales greater than those of the aforementioned body wave Peliti et al. (2013); Helms et al. (2019), and it has been shown that worms can also bias this curvature in response to environmental gradients to enhance chemotactic performance Iino and Yoshida (2009); Luo et al. (2014).

Directional biases are known to exist for both sharp and gradual turns of C. elegans Peliti et al. (2013); Broekmans et al. (2016), even in the absence of environmental gradients, yet their impact on locomotion performance has yet to be studied systematically. The sharp turns are known to be strongly biased in the ventral direction Croll (1975b); Gray et al. (2005). The biological reason for this D-V bias is not well understood, but it evidently reflects neural control, as ablating a single neuron (RIV) results in a much larger fraction of sharp turns in the dorsal direction, largely eliminating this bias Gray et al. (2005). Bias in gradual turns is less well characterized, perhaps because it is an inherently long time- and length-scale phenomenon, and thus accurately quantifying it requires extensive statistics from long trajectory recordings. However, recent studies have provided evidence that orientational statistics of crawling C. elegans trajectories collected over 30–80 min are not isotropic Peliti etal. (2013), and that biases in gradual turns (of ~2 degrees per second) can be detected even within 30 min trajectories Helms et al. (2019).

Here, we present an extensive study of C. elegans turning statistics in two contrasting behavioural contexts: exploration in the absence of environmental gradients, and escape upon encountering a strong aversive stimulus. To sufficiently sample both sharp- and gradual-turn statistics within each individual, we recorded long (120 min) trajectories within an arena enclosed by a repellent boundary. The worms spend most of their time exploring the arena by freely crawling in the absence of environmental gradients, allowing us to sample the statistics of “spontaneous” turns, which the worms execute without a triggering environmental stimulus. In addition, upon encountering the boundary impregnated with a chemical repellent, an escape response Ghosh et al. (2012); Mohammadi et al. (2013); Leung et al. (2016) is triggered, causing the worm to turn around. We quantify the strength of orientational biases in both sharp and gradual turns, and quantify their effects on performance in both behavioural contexts. This reveals how biases in turning behavior impacts both exploration and navigation, and that optimization of turn statistics can be leveraged to increase performance despite anatomical or physiological constraints.

Results

Worms in repellent-boundary arenas demonstrate both exploration and escape behaviors

Globally, the worm’s motile behaviour can be described as intervals of relatively straight forward motion (runs) interrupted by brief intervals of backward motion (reversals) and abrupt reorientation events (sharp turns). Some gradual reorientation also occurs during runs, which-despite being comparatively subtle-could cumulatively impact the navigational strategy over long times Kim et al. (2011); Helms et al. (2019); Stephens et al. (2010). Reversals have a negligible net effect on orientation once the worm reverts to forward motion. Sharp reorientation events are defined as any event where the worm performs a deep body bend and folds onto itself.

To extensively sample the reorientation behaviour of worms, we imaged the motility of C. elegans strain N2 individuals crawling on agar plates for a duration of approximately 2 hours (Methods). Worms were confined by a repellent boundary to within a 38mmx38mm arena, the entirety of which can be imaged at a resolution sufficient to resolve not only the worm’s position but also its postural dynamics (effective pixel size 18.7 pm). The motility of up to eight worms was measured simultaneously within these arenas. Throughout the duration of the measurement, the identity of each worm was tracked, enabling us to study variability in behaviour between individuals. The arena contained no food, and worms were kept off food for 15 minutes prior to the experiment, to reduce non-stationarities in behaviour that are known to affect worm motility (including sharp turn rates) for several minutes after transitioning from an on-food to an off-food environment Gray et al. (2005); Salvador et al. (2014); Broekmans et al. (2016). Reorientation statistics of 100 individual worms were obtained by analysing the video recordings (Methods), yielding a total of 12, 475 sharp reorientation events within 197 hours of trajectories. In 85% of these identified sharp turns, postural dynamics could be unambiguously resolved, thus allowing analysis of postural kinematics for 98% of the total trajectory duration.

Spatial distribution of two types of sharp turns.

(left) The spatial distribution of both spontaneous sharp turns and escape turns inside the arena. (Middle) Spontaneous turns, defined as sharp turns that occur during forward crawling, occur at an equal rate. (right) The escape turn rate, defined as sharp turns following a reversal, is sharply increased near the repellent boundary of the arena. Pixels at the edge that have been occupied by a worm with fewer than 5k data points (− 7 min) are not included.

Figure 1—figure supplement 1. Worm collisions minimally impact the trajectory dynamics.

Figure 1—figure supplement 2. Average speed across all worms remains mostly constant.

The repellent boundary not only served to confine worms to within the camera’s field of view, but also acts as an aversive stimulus. This allowed us to study reorientation statistics in two contrasting behavioural contexts within a single measurement: (i) exploration in the absence of environmental stimuli and (ii) the escape response upon encountering the strongly aversive repellent boundary. For most of the trajectory duration, worms engaged in exploratory behaviour across the arena, characterised by long runs interrupted by “spontaneous” sharp turns Srivastava et al. (2009); Broekmans et al. (2016). Upon encountering the repellent boundary, an escape response was reliably triggered, where the worm executed a brief reversal followed by a sharp turn (Figure 1). The spatial distribution of these escape turns (i.e. sharp turns that immediately follow a reversal) was highly concentrated near the repellent boundary, in stark contrast to that of spontaneous turns upon forward runs (thus without the reversal) that occurred randomly across the arena (Figure 1). Therefore, turning behaviour during exploration and escape can be distinguished by the occurrence of reversals and studied independently within the same experiment. Occasionally escape turns were observed far away from the repellent boundary (i.e. > 7 mm), but these were infrequent (14% of all turns > 7mm from the boundary). As the turn statistics does not allow us to unambiguously associate them with either spontaneous or escape turns, we did not consider them explicitly in our analysis. Similarly, we excluded turns, where the reversal behavior could not be determined or where a reversal occurred immediately after the turn. Finally, we ended up with 5799 spontaneous turns and with 2943 escape turns close to the boundary for further analysis. Importantly, this conservative filtering by turn type does not qualitatively affect our conclusions.

Finally, we note that worm behaviour was not significantly perturbed by collisions with other worms within the arena. Collisions did occur at a finite rate, but these were infrequent (on average, once every 7.8 min), could be unambiguously resolved (see Methods) and no effect on crawling speed or sharp turn frequency was detectable beyond the duration of the collision event (Figure 1–Figure Supplement 1). Thus, simultaneous tracking of multiple worms in repellent-boundary arenas enabled efficient acquisition of individual turning statistics across two contrasting behavioral contexts.

Variability in spontaneous sharp turn behaviors impact spatial exploration

The most prominent reorientation behaviours during the worm’s exploration of free space are spontaneous sharp turns, which are executed at random times even in the absence of environmental stimuli Pierce-Shimomura et al. (1999); Srivastava et al. (2009). These turns involve a deep body bend, which can occur in either the dorsal or ventral direction, but with a strong statistical bias towards the ventral side Croll (1975b); Gray et al. (2005). Sharp turns can be further classified into Ω-and δ-turns, on the basis of postural statistics Broekmans et al. (2016). Ω-turns are deep body bends, rendering the worm’s shape reminiscent of the greek letter Ω. Compared to Ω-turns, δ-turns exhibit even higher body-bend amplitudes, such that the strongly curved body not only touches but also crosses itself, resulting in larger reorientation angles.

To correctly assign sharp turns into these categories, we analysed the postural dynamics throughout each turn. Because δ-turns have been shown to occur only in the ventral direction Broekmans et al. (2016), we assigned the ventral orientation of each worm to the direction that demonstrated a greater extent in the body-bend amplitude distribution (see Methods). After this D-V orientation assignment, the distribution of body-bend amplitudes for the dorsal direction demonstrated a single peak corresponding to dorsal Ω-turns, whereas that for the ventral direction was better described as a sum of two overlapping peaks, with one corresponding to ventral Ω-turns and the other to ventral δ-turns (Figure 2A). Sorting all ventral turns into bins corresponding to each of these peaks further confirmed that δ-turns do indeed, on average, generate larger angle changes Δθ in the worm’s trajectory (Figure 2B).

In addition to the angle change Δθ, three random variables suffice to characterize the statistics of sharp turns (Figure 3A): (1) the rate ζ (min−1) at which sharp turns are executed, (2) the probability P(D) that an executed sharp turn is in the dorsal direction, and (3) the probability P(δ|V) that an executed ventral sharp turn is a δ-turn. The statistics aggregated over all 100 worms confirmed that during exploration, there is a strong preference for ventral turns over dorsal turns, and within ventral turns for Ω-over δ-turns (Figures 2 and 3) Gray et al. (2005); Kato et al. (2015); Nagy et al. (2015). However at the level of individual trajectories, all three random variables demonstrated substantial variation about the population (Figure 3B-D, blue). Across individuals, the sharp turn frequency was found to vary by at least an order of magnitude. Some worms did not execute any dorsal turns or δ-turns over the course of the 2 h measurement, whereas at the opposite extreme, such turns accounted for more than half of all sharp turn events. The variability across individuals was not trivially explained by the finite number of samples within the 2 h measurement, as the distribution of all three random variables from the measured data were broader than that for Monte Carlo simulations (see Methods) that assumed all worms were realizations of identical random variables with parameters corresponding to the population mean (Figure 3B-D, orange, Figure 3–Figure supplement 2).

To evaluate how each of these sharp-turn parameters affect exploration performance, for each trajectory we computed its persistence length P = Dt/s, where Dt is the translational diffusion coefficient and s is the movement speed. While Dt depends on both the path geometry and the speed along the trajectory, the persistence length mainly captures the effect of the path geometry and thus more directly links to turning behavior. We extract the persistence length from the relationship between the mean-squared displacement (MSD) and the contour length (Figure 3–Figure Supplement 4, see Methods). Comparing the persistence length to the turning parameters for each trajectory revealed that the D-V sharp turn bias was not significantly correlated (−0.13 ± 0.25, 95% CI) to the persistence length, and the Ω-δ preference was only weakly correlated (−0.20 ± 0.14, 95% CI) (Figure 3FG). Thus, neither of these sharp-turn biases substantially affect exploration propensity. By contrast, the temporal frequency of sharp turns demonstrated a strong negative correlation with the persistence length (−0.59 ± 0.12, 95% CI); worms that turn at higher frequency explore smaller areas (Figure 3E). In short, we found that each of the random variables (ζ, P (D), and P (δ | V))vary significantly among individuals, but while sharp turn frequency is strongly negatively correlated with the persistence length, the D-V and Ω-δ biases have little impact on this measure of exploratory propensity.

Ω and δ turns are separated by thresholding the loading of the third Eigenworm Broekmans et al. (2016); Stephens et al. (2008).

(A) The distribution of (top) ventral and (bottom) dorsal maximum Eigenmode loadings across both spontaneous sharp turns and escape turns. The ventral distribution can be approximated as the sum of 2 Gaussians (black). The orange Gaussian is an approximation of the Ω turn distribution, and the blue Gaussian is an approximation of the δ distribution. The A3 value where the lines cross, 18.0 (black dashed line), is henceforth used as the threshold to separate Ω and δ turns. The dorsal distribution only includes Ω turns. (B) The distribution of (top) ventral and (bottom) dorsal reorientation angles towards the direction of the body bend. The distribution of Ω and δ turns after thresholding the maximum A3 amplitude in orange and blue respectively.

Bias and fluctuations in gradual turns negatively impact exploration

During exploration, gradual adjustments in the direction of movement occur between spontaneous sharp turn events Peliti et al. (2013); Salvador et al. (2014), causing meandering trajectories on length scales longer than the body wave and in some instances even forming loops (Figure 4A). Such effects on trajectories shape reduce the directional persistence of the worm’s motion between sharp turn events, and hence could be expected to negatively impact the exploration propensity P. We therefore proceeded to quantify the effects of these more subtle reorientations.

Gradual reorientation dynamics were extracted from the worm’s body orientation (see Methods), which provides an accurate proxy for the direction of movement (i.e. the velocity bearing) during runs, even when moving at low speeds. Over the course of the experiment, the unwrapped body orientation (i.e. cumulative angle change) of most worms demonstrated many full rotations, indicating a significant bias in the gradual-turn dynamics (Figure 4B). Interestingly, whereas some worms accumulated rotations persistently in the dorsal (14/100 worms) or ventral (24/100) direction (Figure 4B, green and blue curves, respectively), most worms (62/100) demonstrated rotations in both the dorsal and ventral directions (Figure 4B, red curves).

The gradual-turn dynamics also feature faster orientation fluctuations, causing the unwrapped body-orientation trajectories to be jagged, rather than smooth curves (Figure 4B). To examine the statistics of gradual turns across timescales, we computed the mean-squared angular displacement (MSAD) of the unwrapped body orientation as a function of time (Figure 4C, blue curve), which showed similar dynamics compared to a previously published data set Stephens et al. (2010) (Figure 4C, green curve). For timescales longer than the body wave oscillations (~ 2 s) but less than ~ 10s, the local power-law scaling exponent (i.e. the log-log slope) of MSAD(t) was close to unity (Figure 4C, Inset), indicating that fluctuations around this timescale are well-approximated as pure (i.e. Brownian) angular diffusion. Consistently, angular deviations observable at short times/lengths decorrelated nearly completely within a single body wave (Figure 4–Figure Supplement 1). Therefore, these random orientation changes on short time- and length-scales (comparable to the body wave) can be modeled as an angular diffusion process Helms et al. (2019) (see Methods), characterized by a angular diffusion coefficient DΨ which varied from worm to worm but most commonly was around 0.2 rad2mm−1 (Figure 4D). For longer timescales, the angular dynamics were increasingly super-diffusive, with the local scaling exponent plateauing around 1000 s at a maximum value of ~ 1.86 (Figure 4C, Inset), consistent with a persistent gradual-turn bias (perfectly circular trajectories would yield an exponent of 2.0). Thus, the worms’ reorientation dynamics can be described as a combination of two processes: (1) angular diffusion resulting in meandering trajectories and (2) a gradual-turn bias (rotational drift) causing the trajectories to form loops Helms et al. (2019).

Variability in turn frequency, but not D-V bias or Ω-δ bias, substantially affects exploratory propensity.

(A) Schematic illustration and population-average statistics of the three random variables that govern spontaneous sharp turns: (left) the turn frequency, ζ; (center) the dorsal turn probability P(D), a measure of D-V bias in sharp turn orientation; (right) the δ-turn probability P(δ|V), a measure of Ω-δ bias for ventral turns. The most common turn type is an Ω-turn in the ventral direction. (B-D) Distribution across the population of the three random variables ζ (B), P (D) (C), and P (δ | V) (D) indicate substantial variability across individuals. Blue bars represent statistics for individual measured trajectories, and orange bars are from Monte Carlo simulations assuming all individuals are sampled from a population with identical parameters for the corresponding random variable (see Methods). (E-G) Relationship between the trajectory persistence length P, a measure of exploratory propensity, and the three random variables ζ (F), P (D) (G), and P (δ | V) (H). P demonstrates a substantial negative correlation with the sharp turn rate ζ (−0.59 ± 0.12, 95% CI; p ≤ 7.7 · 10−11), but its correlation with D-V bias and Ω-δ bias was, respectively, insignificant (−0. 13 ±0.25, 95% CI; p ≤ 2. 1 · 10−1) and marginally significant (−0.20 ± 0. 14, 95% CI, p ≤ 4.2 · 10−2). Indicated p-values were computed using a t-test assuming a two-tailed probability.

Figure 3—figure supplement 1. Interval distribution of spontaneous turns.

Figure 3—figure supplement 2. Variability across worms compared to random resampling.

Figure 3—figure supplement 3. Variance attributed to individual experience and batch effects.

Figure 3—figure supplement 4. Mean-squared displacement of individual worms and population average.

Gradual turning behaviour during exploration demonstrates both short-time fluctuations and long-time biases.

(A) Representative trajectory segments (10, 000 frames = 14.5 min) for 3 individual worms, demonstrating strong (blue), intermediate (green) and weak (red) gradual-turn bias and correspondingly different trajectory curvature. In addition to the ‘loopiness’ caused by the long-timescale bias, diffusive orientation fluctuations induce wiggles in the shape of trajectories. Scale bar 10 mm. (B) Gradual-turn bias can cause trajectories to accumulate many net rotations during the course of the experiment, resulting in a slope. A positive value means that the worm has rotated more in the ventral direction than in the dorsal direction. Inset: angular changes on short time scales from undulatory fluctuations, result in an effective angular diffusion DΨ. (C) The average mean-square angular displacement (MSAD) and (inset) the local exponent (i.e. log-log slope) of the unwrapped average body angle across worms of our data set (blue) and a previously published data set from ref. Stephens et al. (2010) (green; see Methods) show near ballistic behaviour on long time-scales. A slope of 1 indicates diffusive angular dynamics, and a slope of 2 corresponds to ballistic angular dynamics. The dip in the slope of the blue curve of the MSAD at ≈ 2 s can be attributed to angular oscillations due to the body wave (and is not observed in the green curve, due to differences in the sampling rate and the manner in which angular dynamics were extracted; see Methods). (D) Probability density histogram of the angular diffusion coefficient DΨ, extracted from each of 100 individual trajectories. (E) Probability density histogram of the local gradual-turn bias K, defined as the average trajectory curvature within 15 min windows, extracted from all such non-overlapping windows in all 100 trajectories. The sign of κ was set to be positive in the ventral (V) direction and negative in the dorsal (D) direction. The average rotational drift for each worm shows no dorso-ventral population mean. (F) Slow fluctuations gradual-turn bias decorrelate on a timescale comparable to the duration of the measurement, and can be fit by a single-exponential decay with a time constant of82 ± 17 min. Because the time scale of the fluctuations is similar to the length of the measurement, the mean cannot be established of individual measurements, and the global mean value of 0 is used. (G) The angular diffusivity DΨ is negatively correlated with the persistence length P, with a correlation coefficient −0.57 ± 0. 13 (95% CI) (p < 2.9 · 10−10). (H) The root-mean-square gradual-turn bias κRMS is strongly negatively correlated with the persistence length P, with a correlation of −0.72 ± 0. 11, (95% CI) (p < 1.3 · 10−17). Indicated p-values were computed using a two-tailed t-test.

Figure 4—figure supplement 1. Reorientations are nearly decorrelated after a single body wave.

To quantify the gradual-turn bias, we computed the trajectory curvature κ, averaged over windows of 15 min, the time scale around which the slope of MSAD(t) was maximal (Figure 4C, Inset) and hence orientation dynamics were most persistent. The distribution of κ pooled from all 100 trajectories was distributed approximately symmetrically in the dorsal and ventral directions (Figure 4E) with a mean that is not significantly different from zero (0.00±0.02, 95% CI), indicating no net D-V bias across the ensemble of trajectories. However, as noted above, the gradual-turn bias of individual trajectories tends to fluctuate slowly over time. To characterize the timescale of such slow fluctuations in the gradual-turn bias, we computed the autocorrelation function of κ (ACF κ(t) ≡ 〈κ (0) κ (t)〉) (Figure 4F). Within the timescale of the measurement, the ensemble average 〈ACFκ(t)〉 decayed to 0.2, with a profile consistent with a single-exponential 〈ACFκ(t)〉 ~ e−t/τ with decay time constant τ = 82 ± 17 min (see methods). Thus, although the 2 h timescale of our experiment precludes confirming the full decorrelation of these slow fluctuations, the data are compatible with a model in which gradual-turn bias fluctuates slowly in a manner that when averaged over very long times (≫τ) has little or no net bias (per the near-zero κ-distribution mean), but has at any instant of time a finite magnitude (in the range of the κ-distribution width).

As noted above, both the short-timescale angular diffusion and the longer-timescale bias of gradual turns can be expected to negatively impact exploration. Consistent with this idea, worm-to-worm variation in both the angular diffusivity DΨ and the root-mean-square (RMS) magnitude of the gradual-turn bias (κRMS) demonstrated clear negative correlations with the exploration propensity P of trajectories (Figure 4G,H).

In summary, although the gradual-turn bias is relatively weak (〈κRMS〉 ≈ 0.2rad mm−1) and fluctuates slowly over time with an approximate zero mean, its cumulative effect on the exploration propensity P over longtime- and length-scales are comparable to, or greater than, that of the short time- and length-scale angular diffusion.

A finite gradual-turn bias leads to an optimal choice for angular diffusivity

The data presented above demonstrate that each of three turning-behavior parameters — the sharp turn rate ζ, gradual-turn diffusivity DΨ and bias magnitude κrms are negatively correlated with the exploratory propensity P (i.e. the persistence length) of trajectories. Yet the manner in which these different turning components affect exploration might not be independent. To gain insight into the relative contributions of, and interactions between, these parameters in determining the persistence length P, we constructed a minimal model of the worm’s turning behaviour.

Changes in the lab-frame orientation Ψ along the trajectory contour x is described as a sum of two terms: a constant angular drift accounting for the gradual-turn bias, and angular diffusion:

where κ [rad/mm] is the constant angular drift, DΨ [rad2/mm] is the angular diffusion coefficient, and dWx is an increment of a Wiener process along the contour coordinate x. Sharp reorientation events occur with a uniform probability per unit length along the trajectory contour, determined by the turn frequency ζ [s−1] and speed s [mms−1] of the worm:

The experimental observation that sharp turns do not completely randomize the orientation but are instead biased, on average, slightly towards the reverse direction (i.e. 〈cos Δθ〉 < 0; Figure 2B) can be accounted for by scaling the sharp turn frequency by a factor α = 1 − 〈cos ΔθTaktikos et al. (2013); Locsei (2007), for which we use the population averaged value α = 1.33.

We can solve analytically for the expected persistence length P, yielding a simple closed form expression (see SI text):

Here ε = αζ/s + DΨ is the effective rate of random reorientation, combining the effects of sharp turns and angular diffusion. The persistence length computed using this analytical solution is in excellent agreement with numerical simulations of the model (Figure 5–Figure Supplement 1), and further accurately predicts the persistence length of the measured worm trajectories (Figure 5C; Pearson correlation ≈ 0.8).

The simple analytical form of Eq. (3) also provides insights into the dependence of this measure of exploratory propensity on the underlying parameters. It is clear that a non-zero curvature (| κ | > 0) monotonically impairs the persistence length (i.e. ∂P/|κ| < 0; Figure 5A,B). Interestingly, it also reveals that, given any nonzero value of κ, there exists a finite value of ε that maximizes P (i.e. ∂2P/∂ε2 < 0 at ∂P/∂ε = 0). When ε ≫ |κ|, effects of the gradual-turn bias are negligible and the persistence length becomes inversely proportional to ε. When ε ≪ |κ|, the trajectory becomes circular, leading to oversampling of space within a region of length scale κ −1, the circling radius. In this latter regime, P increases with ε because random reorientations are required to free the worm from the circular orbit. Thus, P increases with ε at small ε but decreases with ε at large ε, and an optimum in P occurs when the random reorientation rate is balanced with the curvature (i.e. when ε = κ).

Figure 5D compares the measured values for ε and κRMS with the theoretical predictions on optimal exploration. Interestingly, although both ε and κRMS were found to vary substantially across individuals, when averaged over the entire measured population (Figure 5D, white points), these values were nearly identical to one another (red point) and thus close to the predicted optimum (solid line). This can be largely attributed to the contribution of the rotational diffusivity DΨ, which for exploring worms in the absence of food, evidently dominates over the sharp turn rate ζ and is by itself comparable in magnitude to ε (Figure 5D, compare orange and red points). Our model therefore indicates that, on average, the rotational diffusivity DΨ of worms is set very close to the optimal value that balances their finite gradual turn bias κ to maximise the exploratory propensity, quantified by P.

A simple turning model explains the data and reveals an optimality principle for exploration under biasing constraints

(A) Exploratory propensity, characterized by the trajectory persistence length P, decreases monotonically with increasing turning bias κ, regardless of the rate of random reorientations ε. (B) By contrast, P can either increase or decrease with ε, depending on the value of κ. (C) The measured persistence length Pdata agrees well with predictions of the model Pmodel based on the turning parameters κRMS and ε measured in each worm. The analytical model assumes a constant | κ | = κRMS. (D) The magnitude of the gradual-turn bias κRMS and the effective random-reorientation rate ε is of the same order. Each trajectory is displayed as a white point. The red point is the population average, computed from all trajectories. The orange point indicates the population average for the case that sharp turns are ignored (equivalent to the limit α → 0 in our model), so that ε is defined by rotational diffusion alone (i.e. εDΨ). Error bars represent 95% confidence intervals. The analytical expression for the persistence length is P = ε/(κ2 + ε2)/2, where κ is a constant angular drift (thus |κ| = κRMS) and ε = αζ/s + DΨ is the effective reorientation rate with the angular diffusion coefficient DΨ, the speed s, the sharp turn frequency ζ, and a factor α accounting for the non-uniform distribution of sharp turn angles.

Figure 5—figure supplement 1. The analytic solution of the model closely follows simulations.

Figure 5—figure supplement 2. Evidence for the existence of small reorientation events.

Context-dependent modulation of both D-V and Ω-δ statistics symmetrizes escape performance under biasing constraints

Escaping from a threat represents an acute challenge for trajectory reorientation. The goal of an escape response is to rapidly change the direction of motion so as to crawl away from the perceived source of an aversive stimulus (within our experiment, the arena boundaries impregnated with a chemorepellent) (Figure 6–Figure supplement 1). If the worm were able to respond perfectly to the threat, the orientation θout of the escaping worm after the turn would point in the direction exactly down the repellent gradient, orthogonal to and away from the boundary (θout = 180°; we define 0° to be the direction of the shortest path to the boundary). However in reality, the re-orientation behavior can be expected to deviate from this optimal case due to various constraining factors, ranging from asymmetries in the worm’s anatomy and control physiology to limited information about the orientation of the aversive environmental gradient.

Escape-turn statistics reveal discrete, rather than continuous, control of exit angles to overcome biasing constraints.

(A) We characterise worm orientation during escape turns by the angle θin of the body orientation vector (pointing from tail to head) relative to the repellent gradient (approximated as the vector pointing from the worm centroid to the nearest point on the repellent boundary), where θin = 0° means the worm points directly up the gradient and 0° < θin < 180° and −180° < θin < 0° correspond to the nearest repellent boundary being on the ventral and dorsal sides, respectively. (B) The average reorientation angle 〈|Δθ1〉 of escape turns close to the boundary demonstrates negligible dependence on θin for dorsal Ω-(green), ventral Ω-(orange) and ventral δ-turns (blue), respectively. The dashed line denotes the values for spontaneous turns. (C) Like for spontaneous turns, the worm makes a decision between dorsal and ventral turns, and if turning ventrally between omega and delta turns. The decision tree shows the average probabilities for spontaneous turns (P(D) = 0.24 ± 0.01, P(δ|V) = 0. 18 ± 0. 1) and escape responses close to the boundary (P(D) = 0. 16 ± 0.01, P(δ|V) = 0.40 ± 0.02). Escape-like turns far away from the boundary display intermediate values for P (D) = 0.21 ± 0.03 and P (δ|V) = 0.30 ± 0.03. (D) The D-V bias of escape turns is modulated such that the dorsal turn probability P (D) is suppressed when the repellent is encountered on the dorsal side (−90° < θin < 0°). Dashed line: average P (D) for spontaneous turns during exploration. (E) The Ω-δ bias of ventral escape turns is also modulated, with the δ-turn probability P (δ|V) being increased when the repellent is encountered on the ventral side (0° < θin < 90°). Dashed line: average P (δ|V) for spontaneous turns during exploration. (F) After the turn, the worm leaves at an angle θout (red arrow), which is defined in the environmental reference frame, analogously to θin with θout = 0 if the worm is heading directly towards the boundary. In the anatomical reference frame of the moving worm, the escape turn results in an exit angle either on the ventral side (via a ventral Ω-turn) or on the dorsal side (via a dorsal Ω- or a ventral δ-turns) of its body. Successful escape in the anatomical reference frame is defined by turns that result in exiting the turn on the opposite side of the body as the repellent encounter (gold arrows). (G) The environmental escape probability quantifies how likely the worm is moving moving away from the repellent boundary after the turn (i.e. | θout| > 90°), which depends on the incoming angle θ in. The distribution is asymmetric and higher if the cue is encountered on the dorsal side of the body. (H) The escape probability in the anatomical reference frame quantifies whether the worm escapes on the dorsal or ventral side of its incoming body, respectively: = (1 − P(D))(1 − P(δ|V)) if θin ≤ 0° and = P(D) + (1 − P (D)) P(δ|V) if θin ≥ 0°. It is modulated depending on the incoming orientation θin. The black dotted curve denotes a fit of ±A sin(θin) + 0.5. In all panels, shaded regions correspond to 95% confidence intervals.

Figure 6—figure supplement 1. Escape turns are triggered at the boundary.

Figure 6—figure supplement 2. Comparison of escape response and spontaneous turn across individuals.

We resolved a total of 2.943 escape responses within our dataset, triggered near the repellent boundary (< 7mm from the boundary, Figure 1), which consist of a reversal motion followed by one of three types of posturally distinct sharp turns: ventral omega (VΩ), ventral delta (), or dorsal omega (DΩ). This set constitutes the full repertoire of sharp turns also observed in the freely moving case, Figure 2. The amplitude of each of these sharp-turn types, characterized by the typical angle change 〈|Δθ|〉, were — if at all — very weakly modulated as a function of the incoming angle of approach toward the repellent boundary θin (Figure 6A,B), and remained very similar to those during free exploration (Figure 6B, dashed lines).

By contrast, the probability of executing each of the three sharp-turn types differed significantly from that during free exploration. During escape responses, the average dorsal-turn probability P(D) is decreased from 0.24 ± 0.01 to 0.16 ± 0.01, and the average delta-turn probability P(δ|V) is increased during escape turns from 0.18 ± 0.01 to 0.40±0.02(95% CI, using bootstrapping), leading to an overall increase in VΩ and turns, and a decrease in DΩ turns. (Figure 6C). Furthermore, the average dorsal and δ-turn biases of the escape turn were not correlated with the aforementioned individual biases of each worm during exploration (Figure 6–Figure Supplement 2), thus ruling out that these differences in decision statistics are due to sampling bias (which could arise if individual turn biases were correlated with boundary encounter rates). Taken together, these observations strongly suggest that the worm’s decision to select one of the three sharp-turn types during escape reflect the specific context of the escape challenge.

Consistent with this idea, we found that both the probability for a dorsal turn and that for a δ turn during escape are modulated as a function of the incoming angle θin of approach to the repellent boundary. When the worm approaches the repellent boundary on its dorsal side (θin < 0°), the dorsal turn probability P(D) is strongly suppressed (Figure 6D) below that for spontaneous turns during exploration (dashed line), down to nearly zero as θin approaches −90°. The extent of P (D) modulation is more modest when the repellent is encountered on the ventral side (θin > 0°); worms make ventral turns more than half of the time even when θin approaches 90° (Figure 6D). The less extensive modulation of the D-V bias for θin > 0° is apparently suboptimal, but we found that it is compensated — at least in part — by adjusting the Ω-δ bias of ventral turns, with P(δ|V) increasing more than 2-fold across the full range of possible incident angles (−90° < θin < 90°) (Figure 6E). Thus, control of escape-turn behavior evidently is achieved through digital, rather than analog logic: what is modulated is not the turn amplitude |Δθ1, but rather the probability of selecting from a discrete repertoire of sharp turn types, each of which has an essentially invariant characteristic amplitude.

But to what end might the worm be executing these discrete decisions? To answer this question, we considered two contrasting performance metrics for the escape behavior (Figure 6F). The first assesses the probability of a successful escape in the reference frame of the environment, where success is defined by the exit angle pointing in the downward direction of the repellent gradient. Specifically, we extract the exit angle with respect to the repellent boundary, θout (Figure 6F, red arrow), and define as the probability that the exit angle is pointing away from the repellent boundary, i.e. = Prob {|θout| > 90°}. The second metric assesses the probability of successful escape in the anatomical reference frame of the moving worm, where success is defined by the worm exiting the escape turn on the side of its body opposite to that of the repellent-boundary encounter (Figure 6F, gold arrows). That is, is defined as the probability of exiting on the dorsal side upon ventral encounter, and exiting on the ventral side upon dorsal encounter. Both and thus reduce escape performance to a single probability defining a binary random variable — whether the worm exits in the favorable direction or not — but the reference frame in which “favorable direction” is defined differs between the two.

The environmental-frame escape probability was found to be significantly favorable compared to the 50–50 odds expected if control is absent ( >0.5), across the full range of encounter angles θin (Figure 6G). However, does decrease for large absolute values of θin. While for θin ≈ 0°, essentially any choice among the three turn types (VΩ, , and DΩ) leads to an escape away from the repellent boundary (because their typical amplitudes 〈|Δθ|〉 are all greater than 90°; Figure 6B), for |θin| ≈ 90° the choice of turn type is important for successful escape in the environmental frame (i.e. to achieve |θout| > 90°). The reduced performance near |θin| ≈ 90° thus indicates a significant fraction of escape trials result in the “wrong” choice among the sharp-turn repertoire — resulting in failed escape — perhaps due to the limited precision at which sensory measurements of the chemical gradient can be made within the short duration (~ 10 s) of the escape response. And perhaps reflecting the underlying bias in sharp-turn selection probabilities (Figure 6B), environment-frame performance as a function of the boundary-encounter angle θin is asymmetric about θin = 0° (Figure 6G), with a higher escape performance when worms encounter the repellent boundary on the dorsal side of their anatomy.

By contrast, the anatomical-frame escape probability was found to be approximately symmetric about θin = 0°, increasing from ≈ 0.5 when encountering the boundary head on (θin ≈ 0°), and increasing to ≈ 0.7. The approximately 50–50 odds of exiting dorsally or ventrally at θin = 0 is consistent with the response being determined by the sensed repellent gradient in the D-V direction upon encountering the boundary (i.e. the gradient magnitude in the direction perpendicular to θin, |∇C⊥| = |∇C| sin θin, where |∇C| is the gradient magnitude), which has zero magnitude at θin = 0°. Furthermore, the shape of the symmetric response profile in (θin) is consistent with a response modulation proportional to |∇C⊥|. Assuming that the response in is some function of that transverse gradient ( = f (|∇C|)), and further that |∇C⊥| is sufficiently small, it is then reasonable to expand f(|∇C⊥|) to linear order in sinθin to obtain f (0) + A sin θin, where f (0) = 0.5 and A is a constant. This function obtains a good fit to the observed profile as a function of θin (Figure 6H, dashed curve) with A ≈ 0.2. Thus, the observed symmetric profile of the anatomical-frame escape probability is compatible with a simple model that makes just two assumptions (i) the worm upon encountering the repellent boundary faces a binary decision: whether to exit the escape turn dorsally or ventrally, and (ii) the probability of making the “correct” decision (i.e. exiting in the D-V direction opposite to that of encounter) is limited by the magnitude of the sensed gradient in the D-V direction upon encountering the boundary at an angle θin.

Discussion

By developing a novel behavioural assay that enables tracking multiple C. elegans individuals over long times (2 h), we quantified the statistics of turning behaviour in both exploration and escape navigation contexts. The data revealed significant biases in both gradual- and sharp-turn behaviors, which impose constraints on exploration and escape performance, respectively. In the context of exploration, quantifying the diversity of motility phenotypes within an isogenic population allowed us to identify the subset of reorientation behaviours that correlate most strongly with exploration performance, from which we derived a minimal model of motile trajectories. Analysis of this model identified a novel optimality principle for maximising exploratory propensity under the constraint of finite gradual-turn bias. Similarly, in the context of escape navigation, studying the statistics of sharp turn directions as a function of the encounter angle with the repellent gradient revealed how worms optimize their behavior despite constraints likely arising from biases in control physiology and from limited information about its orientation with respect to the repellent gradient.

Optimizing exploratory propensity under gradual-turn bias requires nonzero angular diffusivity

Optimality is useful as a guiding concept for studying biological design, given that natural selection tends to drive some performance measures of the system towards a maximum. In the context of behavior, identifying the relevant performance measure being optimised provides a framework to study the design of the underlying control strategies and their physiological implementation. However, identifying these objective functions on which selection acts is often not trivial, as in nature, one can expect selection to be acting simultaneously on multiple such performance criteria that may be in conflict and, as a result, impose constraints on one another. Within our study, we identified as a performance measure for exploration the trajectory persistence length, and found that maximizing this performance under the constraint of finite gradual-turn bias (i.e. trajectory curvature) requires a nonzero rotational diffusivity. A gradual-turn bias resulting from a lack of control of orientation is not unique to the worm, but has been observed across a wide variety of organisms, for navigational tasks in environments that lack sufficient sensory cues for direction. The causal factors leading to such biases are difficult to resolve, and could be manifold. For example, loopy trajectories created by blindfolded humans have been hypothesised to arise from anatomical asymmetries Maus and Seyfarth (2014), an imperfect ‘sense of straight ahead’ Bestaven et al. (2012) and accumulating noise in the sensimotor system Souman et al. (2009). Recent research on Drosophila revealed a persistent crawling preference which is not linked to body asymmetries Ayroles et al. (2015), but suggests a neuronal origin Buchanan et al. (2015). C. elegans can be used as a useful model organism to fundamentally study the (neuronal) origin of such a rotational drift. Our minimal model of exploratory trajectories (Eq. 3) does not address the causal factors leading to such gradual-turn biases, but rather predicts their consequences. In particular, for any given trajectory curvature κ, the model reveals that the maximal exploratory propensity (i.e. persistence length P) will be achieved when the rate of random orientation ε (which in C. elegans is dominated by orientational diffusion) exactly balances the magnitude of κ, and our data indicate that C. elegans trajectories indeed demonstrate, on average, this optimal balance. Thus, although the trajectory curvature induced by the worms’ gradual-turn bias does impair exploratory performance, the latter achieves the greatest value possible under that constraint of finite bias to enhance the spatial extent of exploration.

Interestingly, however, we found considerable variability at the level of individual worms in both gradual-turn bias κ and random reorientation ε, with only a weak correlation between these parameters across individuals (Figure 6D). Thus, although this optimal balance between κ and ε is evidently achieved at the level of the population average, this balance is not tightly controlled at the level of individuals. From a mechanistic point of view, it is in fact interesting that these variations in gradual-turn bias and angular diffusion appear to be nearly independent of one another, given that they are both represent errors and/or fluctuations in the body-wave dynamics driving the worms’ undulatory propulsion. Naively, one might expect a stronger correlation between these, if they were both the product of finite control over the locomotor wave. One compelling hypothesis is that the angular diffusivity due to finite errors in locomotor wave control is in fact considerably lower and that the observed diffusivity is actually dominated by yet another type of reorientation behavior. It has been documented by Kim et al. Kim et al. (2011) that C. elegans trajectories can feature a high frequency of “shallow turns” during runs with reorientation angles much < 90°. In our analysis, reorientations due to such shallow turns would not be detected as sharp turns, but instead contribute to the magnitude of the angular diffusivity. Interestingly, inspection of reorientation statistics between consecutive body waves in our data revealed a broad distribution that could be fitted by the sum of two Gaussians (Figure 5–Figure Supplement 2). Thus, it is conceivable that the broader of these two Gaussians, which contributes the majority of the variance (σ = 28.3° ±0.4°, as compared to σ = 13.5°±0.1° forthe narrower Gaussian), reflects shallowturns. Finally, regardless of the underlying mechanisms, the nearly uncorrelated variation in gradual-turn bias and orientational diffusion leads to large variation in exploratory performance, which may be interpreted as a bet-hedging strategy Slatkin (1974); Philippi and Seger (1989). Exploring new regions of space and exploiting local resources is a well-known trade-off in foraging strategies, and hence expressing a diversity of phenotypes along this exploration-exploitation axis could provide isogenic worm populations with an effective adaptive strategy in rapidly changing and/or information-scarce environments where sensory modulation of behaviour is less effective Xue et al. (2019).

Our minimal model of trajectory statistics combines the effects of sharp turns, orientational diffusion, and gradual-turn bias, and accurately predicts the experimentally observed trajectory persistence lengths. The simplicity of the model offers key insights into how variations in these parameters interdependently affect this measure of exploration performance, and provides a basis for future studies that examine the effect of perturbations such as genetic mutations or neural ablations. Furthermore, its construction is sufficiently general that it can be readily applied to any organism (or motile particle/agent) whose motion can be described by trajectory curvature, effective diffusivity, and intermittent sharp turns, for instance the run-and-tumble motion of swimming bacteria near surfaces that induce curved runs Lauga et al. (2006), or other nematodes such as larvae Ancylostoma tubaeforme Croll (1975a). Our model reveals that any nonzero trajectory curvature sets an upper limit to the persistence length, which in the absence of external guiding cues significantly reduces the exploration performance. Whether and to what extent C. elegans’ gradual-turn bias also impacts the performance in other environments (e.g. during chemotaxis) remains an open question and will provide fertile ground for future studies. During taxis strategies, gradual-turn bias might be expected to reduce, but not abolish, taxis efficiency. The head-bend mutant unc-23 creates spiral-shaped tracks with a stronger curvature compared to worms in this study, but can still perform navigational tasks like chemotaxis Waterston et al. (1980); Ward (1973); Pierce-Shimomura et al. (2005). Of particular interest would be to investigate the relationship between the gradual-turn bias we have observed here in the absence of environmental gradients and the ‘weathervaning’ (klinotaxis) strategy of chemotaxis that has been shown to steer trajectory curvature in response to strong environmental gradients Iino and Yoshida (2009). For example, testing whether the weathervaning response completely overrides the gradual-turn bias, or acts additively could shed light on whether the bias and weathervaning response are controlled by the same neural circuitry.

Context-dependent modulation of sharp-turn statistics symmetrizes escape performance under biasing constraints

The worms’ sharp-turn response to an acute aversive stimulus provides another example of constrained optimization of behavior. We examined escape from a strong chemorepellent (SDS) that worms encountered as a spatial gradient as they approached the arena’s boundary, and assessed escape performance as a function of the angle of encounter with the repellent boundary. By analyzing thousands of such escape-turn events, we found that control of escape direction is achieved by selecting from a discrete repertoire of posturally distinct sharp-turn types (VΩ,,DΩ), rather than continuous modulation of sharp-turn amplitudes.

Although the exact performance measure being optimized by this decision is unknown, it is natural to expect that the goal of the escape response is to reorient the worm’s movement away from the repellent source. We therefore considered as the performance measure the probability Pescape that the escape turn successfully reorients the worm away from the repellent source, defined in two contrasting ways. The first, , defined in the reference frame of the environment, corresponds to the probability that worms exited escape turns in the direction down the repellent gradient. The second, , defined in the reference frame of the worm’s own anatomy, corresponds to the probability that the exit angle of the worm pointed away from the side of the body that faced the repellent boundary upon encounter. Interestingly, was asymmetric with respect to the angle of encounter with the repellent boundary when performance was defined in the reference frame of the environment, whereas was symmetric with respect to the encounter angle.

Asymmetry in the environmental-frame performance might reflect biases in underlying sharp-turn behavior, which in turn could be due to anatomical or physiological constraints. Even when the aversive cue was on the ventral side, dorsal turns were less frequent than ventral turns. Furthermore, dorsal Ω-turns were generally more shallow than ventral Ω-turns and there were no dorsal δ-turns. While this asymmetry between dorsal and ventral turns is largely consistent to that observed in the freely crawling context, it is striking that it persists even in the escape context involving a strongly aversive SDS stimulus. Hence, the asymmetric sharp-turn statistics might indicate a fundamental biasing constraint that renders dorsal turns anatomically or physiologically less favorable.

Despite this strong biasing constraint, however, the repertoire of three turn types (VΨ, , DΩ) is sufficiently rich that, even with an overall preference for ventral turns, it should in principle be possible to achieve the theoretically optimal escape response = 1 at any encounter angle. The lower values of we observed thus suggests that escape performance might be limited by a finite accuracy in perceiving the gradient encounter angle θin. Accurate evaluation of θin would require precise sensory measurements of spatial differences in the SDS concentration within the anatomical reference frame, which could be challenging at the length scale of the worm and within the time scale of an escape response. But even ifwe accept that finite sensory information ultimately limits escape perfmance (such that < 1), how can we explain the observed asymmetry in as a function of the encounter angle θ in. There is no systematic dorsal-ventral asymmetry in the sensory neurons Hilliard et al. (2002) and the chemorepellent constitutes an equal threat irrespective of whether it is encountered on the dorsal or ventral side of the body. While we cannot rule out that individual worms have some dorsal-ventral bias in how they perceive the cue, there is no obvious reason for a perceptual bias across the population of worms we sampled here. We are thus inclined to consider that the anatomical-frame performance measure , with its more symmetric performance profile, may well approximate the objective function being optimized by neural computations in C. elegans. According to this performance measure, successful escape requires only a determination of whether the repellent threat is on the dorsal or ventral side of the worm’s anatomy, and then executing a turn that results in an exit on the opposite side of the body. Basing the escape behavior on this binary decision task (captured by the performance measure) would have the advantage that it does not require a precise determination of the gradient angle, which is a non-trivial task, especially if non-deleterious escape depends on a quick response at low concentration levels of the chemorepellent.

Interestingly, while we observed that the escape response to the SDS chemorepellent used here deployed the full repertoire of sharp-turn types (VΩ,,DΩ), previous studies have found that worms exclusively execute turns of type VΩ during escape Broekmans et al. (2016); Donnelly et al. (2013); Florman and Alkema (2022). We suggest that this difference is likely due to the contrasting aversive stimuli used to trigger escape responses in those studies. Whereas in our study, the escape was triggered by encounter with a spatial gradient of a chemorepellent, in those studies escape was triggered by a laser-induced heat pulse Broekmans et al. (2016) or touch with an eyelash Donnelly et al. (2013); Florman and Alkema (2022). In contrast to stimuli encountered as gradients, the latter more impulsive stimuli likely do not carry directional information, and it is possible that the worm defaults to the “preferred” turn type, namely VΩ, in lieu of any spatial cues that would favor an alternative behavioral decision.

Neural control of reorientation statistics: possible targets for future studies

The control of reorientation statistics (or lack thereof) described in this study, raises the question which neuronal circuitry generates these behavioral patterns. The neuronal signalling network underlying weathervaning-type control of C. elegans trajectory curvature Iino and Yoshida (2009) has yet to be uncovered, but it possibly involves sampling the environment by oscillatory-like headswings required for propulsion Izquierdo and Lockery (2010); Kato et al. (2014), possibly through the SMB neuron associated with head oscillations and gradual turning via interneurons like AIY and AIZ Izquierdo et al. (2015). Killing of the SMB neurons results in large head-swings during forward crawling with high-curvature trajectories Gray et al. (2005), suggesting a possible mode of control for the crawling bias. However, it has to be seen to what extent the set of neurons involved in control during escape and weathervaning responses overlap, given that weathervaning is described at the level of more gradual rather than sharp reorientations Iino and Yoshida (2009) and the SDS sensing ASH neuron directly synapses to the reversal triggering AVA neuron, bypassing much of the chemotaxis circuitry (although ASH is connected to AIA Murayama and Maruyama (2013)).

Some of the neurons reported to affect sharp turn behaviors (that might be involved in control during escape) are RIM, RIV, RIB, and SMD. RIV (and RIB) activity rises at the onset of the turn Wang et al. (2020) and RIV ablated worms lack a ventral bias Gray et al. (2005), suggesting their involvement in modulation of P(D). RIM is a tyraminergic neuron that aides in the hyperpolarization of ventral muscles to execute the ventral Ω-turn Donnelly et al. (2013); Kagawa-Nagamura et al. (2018), and therefore might be related to the δ-turn modulation. Similarly, ablation of the SMD neuron results in sharp turns with smaller reorientation angles Gray et al. (2005) which suggests its involvement in the sharp turn amplitude. The SMDD, and also DVA neurons have been reported to provide proprioceptive feedback (i.e. sensing of the body bending angle) Li et al. (2006); Yeon et al. (2018), and therefore might be involved in the regulation of (sharp) turn direction, enabling angular-dependent control. In addition, asymmetric feedback from such proprioceptive neurons or mechanosensory neurons (worms lacking mechanosensory neurons, PVD and FLP produce circular trajectories Cohen et al. (2012)) might be the cause of a rotational bias. It would be exciting in further studies to examine the effects of perturbing these neurons (via e.g. ablation, genetic mutations, or optogenetic stimulation) on the control of reorientation behaviours we studied here. Finally, our measurement and analysis of escape-turn statistics suggests that a discrete, rather than continuous, decision process might underlie the control of sharp turns during the escape response. Interestingly, a previous study that focused on random search behavior also yieled a discrete state model for motor command units in C. elegans Roberts et al. (2016). Whether such discrete decision processes are implemented by individual neurons, or in the collective activity patterns of multiple neurons (e.g. as neural circuits) would be exciting to explore in future experiments that combine behavioral and neural measurements.

Conclusions

Our results revealed how C. elegans reorientation statistics demonstrate significant biases. In the context of random spatial exploration, the reorientation parameters appear to be tuned to maximise exploratory propensity, under the constraint of finite bias. In the context of escape, worms demonstrated the ability to strongly modulate escape performance symmetrically in both dorsal and ventral directions, despite a strong underlying sharp-turn bias in the ventral direction. Our minimal model hints at a binary control logic of escape behavior and provides a basis for further investigation of the relationship between reorientation behaviors, their mechanistic origins, and their functional consequences.

Methods and Materials

Behavioural experiments

Worms are cultivated on NGM plates containing HB101. A copping ring (a 38mm × 38mm square with rounded corners and a total surface area of 13.8 mm2) soaked in 1% SDS is put on a food-free NGM plate. 8 well fed young adult worms are washed for 15 min in a 1 µL M9 solution and pipetted onto the arena. The motility of the plate is recorded for 2 h with 11.5 Hz using an PointGrey GX-FW-60S6M-C. During the experiment, the average speed of the worms remained mostly constant (Figure 1-Figure Supplement 2).

Tracking of worms

Worm are tracked using custom tracking software written in python. Collisions are resolved semi-automatically, using a combination of the worm lengths, collision duration and direction of motion before and after the collision of each worm. Ambiguous collisions, or collisions involving more than 2 worms are resolved by hand. Automatically resolved collisions are all manually inspected.

Sharp turn extraction

Sharp turns are differentiated from gradual turns by the body posture’s topology. During a sharp turn, the worm folds onto itself creating a doughnut topology. These postures cannot trivially be extracted from the spline of the binarized worm image. Therefore, a customized version of a previously published algorithm by Broekmans et. al. is used to solve sharp turn body postures Broekmans et al. (2016), using the OIST’s Sango cluster parallel computation cluster. A small fraction of turns were not successfully resolved by the algorithm. Unsuccessful turns were identified using the algorithm’s image-comparison metric which provides an error value for each frame in the turn. Turns with an error > 12 for at least 3 consecutive frames were flagged as unsuccessful and not included in the analysis. 10625 out of 12475 sharp turns could be resolved using this method. A manual annotation of a random selection of turns that could not be resolved did not reveal obvious biases towards a certain turn type.

Individual sharp turn events correspond to intervals, in which the worm body continuously forms a doughnut topology (gaps < 1 s are allowed). The sharp turns are associated with large absolute values of the third Eigenworm |A3| Stephens et al. (2008) and we identify the bending peak as the maximum in |A3| for each sharp turn. Finally, we determine the start and end point of each turn as the closest extrema around this peak. If A3 > 0 at the peak, the start and end points are given by the closest minima with A3 < 5. If A3 < 0 at the peak, we identify the closest maxima with A3 > −5.

Distinguishing sharp turn types

We distinguish “spontaneous” turns, which occur uniformly in the whole domain and thus without an apparent stimulus, from escape responses, which predominantly occur close to the repellent SDS boundary. An escape response is defined as a sharp turn following a reversal. A spontaneous turn is occurring without a preceding reversal. Furthermore, we exclude all sharp turns, where a reversal is immediately following the turn. We define a reversal as a backward motion for more than half of the time within an interval of 2 s (i.e. 23 frames). From the 10625 resolved sharp turns, we obtain: 5799 spontaneous turns, 3866 escape turns, and 960 excluded turns (which either are followed by a reversal or where it is undetermined whether there is a reversal). For Figure 6, we focus on the 2943 escape turns close to the boundary (i.e. less than 7mm away).

Ventral annotation

The resolution of the camera did not allow to visually separate dorsal from ventral. However, we find that for each worm δ turns almost exclusively in a consistent direction. We infer this to be the ventral direction.

Testing worm-to-worm variability by Monte-Carlo sampling

To test if the observed variability is not trivially explained by stochasticity, measured worm-to-worm variability in turning behavior is compared with simulations from a stochastic model. In the model all worms are assumed to follow the same stochastic process determined by population average statistics and each turn is independent. The sharp turn rate stochastic process is described by the population average interval distribution (Figure 3–Figure Supplement 1). Drawing from this distribution, using Monte Carlo sampling, a simulated number of sharp turns can be obtained for the duration of each worm in the measurement, resulting in a different distribution of turn frequencies (Figure 3B). Since the simulations are subject to stochasticity as well, the process is repeated 1000 times. The measured distribution was found to consistently posses larger variation compared to the simulated distributions (Figure 3–Figure Supplement 2 A). In the case of worm-to-worm variability in P(D) and P(δ|V), the corresponding stochastic process is a coin flip (i.e. Bernoulli process), using the population average probability. A number of dorsal or δ turns is randomly drawn from a binomial distribution using the population average probability and a number of coin flips specified for each worm by the number of sharp turns in the case of the P (D) and the number of ventral sharp turns in the case of P (δ|V) (Figure 3B,C). Likewise, the resulting distributions were found to be more variable compared to the simulated distribution for a significant fraction of the simulations (Figure S3-Figure Supplement 2 B,C). Variation in sharp turning frequency can be partially attributed to batch effects of worms measured simultaneously on the same plate. However, a larger fraction of the observed variability in both frequency, P(D) and P(δ|V) is of unknown origin and might stem likewise from experiences of the environment as well as from intrinsic stochasticity (Figure S3–Figure Supplement 3).

Extraction of model parameters

To compute the curvature and rotational diffusion, first the unwrapped (accumulative) average worm body orientation in a window of5 s around sharp turn events and worm collisions is excluded. We found that the average body orientation is an accurate proxy of the worm’s body velocity bearing during runs. However, it is well-defined throughout the trajectory, even at low speeds, and thus the accumulative angle does not suffer from artifacts.

The orientation is computed as a function of trajectory length, by evaluating it at equally spaced intervals of 100 µm. The curvature is estimated in windows of 15 min as the average spatial rotation rate. The rotational diffusion DΨ is extracted by fitting the function y = 2DΨx + bx2 to the MSD (evaluated up to 1 mm) of the spatial orientation.

Computing the persistence length

The persistence length is extracted using the MSD of the worm’s centroid position (evaluated at the 100 µm intervals along the trajectory contour). For a diffusive process with (translational) diffusion coefficient Dt in n dimensions, the mean-squared displacement as a function of time t follows the equation MSD = 2nDt1. Assuming a constant speed of diffusive process s = x/t, 2 dimensions, and a definition PDt/s, we obtain that P = MSD/4x. Theoretically, in the diffusive regime a constant can be fitted to MSD/x. Due to confinement this curve decreases when the MSD approaches the size of the arena. Furthermore, MSD/x fluctuates slightly, because trajectories are described by a random process. Therefore, the persistence length is evaluated as the average value where the MSD is linear; in the range where the slope of log MSD vs log x is in between 0.9 and 1.1.

Computing the gradual turn bias decorrelation time τ

The autocorrelation function (ACF) cannot be accurately estimated on a single-worm basis, because the fluctuation time scales of κ is of the same order as the length of the measurement. It can be computed on a population level, assuming that each worm follows the same stochastic process. With this assumption we compute the ACF using the population variance and mean (0) of κ for each worm and average across worms. The resulting curve is fitted to the function 〈ACFκ(t)〉 = e−t/τ using the ‘curve_fit’ function of the scipy python package. To obtain a confidence interval, the process of computing the ACF and fitting τ is repeated 1000× after bootstrapping for worms. The reported error is the standard deviation of bootstrapped values of τ.

Acknowledgements

We thank Laetitia Hebert, and members of the Shimizu and Stephens groups, as well as Dr. Andre Brown and his lab members, for helpful discussions. We are grateful for the help and support provided by the Scientific Computing section of the Research Support Division at OIST.

Appendix 1 Derivation of the model

We consider a simple random walk as a minimal model for C. elegans locomotion. We take three observation about the worm movement into account: (i) Worms move along a curved trajectory, for which we assume a constant average curvature κ [mm−1]. (ii) This run is interrupted by occasional random reorientation events of rate ζ/s [mm−1] with the (constant) movement speed s and the reorientation frequency ζ. (iii) The worm trajectory is subject to rotational diffusion with diffusion coefficient DΨ [mm−1]. We neglect reversals, such that the speed s is always positive.

First, we neglect the rotational diffusion and only consider random orientation events and a curved trajectory. The probability density to turn again after moving a length x since the last turn is

As the worm moves along the perimeter of circle, the Euclidean distance between turns is

We can map this random walk to a wait-and-jump process, where the worm waits for a time t at a position and jumps a distance r. As a consequence, the effective (translational) diffusion coefficient in d = 2 dimensions is

In the following, we will consider the persistence length P = Dt/s:

where x = st with a constant speed s. We can derive the average run length:

The average distance from the origin is

The same result has been derived by Martens et al. in analogy to electrons in a magnetic field Martens et al. (2012).

We can consider two limiting cases. If the worm turns very often such that κε/s and the path is straight between reorientation events, the persistence length decreases with higher turn frequency according to P ∞ 1/ζ. In contrast, for circular trajectory with κζ/s, reorientation events are beneficial to explore a larger area and thus Pζ.

Next, we include rotational diffusion. If the runs have no gradual turning bias (κ = 0), the effective diffusion coefficient on large scales is Cates and Tailleur (2013)

with an effective reorientation frequency in d = 2 dimensions

The rotational diffusion has an analogous effect as abrupt reorientation events on sufficiently large scales. In this spirit, we replace ζ/s by ε in Eq. 10 and obtain

This solution agrees very closely with simulations over a wide range of parameters (Figure 5–Figure Supplement 1). In the case that the sharp turn does not fully randomize the reorientation, but is biased along the direction of motion with α = 1 − 〈cos Δθ), ζ has to be replaced by Taktikos et al. (2013); Locsei (2007).

Worm collisions minimally impact the trajectory dynamics.

(A) The sharp turn frequency is not affected by the collusion events as the total number of sharp turns (summed up over all worms and all times) is approximately the same before and after a collision (t = 0 marks the midpoint between firstand last contact with another worm during a collision). The dip at t = 0 is from the duration of the collision. (B) A collision event has no long-term effects on the speed. Shaded regions show the 95% confidence interval, bootstrapped for collisions.

The average speed across all worms has a small increase during the first 20 min, but remains constant for the remaining duration of the measurement.

The interval distribution of spontaneous turns for (blue) all worms and (black) individuals.

The observed variability across worms is significantly larger compared to random resampling using population averaged statistics.

(A) The standard deviation of (red) the population average turn frequency and (blue) the standard deviation of resampled statistics using the interval distribution (Figure 3–Figure Supplement 1). (B)The standard deviation of the measured dorsal turn probability, weighted by the total number of spontaneous turns, is significantly larger compared from random sampling using a coin-flip model using the population average statistics. (C) The standard deviation of the measured delta turn probability, weighted by the total number of ventral turns, is significantly larger compared from random sampling using a coin-flip model using the population average statistics.

The portion of the variance in the measurements that can be attributed to individual experience (blue) and batch effects (orange).

The remaining part is attributed to the stochastic nature of the process. Individual experience is estimated by sampling either the interval distribution in the case of turn frequency or sampling from a binominal distribution in the case of dorsal-δ-turns, where the probabilities are sampled from pooled data from the same batch. This way, batch effects and stochastic effects are included, while individual effects are removed. The relative change in variance is referred to as the individual contribution. The sampling process is repeated to estimate the uncertainty. To estimate the effect of batches, first the mean of each batch is subtracted and subsequently total variance is estimated (reducing the degrees of freedom by the number of batches). This is compared against the total variance without subtracting batches. 95% confidence intervals are obtained by bootstrapping for batches. The fraction for variance not accounted for can be attributed to variability as a result of the stochastic processes.

The mean-squared displacement of the individual worms (black) and their population average (blue) as function of the trajectory length is ballistic for short lengthscales, then becomes diffusive proportional to the persistence length, and finally saturates due to the confinement of the arena.

Reorientations are nearly decorrelated after a single body wave.

To eliminate the effect of the body wave oscillations, the orientation Ψ was evaluated every body wave at the same body posture, computed from the phase of the first 2 Eigenworms Stephens etal. (2008). ΔΨ is the difference of Ψ after exactly 1 body wave. The distribution flattens at a value slightly greater than 1, due to the rotational bias. Interval distributions show the 95% confidence interval of the mean across all worms.

The analytic solution of the model closely follows simulations.

Simulations are performed with constant speed (s = 0.15 mms−1) and 2 · 106 data points at 2Hz, using the orientational dynamics described in equation (1) and (2). A large space of motility parameters has been simulated that includes that of the measurements. κ and ζ/s have been varied from 0mm−1 to 1 mm−1 in steps of 0.2mm−1. DΨ has been varied from 0.1 mm−1 to 0.9 mm−1 in steps of 0.2 mm−1. Sharp turn are modelled as a complete randomization of the reorientation. The persistence length extracted from the simulated trajectories is practically identical (correlation of 99.8%) to that computed from the model (equation (3)).

The reorientation distribution is well fitted by 2 Gaussians, which may indicate the existence of small reorientations.

The orientation has been evaluated after subsequent body waves during runs at similar body postures (evaluated from the first 2 Eigenworms Stephens et al. (2008)), to ignore the effect of the oscillatory motion. (A) The reorientation angle ΔΨ is well fitted as the sum of 2 Gaussians (orange curve), with a standard deviation of 13.5° ± 0.1° and 28.3° ± 0.4° with mean values of 4.3° ± 0.9° and −2.8° ± 0.3°, respectively (yellow curves). Fits are performed with the lmfit package in python using the Levenberg-Marquardt method. (B) Four exemplary (left) time series and (right) centroid trajectories of potential shallow turns with a reorientation angle > 45°. To compute the curvature rate, the average body angle of the worm is evaluated at equally spaced distances of 20 µm and the derivative is computed using a Savitzky–Golay filter (3rd order with a window size 300 µm).

Escape turns are triggered when the worm approaches the boundary and reorient the worm away from the boundary. The average distance from the boundary is averaged across escape turns.

Worm variability in (A) dorsal and (B) δ preference during the escape response and spontaneous turns is not significantly correlated.