Resolving coiled shapes reveals new reorientation behaviors in C. elegans
 Cited 17
 Views 1,826
 Annotations
Abstract
We exploit the reduced space of C. elegans postures to develop a novel tracking algorithm which captures both simple shapes and also selfoccluding coils, an important, yet unexplored, component of 2D worm behavior. We apply our algorithm to show that visually complex, coiled sequences are a superposition of two simpler patterns: the body wave dynamics and a headcurvature pulse. We demonstrate the precise $\mathrm{\Omega}$turn dynamics of an escape response and uncover a surprising new dichotomy in spontaneous, largeamplitude coils; deep reorientations occur not only through classical $\mathrm{\Omega}$shaped postures but also through larger postural excitations which we label here as $\delta $turns. We find that omega and delta turns occur independently, suggesting a distinct triggering mechanism, and are the serpentine analog of a random leftright step. Finally, we show that omega and delta turns occur with approximately equal rates and adapt to foodfree conditions on a similar timescale, a simple strategy to avoid navigational bias.
https://doi.org/10.7554/eLife.17227.001eLife digest
We all instinctively recognize behavior: it’s what organisms do, whether they are single cells searching for food, or birds singing to mark their territory. If we want to understand behavior, however, we have to be able to characterize such actions as precisely and completely as their underlying molecular and cellular mechanisms.
For the millimetersized roundworm C. elegans, video tracking and analysis has produced a compact characterization of naturally occurring worm postures. Simply put: every body posture of the worm is a different mix of four fundamental postures called ‘eigenworms’. The worm’s snakelike motion is then a series of combinations of these projections, which can be analyzed to provide an automatic and measureable readout of the worm’s behavior.
There is, however, an important caveat: when the worm makes a ‘loop’, and crosses over itself, such posture analysis is inapplicable. That is unfortunate: some of the worm’s most interesting behavior involves looping. One example is the “omega turn”, named after the shape of the Greek letter Ω. This sharp turn is used by the worm to steer away from harm, and more generally to abruptly reorient during the search for food and for mates.
Broekmans et al. have now created an algorithm, based on eigenworms, which can analyze worm images that encompass both looped and normal shapes. The result is a complete ‘behavioral microscope’ that shows how C. elegans moves in 2D. Focusing this microscope in particular on the omega turn, Broekmans et al. found that such turns are not, as has been previously described, a single behavior. Instead, they are two separate behaviors that represent the worm’s equivalent of a leftright step.
Together with previous posture analysis the work presented by Broekmans et al. allows for the full and precise measurement of the body shapes of C. elegans in 2D. This, combined with remarkable recent progress in global brain and gene expression imaging, should help to uncover new mechanisms that ultimately produce and control a worm’s behavior.
https://doi.org/10.7554/eLife.17227.002Introduction
Much of our fascination with the living world, from molecular motors to the dynamics of entire societies, is with emergence — where the whole is surprisingly different than the sum of its parts (see, e.g., [Laughlin, 2014]). Yet, the existence of such collective organization also suggests that living systems, despite their enormous potential complexity, often inhabit only a much smaller region of their potential ‘phase space’, and evidence for this lowerdimensional behavior is ubiquitous. For example, the motor control system produces movements that are far less complex than what the musculoskeletal system allows (d'Avella et al., 2003) and this hints at the presence of an organizational principle. In a typical daily movement like walking, the central nervous system is thought to produce the full walking gait by combining lowlevel ‘locomotory modules’, some of which appear to be universal among species (Dominici et al., 2011). Similarly, the dynamics in brain networks are organized in lowdimensional activity patterns (Tkačik et al., 2014; Gao and Ganguli, 2015) and these patterns — not individual neurons — might be the carriers of information and computation (Hopfield, 1982; Yoon et al., 2013).
The emergent dynamics of behavior, how animals move and interact, is particularly important as the ultimate function of the system (Tinbergen, 1963) and the scale on which evolution naturally applies. Yet, our quantitative understanding of behavior is substantially less advanced than the microscopic processes from which it is produced, even as recent efforts have expanded this frontier (Mirat et al., 2013; Berman et al., 2014; Cavagna and Giardina, 2014). How do we analyze highresolution behavioral dynamics and what does this reveal about an animal’s movement strategy? How do we build effective models on the behavioral level where a ‘bottomup’ approach is daunting? How do we connect analysis on the organismscale to the properties of molecules, cells and circuits? We approach these questions through the postural movements of the nematode C. elegans.
In C. elegans, the 2D space of body postures can be captured precisely and is also lowdimensional (Stephens et al., 2008) so that the worm’s motor behavior is faithfully encoded as a time series of only four ‘eigenworm’ variables. These shape projections are collective coordinates in the space of natural worm postures and provide a notable reduction in complexity. However, an important limitation of previous work is the inability to deduce the geometry of selfoccluding body shapes. Such coiled body postures occur during ‘omega turns’ (a maneuver during which the worm’s body briefly resembles the Greek letter $\mathrm{\Omega}$ [Croll, 1975]) and are a general and important feature of the worm’s behavioral repertoire, ranging from foraging (Stephens et al., 2010; Salvador et al., 2014), and chemotaxis (PierceShimomura et al., 1999), to escape from noxious stimuli (Mohammadi et al., 2013). For example, during escape behaviors worms use coiled shapes to reorient by ${180}^{\circ}$ and the benefit seems obvious: it steers the worm back to safety. But how does a ‘blind’ organism achieve this result without any visual reference to the outside world? While some of the neural and molecular mechanisms driving omega turns have been uncovered (Gray et al., 2005; Donnelly et al., 2013) and there has been previous work on crossed shapes (Huang et al., 2006; Wang et al., 2009; Roussel et al., 2014; Nagy et al., 2015), a quantitative analysis of such selfoccluded posture dynamics is lacking.
Here, we exploit lowdimensionality to develop a novel and conceptually simple posture tracking algorithm able to unravel the worm’s selfoccluding body shapes. We apply our approach to analyze coiled shapes during two important behavioral conditions: the escape response induced by a brief heat shock to the head, and spontaneous turns while foraging on a featureless agar plate. We find that, in general, complex deep turn sequences can be viewed as a simpler superposition of body wave phase dynamics with a bimodal head swing followed by a unimodal curvature pulse. In the escape response we show that, while turning accounts for much of the ~180° reorientation, the full distribution of reorientation angles is shaped by significant contributions from the reversal, turn and postturn behaviors, a result consistent with the presence and action of the monoamine tyramine during the entire response (Donnelly et al., 2013). In natural crawling, the peak amplitudes of the curvature pulse reveal two distinct coiling behaviors — the classical omega turn accomplishing large ventralside reorientations, and a previously uncharacterized ‘delta’ turn which produces dorsal reorientations by overturning through the ventral side. The omega and delta turns occur independently in time, suggesting a separate triggering process, but have similar rates, as expected if they contribute little overall bias in the trajectories.
Results
Tracking posture using lowdimensional worm shapes
Previously, we analyzed movies of C. elegans freely crawling on an agar plate (Figure 1A) (Stephens et al., 2008). For each movie frame, we identified the body of the worm, and applied a thinning algorithm to find the centerline. The worm’s 2D body posture was characterized as a 100dimensional vector of tangent angles along this centerline (Figure 1B–C). Principal Component Analysis revealed that more than 95% of the variance in naturallyoccurring body postures was captured by just four eigenvectors of the posture covariance matrix (Figure 1D). As a result, any worm posture can be decomposed as a linear combination of these ‘eigenworms’ (Figure 1E). Worm behavior then becomes a smooth, lowdimensional trajectory through posture space (Figure 1F). As an example, forward and backward crawling appear as approximately circular trajectories in the $({a}_{1},{a}_{2})$ plane, and correspond to limitcycle attractors. However, for coiled shapes such as shown in Figure 1H, the thinning algorithm does not produce a faithful reconstruction of the worm’s actual posture (Figure 1G).
The above procedure can also be implemented in reverse to generate worm images. For any point $\mathit{\bm{p}}$ in posture space (Figure 1F), we can reconstruct the shape of the backbone (Figure 1G). Knowing the thickness of the worm at each point along the body (which we estimate by averaging over many worm images), we are able to draw a reconstructed body image (Figure 1H; see Materials and methods). We then track the posture by finding, for each movie frame, the point in posture space (and thus the correct centerline) for which the reconstituted worm image is the most similar to the original image. This approach works for all worm postures — in contrast to image thinning, which fails for selfoverlapping shapes (Figure 1H).
Our ‘inverse’ tracking algorithm consists of three basic elements. (i) An image error function ${f}_{\mathrm{err}}$ quantifies how well a reconstituted worm image $\stackrel{~}{\mathbf{\mathbf{W}}}(\mathit{\bm{p}})$ matches the movie frame $\mathbf{\mathbf{W}}$ (Figure 2A); (ii) an efficient optimization scheme to search for a global error minimum over all possible postures, and; (iii) a method to resolve ambiguity, as different selfoccluding body shapes can give rise to the same image. We measure image similarity using two specific shape metrics (Yang et al., 2008): outline shape, and coarsegrained pixel density (Figure 2A). By mapping this error function onto posture space: ${f}_{\mathrm{err}}(\mathit{\bm{p}})={f}_{\mathrm{err}}(\mathbf{\mathbf{W}},\stackrel{~}{\mathbf{\mathbf{W}}}(\mathit{\bm{p}}))$, we create a fitness landscape, in which the position of the global minimum corresponds to the tracking solution. We find this minimum using a pattern search algorithm (a form of direct search [Kolda et al., 2003]). To resolve ambiguity, we retain multiple minima for each frame, until a final step which minimizes total sequence error. We sketch this process for a single mode in Figure 2C.
Tracking reproduces both simple and selfoccluding worm shapes with small errors
Tracking results for a typical movie that includes complex, selfoccluding shapes are shown in Figure 2D (see also Videos 1 and 2). In the gray rows at the top are the original movie frames; the reconstituted images from our inverse algorithm are below. While some minor inaccuracies are visible by eye, the overall result is remarkably similar. To quantify posture tracking accuracy, we first compared the results of our algorithm to image thinning, which allows for verification based on a large dataset. We used image thinning to construct a 100dimensional vector of tangent angles $\mathit{\bm{\theta}}$, defined the tracking 'error' as $\delta \theta =\parallel {\mathit{\bm{\theta}}}_{\mathrm{inv}}{\mathit{\bm{\theta}}}_{\mathrm{thinning}}\parallel $, and we plot the distribution of these errors in Figure 2E (magenta). We also show the discrepancy in $\mathit{\bm{\theta}}$ that results from dimensionality reduction to the postural eigenmodes (black). Additionally, we show Euclidean distances between tangent angle vectors of consecutive frames in a 16 Hz movie, representing limited time resolution (gray). For this dataset of noncrossed frames, our algorithm provides excellent performance, with tracking errors bounded by time resolution and dimensionality reduction. Even for deviations in the tail of the distribution ($\delta \theta =3\mathrm{rad}$), backbones from the thinning and the ‘inverse’ algorithm are quite similar (inset, gray backbones).
A more relevant quantity for lowdimensional trajectories is the mode discrepancy $\delta {a}_{i}=\parallel {a}_{i}^{\mathrm{i}\mathrm{n}\mathrm{v}}{a}_{i}^{\mathrm{t}\mathrm{h}\mathrm{i}\mathrm{n}\mathrm{n}\mathrm{i}\mathrm{n}\mathrm{g}}\parallel$ which is negligible for simple shapes, as shown in Figure 2F (yellow). Finally, we created a dataset of selfoverlapping body shapes for which backbones were manually drawn. In Figure 2F (blue), we show that, for the majority of crossed frames, the mode error is less than 10% of the total range of naturally occurring mode values. As a visual reference, the reconstituted worm shapes corresponding to mode errors of $\delta {a}_{i}=1$ are shown in gray: these are noticeably flat.
Coiled dynamics in the escape response reveal precise reorientations and the superposition of the body wave and a headcurvature pulse
We first applied our postural tracking algorithm to quantify the full shape dynamics of the C. elegans ‘escape response’. This is a stereotyped behavioral sequence, consisting of a pause, a reversal and an $\mathrm{\Omega}$turn, that quickly moves the worm away from a threatening stimulus. Featuring only relatively simple coiled shapes, the escape response provided a useful test of our algorithm. While recent work has connected the escape response with genetic, molecular, and neural mechanisms (Donnelly et al., 2013), the behavior itself has been described only qualitatively. Here, we elicited an escape response by using an infrared laser pulse administered to the head of the worm, which raised the temperature by ~0.5°C. 10 s of prestimulus behavior and 20 s of poststimulus behavior were recorded at $20\mathrm{Hz}$. Each worm was only assayed once, to prevent adaptation. In total, $N=92$ worms were recorded, of which $N=91$ successful trackings were used in the final analysis.
A schematic of the response is shown in Figure 3A, with the associated postural mode dynamics in Figure 3B,C. During normal, forward locomotion (i in Figure 3A, $t<10\mathrm{s}$ in Figure 3C), the worm crawls by propagating a sinelike wave through its body. This is reflected as a pair of phaselocked sinusoidal oscillations in ${a}_{1}$ and ${a}_{2}$ and we define the body wave phase angle $\phi =\mathrm{arctan}({a}_{2}/{a}_{1})$, where the minus sign ensures that $d\phi /dt$ is positive during forward crawling. When the worm is stimulated by the infrared pulse (ii in Figure 3A, pink line in Figure 3C at t = 10 s), it immediately backs up (iii), seen as a decrease in $\phi $. The end of this reversal and the beginning of the $\mathrm{\Omega}$turn is marked by a headswing, visible as a bimodal pulse in ${a}_{4}$. The $\mathrm{\Omega}$turn itself (iv) occurs as a large, unimodal pulse in ${a}_{3}$, and propagates headtotail. This implies another switch of the direction of the body wave, and hence a return to increasing $\phi $. Finally, as the turn is finished, the worm resumes forward crawling (v). The mode dynamics outlined above illustrate that the complexity of the escape sequence can be seen as a superposition of two simpler patterns: the body wave phase dynamics in $({a}_{1},{a}_{2})$, and the headcurvature dynamics of $({a}_{3},{a}_{4})$. An animation of these mode dynamics is available as Video 3.
A notable feature of the escape response is how closely the worm controls its reorientation. Our tracking algorithm also makes it possible to track the overall orientation continuously, across the different phases of the escape response. In Figure 3D–E, we calculate how much each of the three response segments reorients the worm. The distribution of reorientations for the full escape response is largely similar to the distribution during the omega turn, but includes contributions from the reversal and postturn segments. In the trialaveraged reorientation Figure 3E, we find $\u27e8\mathrm{\Delta}\theta \u27e9=0.89\pi \pm 0.05\pi \mathrm{rad}$ for the full response. The omega turn itself results in $\u27e8\mathrm{\Delta}\theta \u27e9=0.90\pi \pm 0.04\pi \mathrm{rad}$, while pre and postomega phases show smaller but significant contributions, $\u27e8\mathrm{\Delta}\theta \u27e9=0.13\pi \pm 0.03\pi \mathrm{rad}$ and $\u27e8\mathrm{\Delta}\theta \u27e9=0.12\pi \pm 0.03\pi \mathrm{rad}$, respectively (errors are calculated using bootstrap across trials and are equivalent to standard errors of the mean). In Figure 3D, the interval $(0,\pi )$ corresponds to a final ventralside reorientation, and $(\pi ,2\pi )$ to a final dorsalside reorientation. The small number of reorientations between $(0,\pi )$ are also final dorsalside reorientations but are achieved using a shallow dorsal bend, not an omega turn, and excluding these worms results in a total mean reorientation angle $\u27e8\mathrm{\Delta}\theta \u27e9=0.97\pi \pm 0.04\pi \mathrm{rad}$.
Remarkably, the mean reorientation in the reversal and postturn segments precisely cancel, suggesting a correction mechanism at the level of the average response so that the mean overall reorientation is entirely determined by the omegaturn. No such precision is apparent in the variance, where we find $\delta {\theta}^{2}=0.69\pi \pm 0.16\pi {\mathrm{rad}}^{2}$ for the full response compared to the smaller $\delta {\theta}^{2}=0.45\pi \pm 0.16\pi {\mathrm{rad}}^{2}$ for the turn segment. Thus, while the omega turn is an effective maneuver for turning away from the stimulus, the full response orientation change is broadened by the reversal $\delta {\theta}^{2}=0.23\pi \pm 0.05\pi {\mathrm{rad}}^{2}$ and postomega $\delta {\theta}^{2}=0.19\pi \pm 0.04\pi {\mathrm{rad}}^{2}$ behaviors.
These observations allow us to hypothesize a subtle link between the behavior of the worm and the escape response at the neurotransmitter level (Donnelly et al., 2013). As the worm enters the reversal phase, release of tyramine sets up an asymmetry in the worm’s body, and this appears as a baseline shift in the fluctuations of the third mode (see also Figure 3—figure supplement 1) leading to a positive bias in the reorientation, Figure 3D,E (reversal). After the turn, lingering effects of the tyramine produce a similar baseline shift, but as the worm is moving forward instead of backward, this now leads to an opposite orientation bias, Figure 3D,E (postomega).
Coiled dynamics in foraging reveal a surprising dichotomy in largeamplitude turns
To analyze more complex coiled shapes, we applied our posture algorithm to foraging worm behavior on a flat agar plate. Under these conditions, worms navigate using a combination of maneuvers (Gray et al., 2005), including short and long reversals, pirouettes and also gradual turns (Iino and Yoshida, 2009). We are particularly interested in the pirouettes, as they involve deep coils. Such body bends are primarily encoded in the third postural eigenmode (${a}_{3}$) and, as discussed in the previous section, peaks in ${a}_{3}$ are a characteristic feature of omega turns, and have a known role in reorientation of the worm (Stephens et al., 2010).
In Figure 4A, we show the full distribution of postural mode ${a}_{3}$ for all local extrema. Note that the modes have been normalized so that negative ${a}_{3}$ amplitudes correspond to dorsal turns; ventral turns have strictly positive amplitudes. A clear asymmetry can be observed so that on top of a symmetric background distribution of shallow turns in both directions, we see, on the ventral side, two distinct additional peaks. Drawing reconstituted worm images for the center values of these two peaks, it is clear that the peak at ${a}_{3}\sim 15$ corresponds to a ‘classic’ $\mathrm{\Omega}$ shape. The second peak, at ${a}_{3}\sim 23$, shows a body shape with a much higher characteristic curvature. In Figure 4A (right), we have ‘folded’ the dorsal side of the distribution over the ventral side, highlighting the ventral asymmetry at high ${a}_{3}$ amplitudes. As noted in the figure, we refer to turns in the loweramplitude peak as omega turns and distinguish these from the higheramplitude delta ($\delta $) turns in the second peak. As for the omega turn, the name delta turn is chosen to reflect the $\delta $like shape of the worm during a typical sequence.
Returning to the original tracking movies, the presence of these two classes of turns is clearly visible. In Figure 4B, we display movie stills for two example turns: one omega turn, and one delta turn. During the classical omega turn, the worm slides its head along its body, similar to the escape response, ending up with a large, primarily ventral reorientation. A delta turn, on the other hand, is much deeper: the worm completely crosses its head over its body, resulting in a dorsal reorientation by ‘overturning’ across the ventral side.
Delta and omega turns are the serpentine analog of a leftright step and occur independently in a navigational strategy
In postural dynamics, $\delta $ and $\mathrm{\Omega}$turns differ primarily in their ${a}_{3}$ pulse amplitude; their turn kinematics are otherwise very similar (Figure 4—figure supplement 1). However, when turns do occur, they result in a dramatically different change of overall orientation. As in the escape response, we use our algorithm to track the worm’s overall body reorientation, and in Figure 4C, we show how the worm reorients using both omega (orange) and delta (blue) turns. Simply put, omega turns reorient the worm by large, ventral angles, while delta turns reorient the worm dorsally by ‘overturning’ through the ventral side. The difference in reorientation angle may provide a hint as to why these two behaviors exist. Earlier, we saw that the neural mechanisms that produce the escaperesponse omega turn, are fundamentally asymmetric, producing only ventral turns (through disinhibition of the VD motor neurons) (Donnelly et al., 2013). If the worm uses the same neural infrastructure during free crawling, this would only ever allow it to reorient itself towards its ventral side. Lacking a dorsal ‘copy’ of the same neural infrastructure, the worm could instead hyperactivate the existing infrastructure to produce ventral ‘overturning’. These ‘overturns’ are what we call delta turns, and enable the worm to also reorient towards its dorsal side. We also find that delta and omega turns occur seemingly independently; the mutual information between timebinned, timeshifted series for both turning event time series has a maximum of less than a few percent (see Materials and methods and Figure 4—figure supplements 2 and 3). On the other hand, evidence that the turns can be jointly controlled is shown in Figure 4D. Here, we plot the frequency of turning events over the course of the experiment. As the worm searches for food in a larger area, the turn frequency decreases significantly — a wellknown phenomenon (Gray et al., 2005; de Bono and Villu Maricq, 2005; Srivastava et al., 2009) — and both omega and delta turns show similar frequencies and adaptation.
Discussion
The ability to track selfoverlapping shapes of C. elegans together with the eigenworm projection of postures, provides a complete and quantitative accounting of the worm’s locomotory behavior in 2D. Among living systems with a nervous system, such an exact behavioral description is unique, and is likely to be especially important as new techniques emerge for the simultaneous imaging of a substantial fraction of the worm’s neurons during free behavior (Nguyen et al., 2016; Venkatachalam et al., 2016). Our posture tracking algorithm itself is conceptually simple and relies on an optimized image search within the lowdimensional space of worm shapes. Indeed, while the identification of lowdimensionality occupies an important role in quantitative approaches to living systems (see e.g. Machta et al., 2013; Daniels and Nemenman, 2015; Ganguli and Sompolinsky, 2012), here we have leveraged lowdimensionality to elucidate important and previously unknown aspects of C. elegans coils. Interestingly, we were able to apply the characterization of body postures developed previously for non–selfoverlapping body shapes (Stephens et al., 2008), to capture shapes that do selfoverlap; even the simpler eigenworm space allows for substantial postural diversity.
We applied our tracking algorithm to two important behaviors: an evoked escape response; and the deep, spontaneous turns that occur during foraging. Viewing the coiled turn as a trajectory through the lowdimensional posture space, a simple model emerges: a superposition of the body wave (a circular trajectory in posture space corresponding to simple forward and backward crawling), and coupled pulses along the third and fourth mode (corresponding to the deep coil and a preceding head oscillation). This model is consistent with the molecular mechanisms found to orchestrate the escape response (Donnelly et al., 2013). Our results also hint at a possible answer as to how reorientations of 180° are accomplished: the worm could use its own body as a ‘guide’ for reorientation. During the omega turn, the distribution of ${a}_{3}$ peak amplitudes (Figure 3D [Omega turn, inset]) lies close to a value of 15: the lowest ${a}_{3}$ value that generates a selftouching body shape. This suggests that the worm might have evolved to coil until it just intersects its own body, which it then slides along to find its way back.
While the omega turn has previously been considered as a single class of C. elegans behavior, our analysis of the amplitudes of the curvature mode ${a}_{3}$ pulses associated with deep coils, reveals the presence of distinct subpopulations. In foraging, we show that ‘classic’ omega turns, featuring the signature $\mathrm{\Omega}$ body shape, primarily reorient the worm to the ventral side, while delta turns reorient the worm dorsally by overturning through the ventral side. These deep dorsal and ventral reorientations occur independently in time with approximately equal rates, which is important if there is to be no overall bias in the trajectories. On the other hand, in an evoked escape response, we observed only $\mathrm{\Omega}$type turns with reorientations of ∼180°.
While distinct in visual appearance, omega and delta turns differ only in the amplitude of the curvature mode, and we have shown that these behaviors are discretely separable during foraging. Interestingly, the neuronal basis for omega bend initiation and execution has been studied in some detail (Gray et al., 2005), where in particular the SMD and RIV motor neurons are, respectively, implicated in the amplitude and the ventral bias of the turn. Coiling is also observed in other contexts, including a variety of mutants (Yemini et al., 2013; Nagy et al., 2015), and we expect that our methods will be useful in further analyzing such shapes, and as a guide for uncovering coiling behavior.
Deep turns and reorientations form an important component of the taxis strategy of C. elegans (Croll, 1976; PierceShimomura et al., 1999; Gray et al., 2005; Stephens et al., 2010; Salvador et al., 2014). Under foraging and chemotaxis conditions, these behaviors are seemingly stochastic (Srivastava et al., 2009; Gallagher et al., 2013), producing a broad distribution of reorientation angles analogous to tumbling in the bacteria E. coli (Berg and Brown, 1972). However, unlike bacterial tumbling (which occurs through an instantaneous switch in the rotation direction of a molecular motor and the resulting unbundling of the flagellar tail, see, e.g., Berg, 2006) the worm’s reorientation is driven by a long, controlled sequence of stereotyped postural changes. Thus, an important question is how the worm effectively randomizes its direction of motion. We have shown here that half the variability in C. elegans foraging reorientations is due simply to the initial random choice of delta or omega turns. However, even the level of stochasticity can be modulated, as evidenced by the largely deterministic reorientation in the escape response, differing response variability depending on the strength of a thermal stimulus (Mohammadi et al., 2013), and the slow adaptation of the reversal rate (Gray et al., 2005; Stephens et al., 2011). Overall, such a combination of behaviors, flexible and stochastic combined with patterned and deterministic, is likely to be observed even in more complex organisms, including humans. In initiating the detailed analysis of C. elegans turning behavior, we hope that our work offers a first step towards a general understanding of these processes.
Materials and methods
Data
We used two datasets encompassing both foraging and escape response behavioral conditions (Broekmans et al., 2016a). The foraging data were explored previously (Stephens et al., 2011); for more details on data collection, see also (Stephens et al., 2008). In short, young L4stage C. elegans N2strain worms were imaged with a video tracking microscope at $f=32\mathrm{Hz}$. Worms were grown at 20°C under standard conditions (Sulston and Brenner, 1974). Before imaging, worms were removed from bacteriastrewn agar plates using a platinum worm pick, and rinsed from E. coli by letting them swim for 1 min in NGM buffer. They were then transferred to an assay plate (9cm Petri dish) that contained a copper ring (5.1 cm inner diameter) pressed into the agar surface, preventing the worm from reaching the side of the plate. Recording started approximately 5 min. after the transfer, and lasted for 2100 s (35 min). In total, data from N = 12 worms was recorded. The second dataset, the ‘escape response’ condition, was recorded following procedures as described in ref. (Mohammadi et al., 2013). In short, worm recordings took place in a temperaturecontrolled room (22.5°C ± 1°C). A 100 ms, 75mA infrared laser pulse from a diode laser (λ = 1440 nm) was administered to the head of the worm, raising the temperature in a FWHMradius of 220 m by ∼0.5°C. 10 s of prestimulus behavior and 20 s of poststimulus behavior were recorded at a frame rate of 20 Hz. Each worm was only assayed once, to prevent adaptation. In total, N = 92 worms were recorded, of which N = 91 successful trackings were used in the final analysis.
Image processing and shape reconstruction
Request a detailed protocolAll movie frames were converted to binary images and cropped, using standard image processing functions in MATLAB (R2014b, The Mathworks, Natick, MA) (Stephens et al., 2008). For faster processing, before analysis with the inverse tracking algorithm, the foraging data was downsampled to 16 Hz by dropping every second frame. To reconstitute an image of a worm with a body posture $\mathit{\bm{p}}=({a}_{1},\mathrm{\dots},{a}_{5})$, we first calculated the vector of backbone tangent angles from $\mathbf{\mathbf{\theta}}={\sum}_{i}{p}_{i}{\widehat{\mathit{\bm{e}}}}_{i}$, with ${\widehat{\mathit{\bm{e}}}}_{i}$ the $i$’th eigenworm. Knowing the total arc length $l$ of the worm, we could calculate the position of each of the 100 points along the backbone. At each backbone point $j$, we then drew a filled circle with radius ${r}_{j}$ to capture the worm’s body thickness (see also Figure 1G,H) and thus create the worm image. Circle radii ${r}_{j}$ for a particular worm were computed from movies of uncrossed worm postures for that specific worm. In each such frame, after finding the centerline (backbone) and outline of the worm (Stephens et al., 2008), we could find ${r}_{j}$ as the minimum distance between backbone point and outline. This was averaged across all frames. Similarly, the total arc length $l$ of the worm was computed by averaging across frames. For the error function described below, the overall orientation of the worm in the image is important, and we generate images of worms in all possible orientations by adding an overall orientation value $\u27e8\theta \u27e9\in [0,2\pi )$ to the backbone tangent angle vector. This gives us a full backbone vector ${\mathbf{\mathbf{\theta}}}_{\mathrm{F}}=\u27e8\theta \u27e9+{\sum}_{i=1}^{5}{a}_{i}\widehat{{\mathit{\bm{e}}}_{\mathit{\bm{i}}}}$. For the postural dynamics, the eigenworm shape projections were taken from Stephens et al. (2008). Recomputing the eigenworms on the fullytracked data here showed only minor changes (see Figure 2—figure supplement 1).
Image error function and inverse algorithm
Request a detailed protocolThe shape error function compares two binary worm images ${\mathbf{\mathbf{W}}}_{1}$ and ${\mathbf{\mathbf{W}}}_{2}$, and is computed as ${f}_{\mathrm{err}}={f}_{\mathrm{outline}}\cdot {f}_{\mathrm{pixel}}$. For ${f}_{\mathrm{outline}}$, we calculate a set of tangent angles $\psi $ to the perimeter of the worm shape (Figure 2A, bottom left). We find the 4connected outline of the worm in the binary image ${\mathbf{\mathbf{W}}}_{i}$, fit a spline through these points, and discretize it into 201 segments sampled at equal arc length. The 200 resulting angles between the segments form a vector ${\mathit{\bm{\psi}}}_{i}=({\psi}_{i,1},{\psi}_{i,2},\mathrm{\dots},{\psi}_{i,200})$; the total length of the segments is ${\mathrm{\ell}}_{i}$. $f}_{outline$ is now $f}_{\mathrm{o}\mathrm{u}\mathrm{t}\mathrm{l}\mathrm{i}\mathrm{n}\mathrm{e}}={C}_{0}{{\mathit{\psi}}_{1}{\mathit{\psi}}_{2}}^{2}+{C}_{1}{({\ell}_{1}{\ell}_{2})}^{2$, for arbitrary constants ${C}_{0}$ and ${C}_{1}$. Note that the value of ${f}_{\mathrm{outline}}$ is sensitive to the choice of starting points for tracing the 4connected outline in each image; this is resolved by choosing the pair of starting points that minimizes ${f}_{\mathrm{outline}}$. For ${f}_{\mathrm{pixel}}$, we first align the images ${\mathbf{\mathbf{W}}}_{1}$ and ${\mathbf{\mathbf{W}}}_{2}$ so that their centroids overlap. Each image is then divided into a grid of 10x10pixel ‘blocks’ (Figure 2A, bottom right). For each block $(j,k)$ ($j=1,\mathrm{\dots},n$; ) in image ${\mathbf{\mathbf{W}}}_{i}$, the fraction ${d}_{i}(j,k)$ of black pixels in the block is calculated. This coarsegraining into blocks allows for, e.g., minor inaccuracies in the generation of worm images from mode values, without affecting the error function. We then calculate ${f}_{\mathrm{pixel}}$ as ${f}_{\mathrm{pixel}}=\frac{1}{nm}{\sum}_{j,k}{\left({d}_{1}(j,k){d}_{2}(j,k)\right)}^{2}$. In earlier trials, we found that using five postural eigenmodes gave us significantly better tracking results than only using four. Since our error function is sensitive to the overall rotation of the worm, we amended the fivedimensional posture space with an extra dimension for the overall orientation $\u27e8\theta \u27e9$. This means that the search space for our algorithm is sixdimensional, with 5 postural dimensions, and 1 rotational dimension. To find a tracking solution for a frame, we ran hundreds of pattern searches (using MATLAB’s ‘patternsearch’ function) from randomly distributed starting points in search space, with the error function described above as objective function. Only solutions with an error value less than $1.0$, a threshold value obtained through trialanderror, were kept. Solutions within a given hypercube of dimensions $[3.0,3.0,3.0,3.0,2.5]$ were merged, leaving only the solution with the lowest error value. This finally resulted in zero, one, or more potential tracking solutions per movie frame. To speed up the optimization, we applied two additional constraints. Firstly, we bounded the absolute value of the eigenmodes to $(18,18,34,12,6)$, for each of the five modes respectively. We verified that the distributions of eigenvalues ${a}_{i}$ found in our tracking data tailed off before reaching these limits. Secondly, we set a limit to the maximum local curvature of the worm’s backbone, so that elements in the resulting theta vector that are 10 indices apart must not be different by more than 1.95 rad. This limit rules out body shapes that were unnaturally coiled.
Importantly, we note that our inverse problem is fundamentally illposed: multiple body postures may produce the same twodimensional worm image (e.g., Figure 2B, bottom) and for each movie frame $j=1,\mathrm{\dots},N$, we generally find multiple potential solutions which we label $\{{\mathit{\bm{p}}}_{j}^{k}\}$, with $k=1,\mathrm{\dots},{M}_{j}$. Even for simple, noncrossed postures, there can be two solutions (${M}_{j}=2$), corresponding to the swapped locations of the head and tail. Across the movie, we label the indices of the correct solutions as a vector $\mathit{\bm{b}}=({b}_{1},\mathrm{\dots},{b}_{N})$. We explicitly allow ${b}_{j}=0$ in case the optimization process fails, and use a cubic spline to interpolate across any such gaps. Let us call the point in posture space for movie frame $j$, resulting from this interpolation step, ${\stackrel{~}{\mathit{\bm{p}}}}_{j}(\mathit{\bm{b}})$. To find ${\mathit{\bm{b}}}^{*}$ for the full, correct tracking solution of the movie, we seek the solution vector that minimizes the total sequence error $E(\mathit{b})={\sum}_{j=1}^{N}{f}_{\mathrm{e}\mathrm{r}\mathrm{r}}[{\mathbf{W}}_{j},\stackrel{~}{\mathbf{W}}({\stackrel{~}{\mathit{p}}}_{j}(\mathit{b}))]$. We constrain the mode changes between two successive frames to be below ${\mathit{\bm{v}}}_{\mathrm{max}}$, which simply reflects the fact that the worm can only change posture continuously.
Tracking pipeline
Request a detailed protocolIn a first pass of the data, the ‘classic’ worm tracking algorithm based on image thinning was used on all frames (Stephens et al., 2008). This fast algorithm yields highaccuracy tracking results for frames with simple, non–selfoverlapping body shapes. It also automatically labels crossed frames. For the foraging dataset, the data were cut into smaller segments to allow for faster parallel processing. Each segment consisted of a series of noncrossed frames, followed by a series of crossed frames, followed by more noncrossed frames. This effectively segmented the data by deep turns (936 segments in total for the 12 worm trajectories). For the escape response dataset, such segmentation was not necessary, due to the smaller size of the data for each worm. Frames that were labeled by the ‘classic’ algorithm as ‘crossed’ were tracked using the inverse algorithm described above. The result was an interpolated, smooth trajectory through posture space. When using this pipeline asis, the algorithm would occasionally swap the locations of head and tail between frames. To resolve head/tail orientation correctly throughout a segment, we implemented four steps. (1) During the filtering and interpolation step, we allowed the algorithm to pick, for each noncrossed frame, not just the solution given by the ‘classic’ algorithm; it could also pick an alternative version in which head and tail were swapped (this version can be trivially computed). (2) We explicitly included a limit for the maximum change of overall orientation $\u27e8\theta \u27e9$ between frames of $\sim \pi $ rad per second in the maximum velocity vector ${\mathit{\bm{v}}}_{\mathrm{max}}$. Any head/tail swaps between frames violate such a maximum change of $\u27e8\theta \u27e9$. (3) After the filtering and interpolation step had produced a full tracking solution, we computed the error for both that tracking solution, as well as a version in which the head and tail were swapped for all frames in the segment. This fixed the overall head/tail orientation for the full segment. (4) As a final check, we manually verified and, if necessary, corrected head/tail orientations during postprocessing. A minimal working set of our tracking code, plus a sample movie that can be successfully tracked using the code’s default parameters is available on Figshare as detailed in the author response (code: https://figshare.com/s/3ac08fbfec9ae3d5a531, movie: https://figshare.com/s/658dd86e3847d5926257). A minimal working set of our tracking code, plus a sample movie that can be successfully tracked using the code’s default parameters is available on Figshare (Broekmans et al., 2016b; Broekmans et al., 2016c).
Tracking quality
Request a detailed protocolIn total, 92 escape responses and $936$ freecrawling segments (each containing one selfoverlapping turn; see above) were analyzed. The escape response tracking results were inspected manually, and 91 trackings (99%) were considered successful, as they were visually close to the appearance of the original worm. For the free crawling dataset, instead, after inspection of a representative sample of 236 segments across multiple worms, 96% were estimated to be successful. First, we assessed the quality of our tracking algorithm for noncrossed worm shapes (Figure 2E). We used both the ‘classic’ algorithm and the ‘inverse’ algorithm to track N = 15433 noncrossed frames from the foraging dataset. For each frame, we calculated the Euclidean distance between the two resulting $\mathit{\bm{\theta}}$ vectors giving the ‘inv. tracking’ distribution. In the same figure, the ‘dim. reduct.’ distribution was calculated from Euclidean distances between the full $\mathit{\bm{\theta}}$ vector from the classic algorithm, and $\mathit{\theta}}_{\mathrm{r}\mathrm{e}\mathrm{d}\mathrm{u}\mathrm{c}\mathrm{t}}=\sum _{i=1}^{5}{a}_{i}{\hat{\mathit{e}}}_{i$, where ${\widehat{\mathit{\bm{e}}}}_{i}$ are the eigenworms from (Stephens et al., 2008) (see also Figure 2—figure supplement 1). This represents the information lost in only using the first five postural eigenmodes. The ‘time res.’ distribution represents the Euclidean distance between $\mathit{\bm{\theta}}$ vectors from consecutive frames in a movie. In Figure 2F, we additionally collected a dataset of four movies, featuring visually distinct types of omega turns. For the $N=348$ crossed frames in these four movies, backbones were handdrawn on the worm images, independently from the tracking results. We compared these backbones to the final results of our inverse tracking / filtering and interpolation algorithms. The resulting mode errors $\delta {a}_{i}$ are plotted as the blue/dark distributions. We also include the mode errors for the set of 15433 noncrossed frames (yellow).
Definition of largeamplitude turns
Request a detailed protocolFor the escape response data, the largest peak in ${a}_{3}$ between t = 10 s (the time of the stimulus) and t = 29 s was identified as the apex of the omega turn. To locate the end of the omega turn, the first zero of ${a}_{4}$ after the apex was found; any point after that root that had ${a}_{3}<3$ was considered to be the end of the omega turn. This ensured that the negative peak in ${a}_{4}$, representing a highcurvature state of the tail at the end of the omega turn, had finished, and that the worm had reached a relatively ‘straight’ shape. For such straight shapes, the overall orientation $\u27e8\theta \u27e9$ has a straightforward, intuitive interpretation. The same criterion was used, in the opposite direction, to find the start of the omega turn. If no starting point and/or end point of the omega turn could be found, the recording was excluded from the analysis. (In the escape response dataset, this was the case for 15 out of 91 recordings). We used the same criterion to find both omega and delta turns in the foraging condition. For detection of local extrema in ${a}_{3}$, a standard peakfinding algorithm was used to detect both minima and maxima (based on the MATLAB ‘findpeaks’ function, which defines a peak as a data point with a greater value than its immediate neighbors). Only extrema with a minimum prominence of 0.5 were kept, resulting in 1187 largeamplitude ${a}_{3}\ge 10$ peaks throughout the entire foraging dataset. Some ${a}_{3}$ peaks featured smaller subpeaks in their shoulders; such subpeaks were discarded.
Orientation
Request a detailed protocolOrientation changes were computed by comparing the overall orientation $\u27e8\theta \u27e9$ between two reference points around each omega or delta turn. The apex of each deep turn was the largest ${a}_{3}$ peak identified previously. The first reference point was the last frame before the turn’s apex that featured a ‘straight’ body shape — i.e., a body shape with a low maximum local curvature. Only for such relatively ‘flat’ worm shapes does the overall orientation $\u27e8\theta \u27e9$ correspond directly to the intuitive orientation assigned to the worm. Similarly, the second reference point was the first frame after the turn’s apex with such a straight body shape. Importantly, our postural tracking algorithm allows us to continuously follow the orientation angle through coiled shapes and this is important for identifying the ‘overturning’ reorientation effects of delta turns. For the analysis of the worm’s reorientation during the escape response (Figure 3D,E), N = 91 escape responses were analyzed. Each 30second recording was segmented by first finding the omega turn. After identification of the omega turn, the reversal phase was simply defined as the first frame after the stimulus with a negative body wave phase velocity $d\phi /dt$, up until the start of the omega turn. The ‘postomega’ phase was any data after the end of the omega turn until the end of the recording at t = 30 s. For reorientation during foraging, we analyzed the angle change for segments with selfoverlapping turns.
Mutual information between omega and deltaturn event time series
Request a detailed protocolTo calculate the mutual information between the omega and delta turns during foraging, we created a binary event time series by first identifying the time of the ${a}_{3}$ peak and then binning these times into bins of width 2, 4, 10, or 20 s. We then calculated the mutual information between these binary time series as in ref. (Strong et al., 1998). The mutual information was calculated for different relative shifts, ranging from −60 to +60 s and the results are shown in Figure 4—figure supplement 2. Mutual information across time shifts never exceeded ∼3% of the maximum entropy of each time series, indicating that these turns occur independently. There is also no apparent spatial correlation (see Figure 4—figure supplement 3).
Omega and delta turn frequency adaptation
Request a detailed protocolIn Figure 4D, we show how the average turn frequencies for omega and delta turns change over the course of the 35 min foraging experiments. Turns were detected by using the peak detection algorithm outlined above, applying the amplitude boundaries ${a}_{3}\ge 10$. The total of these extrema consists of three populations: the tail of a dorsal/ventral symmetric distribution of shallower turns, and two types of ventral deep turns, the delta and omega turns. To find the number of omega turns, we counted the number of ${a}_{3}$ peaks with an amplitude between −20 and −10 in each time window, and subtracted this from the total number of ${a}_{3}$ peaks with an amplitude between +10 and +20. We then computed the average number of omega turns per unit time, across the 12 experiments, in a 10minute sliding window, shifted across the data in 5minute steps. The first 200 s of each experiment were discarded. An identical procedure with ${a}_{3}>20$ gives the number of delta turns. Over the foraging time analyzed in Figure 4D, we find $274\pm 64$ omega turns and $305\pm 35$ delta turns, where the errors denote bootstrap errors produced by resampling the N = 12 different worm recordings with replacement. The equality of turn counts, within error bars, signals an approximate overall balance in turn events, in agreement with the rate calculations. The total turn rate in Figure 4D is comparable to previous work (e.g., Gray et al., 2005), though there are notable differences in turn definitions and experimental conditions. We also note, however, that there are spatiotemporal fluctuations in the turn counts, with an increased number of both turns, as well as a specific bias towards omega turns near the location of the copper ring, likely reflecting an increased rate of ringinduced escape responses. In addition, we find an earlytime bias towards delta turns, during which we believe that the behavior is strongly influenced by the mechanical perturbation of picking. In future work, it will be fruitful to examine these spatiotemporal patterns in a larger experimental arena and with increased turn statistics.
References

1
Marvels of bacterial behaviorProceedings of the American Philosophical Society 150:428–442.
 2

3
Mapping the stereotyped behaviour of freely moving fruit fliesJournal of the Royal Society Interface 11:20140672.https://doi.org/10.1098/rsif.2014.0672
 4
 5
 6

7
Bird Flocks as Condensed MatterAnnual Review of Condensed Matter Physics 5:183–207.https://doi.org/10.1146/annurevconmatphys031113133834
 8

9
When Caenorhabditis elegans (Nematoda: Rhabditidae) bumps into a beadCanadian Journal of Zoology 54:566–570.https://doi.org/10.1139/z76065

10
Combinations of muscle synergies in the construction of a natural motor behaviorNature Neuroscience 6:300–308.https://doi.org/10.1038/nn1010

11
Automated adaptive inference of phenomenological dynamical modelsNature Communications 6:8133–8138.https://doi.org/10.1038/ncomms9133

12
Neuronal substrates of complex behaviors in C. elegansAnnual Review of Neuroscience 28:451–501.https://doi.org/10.1146/annurev.neuro.27.070203.144259
 13
 14
 15

16
Compressed sensing, sparsity, and dimensionality in neuronal information processing and data analysisAnnual Review of Neuroscience 35:485–508.https://doi.org/10.1146/annurevneuro062111150410

17
On simplicity and complexity in the brave new world of largescale neuroscienceCurrent Opinion in Neurobiology 32:148–155.https://doi.org/10.1016/j.conb.2015.04.003
 18
 19

20
Machine vision based detection of omega bends and reversals in C. elegansJournal of Neuroscience Methods 158:323–336.https://doi.org/10.1016/j.jneumeth.2006.06.007

21
Parallel use of two behavioral mechanisms for chemotaxis in Caenorhabditis elegansJournal of Neuroscience 29:5370–5380.https://doi.org/10.1523/JNEUROSCI.363308.2009
 22

23
A perspective: Robert B LaughlinPhysical Biology 11:053003.https://doi.org/10.1088/14783975/11/5/053003
 24

25
ZebraZoom: an automated program for highthroughput behavioral analysis and categorizationFrontiers in Neural Circuits 7:107.https://doi.org/10.3389/fncir.2013.00107
 26

27
A Generative Statistical Algorithm for Automatic Detection of Complex PosturesPLOS Computational Biology 11:e1004517.https://doi.org/10.1371/journal.pcbi.1004517
 28

29
The fundamental role of pirouettes in Caenorhabditis elegans chemotaxisJournal of Neuroscience 19:9557–9569.
 30

31
Mechanistic analysis of the search behaviour of Caenorhabditis elegansJournal of the Royal Society Interface 11:20131092.https://doi.org/10.1098/rsif.2013.1092

32
Temporal analysis of stochastic turning behavior of swimming C. elegansJournal of Neurophysiology 102:1172–1179.https://doi.org/10.1152/jn.90952.2008
 33

34
Dimensionality and dynamics in the behavior of C. elegansPLoS Computational Biology 4:e1000028.https://doi.org/10.1371/journal.pcbi.1000028
 35

36
Entropy and Information in Neural Spike TrainsPhysical Review Letters 80:197–200.https://doi.org/10.1103/PhysRevLett.80.197
 37

38
On aims and methods of EthologyZeitschrift Für Tierpsychologie 20:410–433.https://doi.org/10.1111/j.14390310.1963.tb01161.x

39
Searching for collective behavior in a large network of sensory neuronsPLoS Computational Biology 10:e1003408.https://doi.org/10.1371/journal.pcbi.1003408
 40

41
Using lateral coupled snakes for modeling the contours of wormsLecture Notes in Computer Science 5748:542–551.https://doi.org/10.1007/9783642037986_55

42
Pattern Recognition43–90, A survey of shape feature extraction techniques, Pattern Recognition.

43
A database of Caenorhabditis elegans behavioral phenotypesNature Methods 10:877–879.https://doi.org/10.1038/nmeth.2560

44
Specific evidence of lowdimensional continuous attractor dynamics in grid cellsNature Neuroscience 16:1077–1084.https://doi.org/10.1038/nn.3450
Decision letter

Ronald L CalabreseReviewing Editor; Emory University, United States
In the interests of transparency, eLife includes the editorial decision letter and accompanying author responses. A lightly edited version of the letter sent to the authors after peer review is shown, indicating the most substantive concerns; minor comments are not usually included.
Thank you for submitting your article "Resolving coiled shapes reveals new reorientation behaviors in C. elegans" for consideration by eLife. Your article has been reviewed by three peer reviewers, one of whom, Roland Calabrese, is a member of our Board of Reviewing Editors, and another is Gordon Berman (Reviewer #2), and the evaluation has been overseen by Naama Barkai as the Senior Editor.
The reviewers have discussed the reviews with one another and the Reviewing Editor has drafted this decision to help you prepare a revised submission.
Summary:
In this innovative short report, the authors use a computational approach in combination with video recording of movement to study turning in C. elegans, both escape turns and stochastic foraging turns. They develop an automated method for disambiguating coiled postures that builds on their previously published postural analyses that has given rise to the postural eigenmodes by PCA; there are 4 principal eigenmodes. They use this technique to describe turns and the locomotion proceeding and following as movement through the eigenmode space, showing how turns involve the third and fourth eigenmodes and basic crawling the first two eigenmodes. They then apply this techniques to show that escape turns are very stereotyped, while foraging turns have two basic forms; the conventionally recognized omegaturn (similar to the escape turn) and the newly described deltaturn corresponding to the serpentine analog of a leftright step. Moreover in foraging these turns are independent at about the same frequency and show parallel declines with foraging duration. All in all this was an enjoyable paper to read. It introduces a new technique that should be of great interest to the worm community and can serve as an inspiration for automated tracking and dimensionality reduction in other systems. Moreover, it makes a significant discovery the deltaturn that makes unbiased foraging possible.
Essential revisions:
1) The authors should emphasize more clearly in the Abstract and Discussion that the laser stimulus only elicits omegaturns.
2) There is concern that foraging in a copper ring where a nearly equal frequency of omegaturns and deltaturns were observed may not be indicative of foraging in an open petri plate, because copper serves as an aversive stimulus. Are the worms actively avoiding the copper boundary and is this influencing the performance of deltaturns?
3) The authors should clarify the developmental stage of the worms tracked in the copper ring experiments. Larval worms are more flexible than adults and this may influence the presence of deltaturns.
4.)The authors should more clearly acknowledge the early work of Croll (1976) and mention that that work reported that worms reorient randomly to dorsal or ventral side when bumping into a bead, and that their new observation may explain how.
5) The authors might do well to mention in their Discussion the neuronal basis for omega bend initiation and execution by the Bargmann lab (Gray et al., 2004, PNAS). They reported that the SMD and RIV motorneurons appear to stimulate omega bends, and that omega bend amplitude is encoded by SMD, and RIV underlies the ventral bias of omega bends. Indeed, dorsal reorienting turns were shown to occur with equal frequency as ventrally oriented omega bends (Figure 5 H) when the RIV motorneurons were ablated. These dorsal omega bends made by ablated worms in Gray et al. may relate to delta turns in intact worms in the present work.
6) We would particularly like to know how the observed eigenmodes change when including the new data as mentioned explicitly in the minor comments. It also would be interesting to determine if the fourth eigenmode shows similar dynamics to the third, as it temporally leads the 3rd (at least in the example shown in Figure 3C). Is this earlier signal (likely a head deflection) predictive of whether the worm goes into an omega or a delta turn?
7) We would like the authors to provide code for their analysis in some form (even just sample code, not necessarily beautifullywritten software) so that others can more easily evaluate and use their novel methods for tracking, as mentioned in the minor comments).
https://doi.org/10.7554/eLife.17227.019Author response
Essential revisions:
1) The authors should emphasize more clearly in the Abstract and Discussion that the laser stimulus only elicits omegaturns.
We have modified the Abstract and the Discussion (third paragraph) to clarify that the laser stimulus only elects Omegatype turns.
2) There is concern that foraging in a copper ring where a nearly equal frequency of omegaturns and deltaturns were observed may not be indicative of foraging in an open petri plate, because copper serves as an aversive stimulus. Are the worms actively avoiding the copper boundary and is this influencing the performance of deltaturns?
Over the foraging time shown in Figure 4D we find (274 +/ 64) omega turns and (305 +/ 35) delta turns, where the errors denote bootstrap errors resampled over the N=12 different worm recordings. The agreement in counts, within error bars, signals an approximate balance in overall turning rate, in agreement with the rate calculations. The total turn rate in Figure 4D is reasonably consistent with previous work (e.g., Gray et al., 2005), though there are notable differences in turn definitions and experimental settings. We also note, however, that there are spatiotemporal fluctuations in the turn counts. Indeed, as the reviewers suggest, we do see an increased number of both types of turns, as well as a specific bias towards omega turns, near the location of the copper ring. This likely reflects an increased rate of ringinduced escape responses. There is also an earlytime (approximately the first 200s) bias towards delta turns, which we believe is due to the mechanical perturbation of picking. We have added these details to the Methods section (subsection “Omega and delta turn frequency adaptation”). In future work, we intend to examine these spatiotemporal patterns in a larger experimental arena and with higher turn statistics. We have also made minor changes to Figure 4D, correcting both a mislabeling of the color legend as well as an analysis mistake which resulted in slightly higher reported rates in the previous version of our figure.
3) The authors should clarify the developmental stage of the worms tracked in the copper ring experiments. Larval worms are more flexible than adults and this may influence the presence of deltaturns.
We have added a sentence to the Methods section (subsection “Data”), stating the young L4 developmental stage of our tracked worms.
4.)The authors should more clearly acknowledge the early work of Croll (1976) and mention that that work reported that worms reorient randomly to dorsal or ventral side when bumping into a bead, and that their new observation may explain how.
We have added a reference to Croll (1975) in the Introduction (third paragraph) and to Croll (1976) in the Discussion of the use of deep turns in a taxis strategy (fifth paragraph).
5) The authors might do well to mention in their Discussion the neuronal basis for omega bend initiation and execution by the Bargmann lab (Gray et al., 2004, PNAS). They reported that the SMD and RIV motorneurons appear to stimulate omega bends, and that omega bend amplitude is encoded by SMD, and RIV underlies the ventral bias of omega bends. Indeed, dorsal reorienting turns were shown to occur with equal frequency as ventrally oriented omega bends (Figure 5 H) when the RIV motorneurons were ablated. These dorsal omega bends made by ablated worms in Gray et al. may relate to delta turns in intact worms in the present work.
We have added these ideas to the Discussion, in the fourth paragraph.
6) We would particularly like to know how the observed eigenmodes change when including the new data as mentioned explicitly in the minor comments. It also would be interesting to determine if the fourth eigenmode shows similar dynamics to the third, as it temporally leads the 3rd (at least in the example shown in Figure 3C). Is this earlier signal (likely a head deflection) predictive of whether the worm goes into an omega or a delta turn?
We have added Figure 2—figure supplement 1, in which we show the original eigenworms (Stephens et al., 2008); those derived from the current foraging data, but without including crossings; and those derived from the fullytracked foraging data, including crossed frames. While the eigenworm shapes are largely similar, and in all cases 4 modes capture over 95% of the postural variance, the third (turning) eigenmode individually accounts for more variance in the fullytracked data, as expected given its primary role in describing deep turns.
The comment about the possible predictive value of the fourth mode is an interesting one. We have included in our response (responsefig_a3vsa4.pdf) a scatter plot of the peak amplitude of the a4 peak immediately preceding the deep turn, vs. the peak amplitude of the a3 peak itself. The points are colorcoded, so that red corresponds to omega turns, and blue to delta turns, as classified in Figure 4. There is a visible link between the two quantities, and a significant overall correlation of 0.73 +/ 0.03. This suggests that the specific turntype is determined relatively early in the dynamics. We did not include this plot as supplementary material, as it takes us farther afield from the aim of our current manuscript. We do intend to revisit these points in future work clarifying the turning mechanism.
7) We would like the authors to provide code for their analysis in some form (even just sample code, not necessarily beautifullywritten software) so that others can more easily evaluate and use their novel methods for tracking, as mentioned in the minor comments).
We share your stance on the importance of sharing scientific code, and have uploaded a minimal working set of our tracking code, plus a sample movie that can be successfully tracked using the code’s default parameters, to Figshare: https://figshare.com/s/3ac08fbfec9ae3d5a531
Sample movie: https://figshare.com/s/658dd86e3847d5926257
The datasets are currently marked as private, but anyone with the above links can access the files. We will open up access to everyone as soon as the paper is public.
https://doi.org/10.7554/eLife.17227.020Article and author information
Author details
Funding
Natural Sciences and Engineering Research Council of Canada (Discovery Grant)
 William S Ryu
Vrije Universiteit Amsterdam (Startup Funds)
 Greg J Stephens
Okinawa Institute of Science and Technology Graduate University (Unit Funds)
 Greg J Stephens
The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.
Acknowledgements
We thank SURFsara (www.surfsara.nl) for help with the Lisa Compute Cluster. ODB was supported by startup funds from the Department of Physics and Astronomy, Vrije Universiteit Amsterdam. GJS acknowledges funding from the Department of Physics and Astronomy, Vrije Universiteit and The Okinawa Institute of Science and Technology Graduate University. WSR and JBR thank The National Science and Engineering Council of Canada (NSERC).
Reviewing Editor
 Ronald L Calabrese, Emory University, United States
Publication history
 Received: April 25, 2016
 Accepted: August 19, 2016
 Version of Record published: September 20, 2016 (version 1)
 Version of Record updated: October 4, 2016 (version 2)
Copyright
© 2016, Broekmans et al.
This article is distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use and redistribution provided that the original author and source are credited.
Metrics

 1,826
 Page views

 354
 Downloads

 17
 Citations
Article citation count generated by polling the highest count across the following sources: Crossref, Scopus, PubMed Central.
Download links
Downloads (link to download the article as PDF)
Download citations (links to download the citations from this article in formats compatible with various reference manager tools)
Open citations (links to open the citations from this article in various online reference manager services)
Further reading

 Computational and Systems Biology
 Structural Biology and Molecular Biophysics

 Computational and Systems Biology
 Human Biology and Medicine