A stochastic neuronal model predicts random search behaviors at multiple spatial scales in C. elegans

  1. William M Roberts
  2. Steven B Augustine
  3. Kristy J Lawton
  4. Theodore H Lindsay
  5. Tod R Thiele
  6. Eduardo J Izquierdo
  7. Serge Faumont
  8. Rebecca A Lindsay
  9. Matthew Cale Britton
  10. Navin Pokala
  11. Cornelia I Bargmann
  12. Shawn R Lockery  Is a corresponding author
  1. University of Oregon, United States
  2. University of Pennsylvania, United States
  3. Reed College, United States
  4. California Institute of Technology, United States
  5. University of Toronto, Canada
  6. Indiana University, United States
  7. Children's Hospital Los Angeles, United States
  8. University of Minnesota, United States
  9. New York Institute of Technology, United States
  10. Howard Hughes Medical Institute, Rockefeller University, United States


Random search is a behavioral strategy used by organisms from bacteria to humans to locate food that is randomly distributed and undetectable at a distance. We investigated this behavior in the nematode Caenorhabditis elegans, an organism with a small, well-described nervous system. Here we formulate a mathematical model of random search abstracted from the C. elegans connectome and fit to a large-scale kinematic analysis of C. elegans behavior at submicron resolution. The model predicts behavioral effects of neuronal ablations and genetic perturbations, as well as unexpected aspects of wild type behavior. The predictive success of the model indicates that random search in C. elegans can be understood in terms of a neuronal flip-flop circuit involving reciprocal inhibition between two populations of stochastic neurons. Our findings establish a unified theoretical framework for understanding C. elegans locomotion and a testable neuronal model of random search that can be applied to other organisms.


eLife digest

An animal’s ability to rapidly and efficiently locate new sources of food in its environment can mean the difference between life and death. As a result, animals have evolved foraging strategies that are adapted to the distribution and detectability of food sources. Organisms ranging from bacteria to humans use one such strategy, called random search, to locate food that cannot be detected at a distance and that is randomly distributed in their surroundings. The biological mechanisms that underpin random search are relatively well understood in single-cell organisms such as bacteria, but this information tells us little about the mechanisms that are used by animals, which use their nervous system to control their foraging behavior.

Roberts et al. have now investigated the biological basis for random search behavior in a tiny roundworm called Caenorhabditis elegans. This worm forages for pockets of bacteria in decaying plant matter and has a simple and well-understood nervous system. Roberts et al. used information on how the cells in this worm’s nervous system connect together into so-called “neural circuits” to generate a mathematical model of random searching.

The model revealed that the worm’s neural circuitry for random searching can be understood in terms of two groups of neuron-like components that switch randomly between “ON” and “OFF” states. While one group promotes forward movement, the other promotes backward movement, which is associated with a change in search direction. These two groups inhibit each other so that only one group usually is active at a given time. By adjusting this model to reproduce the behavioral records of real worms searching for food, Roberts et al. could predict the key neuronal connections involved. These predictions were then confirmed by taking electrical recordings from neurons. The model could also account for the unexpected behavioral effects that are seen when a neuron in one of these groups was destroyed or altered by a genetic mutation.

These findings thus reveal a biological mechanism for random search behavior in worms that might operate in other animals as well. The findings might also provide future insight into the neural circuits involved in sleep and wakefulness in mammals, which is organized in a similar way.



Random search is an evolutionarily ancient set of foraging strategies that evolved as an adaptation to environments in which prey items are undetectable at a distance and occur at unpredictable locations. Rather than attempting to exhaustively search a region of interest, the organism samples the environment at randomly selected points. This is achieved by executing a series of straight-line movements, called 'runs,' terminated at random intervals by sampling episodes during which the organism may or may not find prey. Sampling ends in a reorientation event, called a 'turn,' such that the next run is usually in a different direction from the preceding one. In optimal random foraging strategies the probability distribution of run length is matched to the statistical distribution of isolated food patches or prey items (Viswanathan, 2011), with power law distributions predominating when resources are sparsely distributed and exponential distributions predominating when resources are densely distributed (Humphries et al., 2010; Sims et al., 2012; Humphries et al., 2012).

Random search has been documented in a wide range of species including microorganisms, nematodes, insects, mollusks, fish, birds, and mammals including humans (Viswanathan, 2011; Berg and Brown, 1972; Pierce-Shimomura et al., 1999). In humans this strategy is observed in diverse contexts, from traditional hunter-gatherer societies (Brown et al., 2007; Humphries and Sims, 2014) to technologically enhanced fishing industries (Bertrand et al., 2007). The formal similarities between random search across widely diverse phyla and spatial scales (Viswanathan, 2011) may point to a common mechanism, even in organisms that are highly cognitive. Despite the universality of random search, little is known about its neuronal basis, in part because of the difficulty of recording and manipulating activity in the brain of an unrestrained animal while it explores a large region of space.

The relatively small spatial scale of random search behavior in C. elegans, coupled with the simplicity of its nervous system, provides a unique opportunity to identify the neuronal basis of random search in this species. To the unaided eye, C. elegans search behavior consists of forward runs, each terminated after a variable interval by a briefer period of reverse locomotion, which is also variable in duration (Pierce-Shimomura et al., 1999; Zhao et al., 2003; Wakabayashi et al., 2004), with apparently stochastic switching between these two behavioral states. Reversals are followed by resumption of forward movement that frequently begins with a deep body bend. These bends are highly variable in amplitude and lead to movement in a new direction. Thus, the sequence reverse–forward–deep bend, called a 'pirouette' (Pierce-Shimomura et al., 1999) is the fundamental turning event in C. elegans random search, with functional analogies to tumbles in bacterial chemotaxis (Berg and Brown, 1972). Careful inspection reveals a third state, called “pause,” in which locomotion ceases for a fraction of a second or more (Croll, 1975; Shingai, 2000; Stephens et al., 2008; Rakowski et al., 2013; Salvador et al., 2014). Thus, C. elegans locomotion consists of three main behavioral states – forward, reverse, and pause – together with the transitions between them.

C.  elegans subsists on a diet of bacteria that it finds mainly in rotting plant material (Frézal and Félix, 2015). In the laboratory, search behavior is studied in worms foraging on agar plates containing one or more dense bacterial lawns, analogous to food patches in the ethological literature. Like many other organisms, C. elegans can tune the spatial scale of random search to its physiological state, the availability of food (Wakabayashi et al., 2004; Gray et al., 2005), and prior knowledge of its distribution (Calhoun et al., 2014). The lowest values of search scale are observed during “cropping,” (Jander, 1975) the exploitation of a dense food patch. In C. elegans, two substates of cropping have been described: "dwelling," characterized by especially low crawling speed and frequent (presumably short) reversals, and "roaming," characterized by somewhat higher speeds and less frequent reversals. Transitions between dwelling and roaming, like the transitions between forward and reverse locomotion, are stochastic (Ben Arous et al., 2009; Fujiwara et al., 2002; Flavell et al., 2013). Intermediate values of search scale are observed during "local search" (Wakabayashi et al., 2004; Hills et al., 2004) when, for example, the animal is suddenly transferred from a bacterial lawn to a foodless region of the plate. The highest values of search scale are observed during “ranging,” when food is exhausted, starvation sets in, and the need to find a new food patch becomes urgent (Wakabayashi et al., 2004; Gray et al., 2005). Worms sometimes spontaneously leave a food patch well before it is exhausted, with leaving rate inversely related to food quality and food density (Shtonda and Avery, 2006; Harvey, 2009), which may reflect a trade-off between exploitation and exploration (Bendesky et al., 2011).

At the heart of the C. elegans locomotion circuit are five pairs of premotor 'command' interneurons organized into two functional groups that promote forward and reverse locomotion, respectively (Chalfie et al., 1985; Zheng et al., 1999; Stirman et al., 2010; Schmitt et al., 2012). The two groups are reciprocally connected, and make output synapses onto distinct, non-overlapping sets of motor neurons that control body-wall muscle. The locomotory state (forward or reverse) is believed to be determined mainly by whichever set of motor neurons is more highly activated by input from the command neurons (Kawano et al., 2011; Xie et al., 2013; Gao et al., 2015; Liu et al., 2014). Command neuron activation depends upon influences that are both external and intrinsic to the command neuron network, and appears to have a strong stochastic component that underlies switching between forward and reverse locomotion. Some command neurons are tightly linked both functionally and synaptically to upstream interneurons that also switch state stochastically in concert and counterpoint to them (Gordus et al., 2015), providing a potential additional source of the stochasticity on which random search depends. At least nine classes of chemosensory neurons and twelve classes of upstream interneurons are required for normal regulation of the duration of forward locomotion (Viswanathan, 2011; Gray et al., 2005; Tsalik and Hobert, 2003; Fang-Yen et al., 2015). Input from these neurons onto the command neuron network modulates the mean run length and, thereby, the spatial scale of random search. Search scale also appears to be modulated by neurons that release biogenic amines (serotonin, dopamine, and tyramine) (Flavell et al., 2013; Hills et al., 2004; Bendesky et al., 2011) or peptides (Ben Arous et al., 2009; Flavell et al., 2013; Gloria-Soria and Azevedo, 2008; Styer et al., 2008; Reddy et al., 2009; Bhattacharya et al., 2014). These diverse signaling pathways may provide the means by which the worm optimizes its search strategy in response to feeding history (Gray et al., 2005), the quality, density and spatial distribution of food (Shtonda and Avery, 2006; Calhoun et al., 2015), and other factors that constrain survival and reproduction (Gloria-Soria and Azevedo, 2008; Pujol et al., 2001; Pradel et al., 2007; Lipton et al., 2004).

Although the neural circuitry for local search has been described in considerable detail, our understanding of the system remains limited, partly for lack of key physiological data, but also for lack of a model in which to interpret the data. Common sense suggests that the forward and reverse command neurons should inhibit each other to minimize simultaneous occurrences of neuronal states for incompatible behaviors (Zheng et al., 1999). A plausible anatomical substrate for such reciprocal inhibitory connections between command neurons exists in the C. elegans connectome (White et al., 1986), but anatomical data do not specify the signs or strengths of synaptic connections. A quantitative model that incorporates physiological properties of the command neurons and their synaptic connections is needed to interpret experimental results, such as the unexpected observation that silencing some of the reverse command neurons causes a reduction in forward dwell time, and conversely for forward command neurons (Rakowski et al., 2013; Zheng et al., 1999). It is also needed to explain complex patterns of changes in dwell times observed across the three locomotory states caused by introducing or eliminating tonic membrane conductances in the command neurons, and to answer basic mechanistic questions about the control of C. elegans locomotion.

At present, the experimental data are insufficient for creating a neuron-by-neuron model of the command network that incorporates biophysical details such as synaptic and membrane conductances without introducing a heavy load of unconstrained parameters (Rakowski et al., 2013). Nor would such a mechanistically detailed model necessarily provide the appropriate level of abstraction in which to intuitively understand C. elegans search behaviors, including their strong stochastic component. Instead, we have kept the level of biological detail to the minimum needed to predict the statistical distributions of dwell times in forward, reverse and pause states, and other fundamental aspects of the behavior. Each of the model's three main assumptions remains within the bounds of widely accepted experimental results; our mathematical analysis simply shows what follows necessarily from these assumptions.

To provide an empirical basis for the model we quantified C. elegans search behavior in terms of tangential velocity, defined as the speed and direction of worm's movement along its sinuous trajectory, which we recorded at higher resolution than previously possible. Behavioral data were then fit to a four-state hidden Markov model in which each state corresponds to a unique pattern of activation across the command neurons. Importantly, rate constants governing probabilistic transitions between states in the Markov model are expressed in terms of synaptic weights in an analytically tractable version of the model. We were therefore able to validate the model by showing that it correctly predicts phenomena on which it was not fit, such as reciprocal inhibition between forward and reverse command neurons in the biological network and the behavioral effects of perturbations introduced by laser ablations and genetic mutations. Although the model is inherently probabilistic, we found that it also makes accurate predictions concerning deterministic behaviors in C. elegans, indicating a potentially high level of generality. The present findings thus establish a simple theory of C. elegans locomotory control and provide a testable model of random search that can be applied to other organisms.


A neuronal model of random search in C. elegans is a theory of the relationship between activation states of the command neurons and foraging behavior. Methods presently available for observing neuronal activity in freely behaving C. elegans utilize calcium-sensitive probes that have insufficient temporal resolution to observe the changes in neuronal activity associated with the rapidly changing behavioral states, especially the frequent brief pauses that are an integral part of the behavior. Therefore, as a proxy for command neuron state, we used the worm's tangential velocity, defined as the speed and direction of worm's movement along its sinuous trajectory. We focused on tangential velocity because in sinusoidal locomotion the net reactive forces produced by body-wall muscle contractions acting against the substrate are tangential to the body surface (Gray et al., 2005). Tangential velocity therefore provides the most direct readout of which group of motor neurons and command neurons (forward or reverse) is more active (Qi et al., 2013). Alternative measures of the rate of translation such as centroid velocity (Pierce-Shimomura et al., 1999) or postural phase velocity (Stephens et al., 2011) have a less direct relationship to command neuron state because these measures either depend in complex ways on the shape of the worm, or rely on a representation of posture that ignores some of the thrust-generating components of the worm’s shape that come into play unless the worm is moving along a fairly linear trajectory. To monitor tangential velocity as directly as possible, we painted a microscopic black spot on the worm and used a motorized stage controlled by a computer to keep the spot in the field of view (Figure 1A). The most common alternative method for measuring tangential velocity, tracking virtual points obtained by segmenting the worm’s centerline, is subject to segmentation errors introduced by low contrast images of the worm's head and tail (see Cronin et al., 2005) which changes the distance between virtual points. This method can also be compromised by dropped frames when the worm's centerline crosses itself during tight turns.

Figure 1 with 2 supplements see all
Descriptive statistics of wild type worm tracks.

(A) (x,y)-coordinates of a worm during 10 min of foraging. Inset: Image of a worm showing the black spot (arrow) used for optical tracking (scale bar = 200 µm). (B) The speed distribution computed from the distance moved between successive video frames had a peak at 180 µm/s, which includes both forward and reverse locomotion. A second peak at 14 µm/s corresponds to pauses. The decreased probability of observing speeds <14 µm/s (<0.47 μm/frame) is due to noise in the position measurement. (C) At least three time constants were required to fit (red) the speed autocovariance function (black; grey shading shows ± 1 sem). (D) The worm’s heading remained nearly constant for ~10 s except for a transient peak at 1.4 s (▼), which corresponds to the period of one half cycle of undulation during sinusoidal locomotion. The dashed line shows random reorientation; shading shows ± 1 sem. (E) Example of v(t) showing periods of forward locomotion, reverse locomotion and pauses of various durations. Upward triangles (▲) mark forward-pause-forward (FPF) events; the downward triangle (▼) marks a reverse-pause-reverse (RPR) event. (F) Velocity distributions for the 5 wild type cohorts (5 colors) analyzed in this study. (G) Ensemble-averaged velocity during FPR transitions. All FPR transitions in all wild type cohorts were aligned at the end of forward movement, grouped according to the duration of the pause (2–9 frames), and averaged. Such transitions were defined using a threshold criterion of |v| < 50 μm/s to identify state P (Rakowski et al., 2013). Pauses lasting ≤ 1 frame are not shown because of ambiguity in state identification; pauses lasting ≥ 10 frames are omitted for clarity. (H) Identical to G except RPF transitions are shown. (I) Cumulative probability distributions for dwell time in the pause state defined as in G and H for all FPR and RPF transitions of duration >1 frame in wild type worms.


At the start of a 10 min observation period an individual worm was transferred from a food-laden culture plate to a bare agar surface devoid of overt sensory cues, thereby inducing a period of intensive local search behavior (Jander, 1975; Hills et al., 2004). The (x, y)-coordinates of the centroid of the spot were recorded with a temporal resolution of 33 ms (i.e., frame rate = 30 Hz) and a spatial resolution of 0.5 μm that was limited mainly by the precision of the stage position encoder; the optical tracking error was much smaller (Figure 1—figure supplement 1). A spatial resolution of approximately 0.5 μm amounts to an approximately 10-fold improvement over previously published tracking systems (Kocabas et al., 2012); thus worm speed (Figure 1B) could be extracted with unprecedented accuracy. For statistical analysis, worms were grouped into cohorts having the same genotype or neurons ablated (17–31 worms per cohort), which had been reared together and tested in parallel as young adults within the same 2–3 day period. This approach yielded a comprehensive data set containing a total of 8.3 million position measurements from 501 individuals in 20 cohorts.

Model-independent identification of locomotory states

Figure 1A– D describes important features of search behavior obtained by regarding the worm as a point moving in an external reference frame (allocentric coordinates) without regard to the orientation of the body axis. The speed distribution was bimodal (Figure 1B) with a broad peak around 180 µm/s that includes both forward and reverse motion, and a narrower peak near zero that corresponds to pauses. The speed autocovariance function had multiple exponential components (Figure 1C), suggesting at least three locomotory states. The average change in heading angle (|Δφ|¯), plotted as a function of the intervening time interval (Figure 1D), showed that worms maintained a nearly constant heading for up to 10 s (Stephens et al., 2010; Peliti et al., 2013), but reoriented randomly within ~30 s, establishing the shortest time scale over which the behavior can be considered a Brownian random walk (Figure 1—figure supplement 2), the simplest form of random search. On shorter time scales the path takes on the character of a truncated Lévy flight (Mantegna and Stanley, 1994).

 For more detailed analysis we distinguished forward from reverse movement by visual inspection of the recorded videos, and defined velocity, V(t) , to be a signed scalar value that denotes the speed of movement along the worm’s track in the direction of the head (+) or tail (-) (Figure 1E; see Materials and methods). The probability distribution of V(t) (Figure 1F) showed two broad peaks that correspond to forward and reverse movement, and a narrow third peak centered at zero that corresponds to pauses. For the initial analysis we defined pauses using a fixed speed threshold of 0.05 mm/sec (Rakowski et al., 2013). Pauses occurred most frequently as transient interruptions of forward locomotion, causing the worm to stutter as it moves (Figure 1E; Video 1); stuttering also occurred, albeit less frequently, during reverse locomotion (Figure 1E; Video 2). Distinct pauses were also observed during transitions from forward to reverse (Figure 1G; Video 3) and from reverse to forward (Figure 1H; Video 4). Most pauses lasted longer than one video frame, indicating the presence of a locomotory state having a detectable dwell time; thus pauses were not merely zero crossings in plots of velocity versus time. We found that pauses during forward to reverse transitions were on average longer in duration than pauses during reverse to forward transitions (Figure 1I; p<10–5 ; Mann-Whitney U-test). These findings are consistent with the predictions of the model presented below, which uses a probabilistic criterion rather than a fixed velocity threshold to identify pauses.

Video 1
Forward-Pause-Forward transition.

The worm is crawling on a foodless agar plate. The microscope stage moves continuously to keep the tracking spot near the center of the frame. Stage movement can be assessed by monitoring the white streaks in the background, which are segments of the worm's track at earlier times. Behavioral state is indicated in the upper left corner of the frame. The indicated behavioral transition is shown at normal speed, and slowed down by a factor of 5. The worm is paused when the tracking spot is stationary relative to the streaks.

Video 2
Reverse-Pause-Reverse transition.
Video 3
Forward-Pause-Reverse transition.
Video 4
Reverse-Pause-Forward transition.

The stochastic switch model

Based on the results presented in Figure 1 and previous studies noted below, we propose a minimal model for the control of random search behavior that involves two opposing neuron-like “units” that can exist in four distinct states corresponding to forward locomotion, reverse locomotion, and two pause states. This model differs from a previous model that represents the worm as a point in “shape space” (Stephens et al., 2008) in that here velocity is measured directly by observing the motion of a point on the body surface relative to the substrate, rather than indirectly by the temporal progression of shape changes. It also differs from previous models (Rakowski et al., 2013; Zheng et al., 1999; Wicks et al., 1996; Kunert et al., 2014) by representing changes in locomotory state as probabilistic transitions in a Markov process.

Ablation of individual premotor interneurons (Chalfie et al., 1985) has led to the hypothesis that the direction of locomotion is controlled by a network comprising five pairs of premotor command interneurons organized into two functional groups that promote forward and reverse locomotion, respectively. Although the anatomical pattern of synaptic connectivity among these interneurons has been established (White et al., 1986) (Figure 2A), this information does not yield an intuitive explanation of how the direction of locomotion is regulated. Nor, in our view, does the present state of the anatomical connectivity provide the basis for a neuron-by-neuron simulation of the network (but see Rakowski et al., 2013), as neither signs nor physiological strengths (weights) of synapses in C. elegans can be inferred reliably from anatomical structure or neurotransmitter type, and almost nothing is known about the intrinsic membrane currents of these neurons or how they shape the input-output function of individual command neurons.

Figure 2 with 3 supplements see all
Assumptions with supporting data for the Stochastic Switch Model.

(A) Connectivity of forward and reverse command neurons. Arrows with single heads are monosynaptic connections inferred from the C. elegans connectome (White et al., 1986; Varshney et al., 2011) line thickness is proportional to the number of presynaptic specializations seen in the reconstruction of each pairwise connection. Open, double-headed arrows indicate synaptic pathways from or to the indicated pool of neurons outside the network. (B) Voltage recording from the command neuron AVA in the absence of injected current. In this neuron, quasi-stable membrane potentials are seen at -17 and -32 mV. These results differ from previously published AVA recordings, which were made in the presence of hyperpolarizing current (5–10 pA) that kept the membrane potential near -55 mV (Lindsay et al., 2011). (C) Neuronal representation of the Stochastic Switch Model. Forward and reverse command neurons are represented as single binary neuron-like units and , respectively. Arrows depicting cross connections (W, W) represent functional (net mono- and polysynaptic) connections between forward and reverse units. Self-connections (W, W) represent synaptic connections between neurons comprising a given unit, voltage dependent currents in these neurons, and polysynaptic recurrent pathways involving non-command neurons. Downward arrows (h, h) represent the combined effects of input from presynaptic neurons, including sensory neurons, and neuromodulation. (D) Markov model representation of the command neuron network. The color of a unit indicates its state of activation (red on, white off). In addition to the forward state F and the reverse state R, there are two pause states, X and Y. Arrows, with their associated rate constants, indicate transitions in which a single unit changes state. Transitions in which two units change state simultaneously have probability zero because single-unit transitions are assumed to be statistically independent. (E) The most likely sequence of states in the hidden Markov model (computed using the Viterbi algorithm) for a representative data segment.


To establish a mathematically tractable framework for understanding how the command network functions during search behavior, we created a minimal model based on three simplifying assumptions, each of which was biologically motivated. (i) Command neurons act like binary units (Hopfield, 1982). This assumption was based on voltage recordings from command neurons in which we regularly observed two stable membrane potentials with rapid transitions between them (Figure 2B; also see Kato et al., 2015). It is also supported by the observation of a bimodal distribution of calcium activity in AVA neurons and their upstream partners AIB and RIM (Gordus et al., 2015), and the report of distinct up and down states in voltage recordings from motor neruons (Liu et al., 2014). (ii) Command neurons switch state stochastically. This assumption was based on the observation that C. elegans locomotory behavior has a strong stochastic component, with exponentially distributed dwell times in forward and reverse states (Pierce-Shimomura et al., 1999; Zhao et al., 2003; Flavell et al., 2013; Gordus et al., 2015; Stephens et al., 2011). (iii) Command neurons within the forward pool are co-active, as are command neurons in the reverse pool. This assumption is based on simultaneous calcium imaging data from multiple command neurons in freely moving animals which suggest that the activity of neurons within the reversal pool is tightly correlated (Schrödel et al., 2013; Pokala et al., 2014). Additionally, neurons in opposing groups are likely to be reciprocally active, as indicated by simultaneous calcium imaging from AVA and AVB (Pokala et al., 2014; Faumont et al., 2011), as well as AVE and AVB (Kawano et al., 2011). A fourth assumption, concerning the relationship between neuronal states and behavioral states, is introduced below.

The three simplifying assumptions, together with the anatomical data (White et al., 1986), lead to a model that has two binary stochastic elements, and , and six synaptic weights (Figure 2C). Each type of weight has a specific interpretation. The cross-connections (W, W) represent mono- and polysynaptic connections between command neurons in different groups. The self-connections (W, W) represent connections between command neurons in the same group, including recurrent polysynaptic pathways involving neurons outside the command network. Self-connections also represent possible intrinsic voltage dependent currents within the command neurons, such as C. elegans plateau currents (Mellem et al., 2008). The pair of connections originating from an or  unit can have either the same sign or different signs. Allowing a single unit to have opposing effects on different postsynaptic targets is justified by the fact that synaptic weights in the model represent polysynaptic pathways, the effects of which can be excitatory or inhibitory, and by the observation that some C. elegans neurons can monosynpatically excite some postsynaptic neurons while inhibiting others (Chalasani et al., 2007). Two additional weights, h and h, represent inputs from sensory neurons, interneurons, neural modulators, and any other sources outside the network (Gray et al., 2005; Fry et al., 2014), plus intrinsic membrane conductances that produce sustained effects on membrane potential (Zheng et al., 1999; Gao et al., 2015). The summed synaptic inputs onto and are, respectively, S(t)=h+Wb(t)+Wb(t)h and S(t)=h+Wb(t)+Wb(t), where b(t) and b(t) are the states of and at time t (1 = ON, 0 = OFF). The quantities h and h were assumed to be constant during the 10 min observation period of local search behavior on a bare agar surface.

State transitions of and were modeled as independent non-homogeneous Poisson processes in which the transition rates are exponential functions of the summed synaptic input to the units, as shown in Figure 2—figure supplement 1. Changes of the state of and can be regarded as thermally-driven transitions across energy barriers of height proportional to S(t) and S(t), respectively. Inhibitory synaptic input increased the height of the barrier for OFF→ON transitions while decreasing the height of the barrier for ON→OFF transitions by the same amount; excitatory synaptic inputs had the opposite effect. The variable A (Materials and methods, Equations 26, 27) represents the fundamental timescale of the system, defined as the rate at which units and change state when the summed synaptic input is zero. The present model is distinct from deterministic models of the command neuron network (Rakowski et al., 2013; Zheng et al., 1999; Wicks et al., 1996; Kunert et al., 2014) in that it is inherently stochastic, like the behavior it is meant to predict. In particular, the synaptic input to a unit does not immediately determine its state, but instead modifies the transition rates between ON and OFF states.

The two binary units of the model can exist in four states (F, R, X, Y; Figure 2D), and provide the basis for a hidden Markov model having eight transitions in which a single unit changes state. The model was further constrained by the synaptic model, which allows the eight transition rate constants to be specified by only six synaptic weights as shown in Equations 31–35 (Materials and methods). A Markov model was adopted to represent the biological system because dwell times in Markov states, like the observed dwell times in forward and reverse states (Zhao et al., 2003; Viswanathan, 2011), are exponentially distributed. A hidden Markov model was required because, as noted above, states of command neurons cannot be observed directly in freely moving animals, even using optical recording methods.

The fourth assumption is a particular mapping between the states of the two command units and behavioral states of the worm. The command units, and , are intended to represent the two pools of forward and reverse command neurons, respectively, such that the worm moves forward when is ON and is OFF (state F), backwards when is ON and is OFF (state R), and pauses when both and are OFF (state X). These associations between states of the model and activation states of the command neurons are well supported by previous experimental evidence, including studies showing that genetic ablation or silencing of all command interneurons induces prolonged pauses (Zheng et al., 1999; Kawano et al., 2011), but they also assume the major simplification that all command neurons in a given pool act together as a unit.

The model also permits a fourth state, in which and are simultaneously ON (state Y). Whether the corresponding co-activation state of forward and reverse command neurons normally exists with any significant probability remains to be shown, but it has been observed that their downstream targets, the forward and reverse motor neurons, can be active simultaneously, causing the worm to pause (Kawano et al., 2011). Given the existence of gap junction synapses between the main forward and reverse command neurons and their respective sets of forward and reverse motor neurons, it is reasonable to suppose that forward and reverse command neurons are co-active when their motor neurons are co-active. Thus, there is some evidence to designate state Y as a second pause state, which we consider to be a working hypothesis. Together, states X and Y comprise the phenomenological pause state denoted P. In what follows, we explore the logical consequences of the model’s four assumptions; it remains to be shown experimentally how closely the states of the model correspond to activity states of the command neurons.

We used a maximum likelihood method (Colquhoun and Hawkes, 1995) (Materials and methods) to estimate the set of transition rate constants that had the highest probability of generating the observed time series v(t). Direct transitions between F and R, and between X and Y, were disallowed because the assumed statistical independence of the two command units implies that the probability of simultaneous transitions in and is vanishingly small. (Note, however, that the model does allow transitions between any two states during the interval between successive video frames by making two or more non-simultaneous transitions; see Equation 21). We first fit the velocity distribution for each cohort with three overlapping probability distributions corresponding to forward, reverse and pause states (Figure 2—figure supplement 2), then searched for the set of transition rate constants that maximized the likelihood of the observed v(t) given the velocity distributions. The resulting rate constants were used to compute the most likely sequence of states via the Viterbi algorithm (Rabiner, 1989; Viterbi, 1967). The agreement between observed velocity data and the sequence of states shown in Figure 2E was typical of the entire data set.

Wild type locomotion

The maximum likelihood rate constants for 5 wild-type cohorts, together with the predicted state probabilities and mean dwell times computed from them, are given in column A of Table 1. The model’s predicted mean dwell time in the reverse state (dR= 1.94 ± 0.04 s) agreed with previously reported values (Zheng et al., 1999; Kawano et al., 2011). In contrast, the predicted mean dwell time in the forward state (dF= 5.33 ± 0.25 s) was smaller than previously reported when dwell time was measured by eye (13–35 sec) (Zhao et al., 2003; Zheng et al., 1999; Brockie et al., 2001; Ryu and Samuel, 2002) or by velocity threshold crossings (9–16 sec) (Rakowski et al., 2013; Stephens et al., 2011). To determine whether this difference arose because we used a hidden Markov model rather than a fixed velocity threshold, we also identified states based on a fixed velocity threshold of 0.05 mm/s, and calculated the resulting mean dwell times: dF,0.005= 1.86 ± 0.03 s; dR,0.005= 1.23 ± 0.02 s; dP,0.005= 0.14 ± 0.001 s. We attribute the short mean dwell times in state F that we observed using either the hidden Markov model or a fixed velocity threshold to the fact that our tracking system is capable of revealing briefer visits to state P, which interrupt forward runs, than previous methods. Ignoring transient interruptions of forward locomotion (i.e., FPF transitions) and using the fixed velocity threshold of 0.05 mm/s yielded longer a mean forward dwell time of 9.13 ± 0.15 s, which matches the value obtained by others using the same threshold (8.98 ± 0.57 s) (Rakowski et al., 2013). Predicted mean dwell times in the two pause states differed substantially from each other (dX=0.44 ± 0.03 s, dY= 0.21 ± 0.02). We assigned the long and short pause states to X and Y, respectively, based on the idea that the energetically expensive state in which both units are on should be relatively short-lived.

Table 1
Maximum likelihood fits of transition rates in wild type C. elegans.

Each cohort was fitted separately; values are expressed as mean ± sem (n = 5 cohorts). Data from wild type cohorts were obtained on the same days as the experimental cohorts for which they served as controls (Tables 3 and 4), but experimental cohorts in this study were separated by weeks to months. All transition rates were constrained to be ≥0. Transition rates that were calculated using the synaptic constraints (Equation 35) are shaded orange; other constrained values are shaded grey. Mean dwell times and state probabilities were calculated from the transition rates. Column A shows fits using the standard model, which has 8 rate constants with two synaptic constraints, resulting in 6 free parameters that determine the 6 synaptic weights (Figure 2C,D; Materials and methods Equations 31–35). Column B shows fits to a model that has only one pause state (X); this model was derived from the standard model by imposing two more constraints: aFY=aRY0, yielding 4 free parameters. To allow comparison of models A and B by the likelihood ratio test, which requires tht model B be a special case of model A, aRY and aFY were set slightly >0 (10-10 s-1), thereby avoiding infinite values for aYF and aYR when applying the synaptic constraints, while maintaining a vanishingly small probability of being in state Y (pY< 10-18). The loge likelihood (summed over the 5 cohorts) for model B was 1854 less than for model A, with 30 degrees of freedom for model A (6 per cohort × 5 cohorts) and 20 degrees of freedom for model B (4 per cohort × 5 cohorts). Applying the likelihood ratio test, the difference was highly significant (p<10-100; p=Chi-squared(2L, df), where = 1854 and df  = 30–20 =10. Model C is the most general 3-state (F, R, P) model, which allows all six transitions between the three states. The fitted transition rates for model C were nearly identical to model B. Likelihood values are relative to model A.

2 pause states6 free parameters1 pause state4 free parameters1 pause state6 free parameters
Δ loge likelihood0-1854-1836
Degrees of freedom302030
mean ± sem ( = 5)mean ± sem ( = 5)mean ± sem ( = 5)
aXR (s-1)1.201 ± 0.0991.019 ± 0.0851.008 ± 0.090
aXF (s-1)1.115 ± 0.0871.915 ± 0.1521.914 ± 0.152
aRX (s-1)0.025 ± 0.0080.507 ± 0.0130.507 ± 0.013
aRY (s-1)0.490 ± 0.01510-10
aFX (s-1)0.182 ± 0.0070.198 ± 0.0090.196 ± 0.008
aFY (s-1)0.007 ± 0.00210-10
aYR (s-1)0.411 ± 0.019>109
aYF (s-1)4.575 ± 0.533>109
aFR (s-1)0.001 ± 0.001
aRF (s-1)0.000 ± 0.000
dF (s)5.329 ± 0.2455.096 ± 0.2355.135 ± 0.227
dR (s)1.945 ± 0.0431.975 ± 0.0491.976 ± 0.049
dX (s)0.441 ± 0.0320.349 ± 0.0260.351 ± 0.027
dY (s)0.208 ± 0.019<10-9
pF0.762 ± 0.0150.7641 ± 0.0150.764 ± 0.014
pR0.158 ± 0.0070.158 ± 0.0070.155 ± 0.007
pX0.063 ± 0.0060.081 ± 0.0080.080 ± 0.008
pY0.017 ± 0.002<10-18

In previous work, transitions between locomotory states in C. elegans have been analyzed by choosing a speed threshold to distinguish pause states from the movement states (Rakowski et al., 2013; Salvador et al., 2014; Stephens et al., 2011). The choice of threshold is important because it affects the measured dwell times, yet is necessarily arbitrary because the velocity distributions of the states overlap (Figure 1F). The hidden Markov model used here replaces arbitrary thresholds with empirically determined state transition rates (i.e., the set of rates that maximizes the probability of the observed velocity time series), from which one can determine the sequence of states that is most likely to have generated the data (the Viterbi algorithm). The hidden Markov model thus offers two advantages: (1) it provides a statistical criterion for selecting the best parameter values and (2) it takes into account the uncertainties in identifying the state of the system from velocity data.

Under the assumptions of the hidden Markov model the state of the system cannot be observed directly because the velocity distributions overlap, making it impossible to test directly whether the predicted state probabilities agree with the observed velocity data. Nevertheless, an important test of the model can be obtained using the Viterbi algorithm to identify the most likely sequence of states given the observed velocity data, from which the histogram of dwell times in each state can be computed and compared to the exponential distribution predicted by the Markov model (Figure 2—figure supplement 3). The degree of agreement between the distributions shows that our model provides a good description of the system.

The initial rationale for including two pause states in the hidden Markov model came from our model-independent analysis of the tracking data (Figure 1I), which showed different dwell time distributions for pauses at FPR and RPF transitions. To test whether having two pause states yielded a statistically significant improvement in the ability of the model to fit the data, we eliminated one of the pause states and asked whether the resulting reduction in likelihood was greater than could be attributed to the reduction in the number of free parameters (see Table 1). For this comparison we constrained the transition rates into state Y to be extremely small (aFY=aRY= 10-10 s-1), effectively eliminating state Y and reducing the number of free parameters from six to four. The reduction in likelihood caused by eliminating one of the pause states was highly significant, and cannot be attributed simply to the elimination of two parameters (p<10-100; likelihood ratio test). Separately, we considered the most general one-pause state model, which allows direct transitions between states F and R and has no constraints on the 6 transition rates other than that they are all ≥0. The fit of this model (Table 1 column C) converged to nearly the same set of transition rates as the one-state model described above (Model B). These comparisons show that our model with two pause states and six free parameters (the six synaptic weights) provides a much better fit to the data than models with only one pause state. We conclude that the tracking data contain a statistically significant signature of two distinct pause states. The model explains the observation that the pause dwell times during FPR transitions are longer than during RPF transitions (Figure 1I) in terms of the different dwell times in states X and Y (dX>dY), and the strong tendency to cycle clockwise through state space, exiting from state F to state X and from state R to state Y as shown by the fate diagram (Figure 3).

Fate diagram of the model. 

The system typically cycles clockwise through states F, X, R, Y, with state F frequently interrupted by FXF transitions, leading to state sequences of the form …(FX)nRY(FX)nRY…. Nearly unidirectional transitions out of a given state are shown by red arrows; blue arrows indicate nearly equiprobable transitions. The width of the arrows and the numbers beside them show the probability that the transition out of the state at the tail of the arrow is into the state at the head. The area of each circle is proportional to the probability of the corresponding state (Table 1, column A).


It has been reported that pauses in C. elegans locomotion occur at specific points in “shape space” (Stephens et al., 2011), suggesting the worm pauses in preferred postures. To investigate this possibility, we analyzed worm tracks before and after pauses, inferring posture from the path of the tracking spot. This inference is justified by the fact that on an agar surface the worm moves without slipping, such that each segment of the body traces the trajectory of the one before it. Thus, the path of the tracking spot leading up to the pause reveals the worm’s posture posterior to the spot during forward locomotion, and anterior to the spot during reverse locomotion (Figure 4).

Relationship between pauses and posture.

(A) Average track curvature upon entry in to the pause state in wild type worms. Prior to computing curvature, tracks of individual worms were mirror-imaged as needed such that positive curvature corresponds to a ventral bend. Tracks in the vicinity of pause events were aligned according to the location of the tracking spot in the pause state, converted to curvature, then averaged over all FX transitions (solid blue line; n = 1907), and all RY transitions (red; n = 295) for which the track length was >1.5 mm; shading shows ± 1 S.D. The trace depicts the curvature of the worm posterior to the tracking spot at the end of forward movement (FX transitions) and anterior to the tracking spot at the end of reverse movement (RY transitions). The dashed blue line shows the average curvature at FXR transitions (i.e., excluding FXF stutters). (B) Locomotory phases at which FX transitions occurred, plotted as blue dots on the unit circle. The phase at each FX transition was computed as φ=2πz1/(z2z1), where z1 and z2 are the positions of the two downward zero crossings of curvature preceding the pause as indicated in panel A, right. The uniform distribution of points around the circle, and therefore the small magnitude of the vector strength (r=0.14; arrow), shows that there was only a small (but statistically significant) phase preference at the end of forward motion (p<1016; Rayleigh test). (C) Same as B, but for RY transitions. Vector strength is large (r=0.71), indicating a strong tendency to end reverse runs at a particular phase (p<1063), with a ventral bend in the middle of the body. (D) Average posture at FXR transitions, calculated by integrating the average curvature, computed over all tracks that persisted for >1.5 mm in state F before the pause and >1 mm in state R after the pause. Arrows indicate direction of motion along the track (blue, forward; red, reverse). FXR transitions were typically a simple reversal along the same track. (E) Same as D but for RYF transitions that persisted for >1.5 mm in state R before the pause and >1 mm in state F after the pause. RYF transitions at the end of reverse runs that persisted for >1.5 mm were usually associated with a ventral bend that resulted in a ~180° change of direction as previously described (Gray et al., 2005).


Plotting mean curvature versus distance along the track (Figure 4A) reveals only a weak tendency to stop in a particular posture in state X (r = 0.14; Figure 4B). Nearly all of the transitions into state X were either stutters during forward locomotion (FXF transitions) or reversals (FXR transitions); when these were analyzed separately, similarly weak postural preferences were found at FXF transitions (r = 0.14) and FXR transitions (r = 0.14). A nearly identical result (r = 0.14 ) was obtained using a fixed velocity threshold of 0.05 mm/s rather than the hidden Markov model to determine state. For the latter case, in which there is only one pause state, we analyzed the posture at all FP transitions, which almost always correspond to FX transitions in the hidden Markov model because FY transitions are extremely rare (see Figure 3 ).To test whether the failure to find a strong postural preference at FX transitions was due to including very short pauses in the analysis, we repeated the analysis after reclassifying all pauses shorter than a minimum duration as a continuation of the previous state, and obtained the same result; we found no strong postural preference at FX transitions for minimum pause durations up to 2 s (r = 0.16, 0.19, 0.23, 0.3 for X dwell times > 0.33 s, 0.67 s, 1 s, and 2 s, respectively); longer dwells in state X were too rare to analyze. Thus, FX transitions can occur at any locomotory phase and do not occur preferentially at a particular posture (Figure 4D); in the case of FXR transitions the worm generally retreats along the same track. In contrast, we found a strong tendency to stop in a particular posture in state Y (Figure 4A,C,E; r = 0.71). Almost all entries into state Y were RYF transitions and these were associated with a ventral bend in the middle of the worm (Figure 4E). These results suggest fundamental differences between the control of forward and reverse locomotion. In our model, forward locomotion terminates when forward command neurons turn OFF, and this can happen at any phase, whereas reverse locomotion terminates when forward neurons turn ON, and this is most likely to happen at a particular phase. The latter could be explained by phasic feedback from the locomotory pattern generator to the forward neurons (Li et al., 2006).

Ablation of command neurons

To determine the contributions of individual command neurons to the overall function of the command network, we separately ablated the pair of neurons that comprises each command neuron class, then tracked ablated and sham operated animals during local search. Mean velocities in F and R, if significantly changed, were reduced (Pokala et al., 2014) (Figure 5A; ), as was the frequency of undulations during forward and reverse locomotion (Table 3). In many organisms, the frequency of rhythmic behaviors is regulated by the amplitude of tonic excitatory drive to the associated pattern generator (Weeks and Kristan, 1978; Satterlie and Norekian, 2001; Böhm and Schildberger, 1992; Deliagina et al., 2000; Dembrow et al., 2003; Hedwig, 2000; Sirota et al., 2000). To explain our results we propose that ablation of the locomotory command neurons reduces tonic drive to the presumptive locomotory pattern generator (Xie et al., 2013; Gao et al., 2015).

Ablation of command neurons.

(A) Velocity distribution of ablated cohorts (red) compared to sham operated controls (grey) when the indicated command neuron was killed. Stars indicate significant reduction in velocity for the indicated peak (p<0.05 without () or with () correction for multiple comparisons; Table 3). (B) Dwell times in F, R, and P in ablated (red) and sham operated animals (grey). Stars indicate significant differences from sham (as defined in Table 4). Horizontal lines indicate the estimated range of d0, the dwell time in the uncoupled state. Each group of ablated animals was tested in parallel with a distinct set of sham operated controls to minimize the effects of variation between populations. Error bars for dwell times are not shown because statistical significance was calculated using the likelihood ratio test (see Table 4 legend), which does not generate sem estimates, and calculation of confidence intervals would have required an excessive amount of computation time. Stars indicate p<0.05 without () or with () correction for multiple comparisons (Table 4).

Table 2
Synaptic weights derived from the transition rate constants.

The rate constants were taken from Table 1, column A. Two values of the fundamental switching time, A, corresponding to the minimum (0.40 Hz) and maximum (0.86 Hz) values consistent with the ablation results were used in Materials and methods, Equations 36–38 to calculate the corresponding synaptic weights.

 A= 0.4 Hzmean ± sem (n = 5)A= 0.86 Hzmean ± sem (n = 5)
h1.01 ± 0.080.25 ± 0.08
h1.09 ± 0.080.32 ± 0.08
w-5.40 ± 0.43-5.40 ± 0.43
W-0.81 ± 0.06-0.81 ± 0.06
W-0.22 ± 0.061.31 ± 0.06
W1.90 ± 0.333.43 ± 0.33
Table 3
Effects of command neuron ablations on undulation frequency, forward velocity and reverse velocity.

Values were computed separately for each worm and are shown as mean ± sem (n = 19–29 ). Undulation frequency was estimated as one-half of the reciprocal of the time of the first local minimum in the heading autocorrelation function. All p-values are from two-tailed t-tests and are shown without correction for multiple comparisons. Blue denotes significance at p<0.05. Red denotes significance at p<0.05 after Bonferroni correction for 15 comparisons.

Undulation frequency (Hz)Forward velocity (μm/s)Reverse velocity (μm/s)
NeuronClassShamAblatedp <ShamAblatedp <ShamAblatedp <
AVBForward0.355 ± 0.0090.230 ± 0.0077x10-11236 ± 6109 ± 45x10-20-327 ± 7-302 ± 80.04
PVCForward0.283 ± 0.0110.290 ± 0.0100.5187 ± 7192 ± 70.7-253 ± 8-248 ± 60.7
AVDReverse0.270 ± 0.0080.236 ± 0.0080.009173 ± 6141 ± 50.0002-243 ± 4-229 ± 50.06
AVAReverse0.302 ± 0.0050.254 ± 0.0094x10-5195 ± 5155 ± 74x10-5-293 ± 7-69 ± 33x10-22
AVEReverse0.264 ± 0.0070.256 ± 0.0080.6165 ± 4160 ± 50.5-235 ± 4-211 ± 60.003

A previous study found that ablating a subset of the reverse command neurons (AVAL and AVAR) reduces dwell time in the reverse state but also paradoxically reduces dwell time in the forward state (Zheng et al., 1999). Similarly paradoxical effects have been reported following ablation of the reciprocally connected brain stem nuclei that regulate sleep and wakefulness (Saper et al., 2010). The stochastic switch model predicts and explains such effects. In principle, the ablation of a subset of neurons in a pool of co-active neurons can have widespread effects on the pool’s overall input and output connectivity. Widespread effects can be expected because ablation removes not only the outgoing synaptic connections from the ablated neurons, but also the targets of incoming synaptic connections. In the C. elegans command neuron network, ablating a reverse command neuron such as AVA potentially reduces four of the six weights in the network: h, W, W, and W. Thus, a single ablation can move the system a considerable distance in weight space toward the uncoupled state in which all weights are zero. In the limiting case of a fully uncoupled network, all dwell times approach a value of 1/2A, where A is the intrinsic switching time of the stochastic units (see Materials and methods, equations 31–34); henceforth we will use d0 to denote the uncoupled dwell time. Dwell times that in intact animals are greater than d0 will be reduced by ablation, whereas dwell times that are less than d0 will be increased. In particular, if dF and dR are both greater than d0, ablation of a reverse command neuron is expected to reduce both dwell times; the same is true for ablation of a forward command neuron. Thus the observed paradoxical effects of ablations are to be expected if d0 is below dF and dR.

To determine the actual relationship between d0 and dwell times in the forward and reverse state, we estimated the rate constants in ablated animals and sham operated controls, and computed the corresponding dwell times (Figure 5B; Table 4). Dwell times in F and R, if significantly altered by the ablation (), were reduced, indicating that d0 is indeed below dF and dR. Additionally, dwell times in the pause states dX and dY were increased, with one exception (dY, AVB). Thus, the observed pattern of dwell time changes is consistent, overall, with a value of d0 that is between the dwell times of the movement states and the dwell times of the pause states. This finding allowed us to place bounds on d0. Specifically, d0 must be less than or equal to the lowest post-ablation value of dR, and greater than or equal to the largest post-ablation value of dX; thus, 0.58 ≤ d0 ≤ 1.24 sec. Furthermore, because A=1/2d0, we can infer that 0.40 Hz ≤ A ≤ 0.86 Hz. This inequality provides an estimate of the fundamental time scale of stochastic switching in C. elegans locomotion. For subsequent analysis, we defined Amin= 0.40 Hz and Amax= 0.86 Hz.

Table 4
Effects of command neuron ablations on model parameters.

The sign of the change (Δ) caused by the ablation is shown as “+” if the value moved away from 0, “–” if the value moved towards 0. Significance was determined using the likelihood ratio test (Weisstein, Eric W. "Likelihood Ratio." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram. com/LikelihoodRatio.html), which is based on the reduction in likelihood caused by constraining one of the parameters to have the same value in both the ablated cohort and the corresponding sham cohort. The unconstrained fit thus had 12 free parameters (6 for each of the 2 cohorts being compared), while the constrained fit had 11 free parameters. For example, to test the significance of the change in the mean dwell time in the pause state (dP=(pXdX+pYdY)/(pX+pY)dp=(pxdx+pYdY)/(px+py) caused by ablation of the AVA neuron pair, two cohorts (ablated and sham) were grown and tested under identical conditions. The ln likelihood with 12 free parameters was found to be 894794.075. When dp was constrained to be the same for both cohorts, the ln likelihood for the 11 parameter fit was found to be 894784.676. The test statistic D=2×(894794.075894784.676)=18.798 was assumed to come from a chi-squared distribution with one degree of freedom, which yielded p=1.45×105 (shown in the table as p<104). The constrained fitting process was repeated in turn for each ablation/sham pair for each of the 9 rows shown in the table. All p-values are shown without correction for multiple comparisons. Blue denotes significance at p<0.05. Red denotes significance at p<0.05 after Bonferroni correction for 27 comparisons

dF (s)5.4555.2210.25.1584.08110-156.7303.14310-997.2892.64210-996.0586.558+0.02
dR (s)3.0192.43610-62.5402.3670.052.3591.24310-412.1271.68110-62.8422.3960.0005
dX (s)0.5480.54810.5140.520+0.60.4800.582+10-70.3700.437+10-60.4570.508+0.004
dY (s)0.2290.263+0.0020.2290.241+0.070.2140.331+10-70.1970.14410-70.2200.226+0.5
dp (s)0.4950.496+10.4600.468+0.50.4370.510+10-40.3310.416+10-110.4100.457+0.003

Synaptic weights in the stochastic switch model

Having placed bounds on A, we were able to compute synaptic weights in the model (Table 2). This was done by deriving expressions for the weights in terms of the rate constants (Materials and methods, Equations 36–38) and substituting into these equations our estimates of rate constants together with the values of Amin and Amax. We found that input weights, h and h, are small and positive, suggesting that these inputs may provide modest but steady excitation to the system (Figure 6A). The self-connections W and W are also mainly positive, indicating that the ON states may be stabilized by intrinsic or extrinsic positive feedback. The cross-connections W and W are negative, indicating reciprocal inhibition, as expected for neurons that activate opposing behavioral states. Furthermore, the magnitude of W is greater than the magnitude of W, suggesting that the animal spends more time in the forward state than the reverse state in part because the forward neurons inhibit the reverse neurons more strongly than the reverse neurons inhibit the forward neurons.

The Stochastic Switch Model correctly predicts the sign and strength of synaptic connections.

(A) Synaptic weights (mean ± sem, n = 5 cohorts) from maximum likelihood fits to velocity data from wild type worms. (B, C) Left, synaptic current in AVB or AVA when the indicated presynaptic neuron was photoactivated (blue line). Right, mean synaptic current during the first 100 ms of the stimulus plotted against holding potential in the postsynaptic neuron (I-V curve). Lines show linear fits to the data at negative holding potentials which were used to estimate vRev. (D), Zero-current holding potential and reversal potential of synaptic currents (mean ± sem) in the indicated postsynaptic neuron (paired t-tests: AVA to AVB, p= 0.043, n = 9; AVB to AVA, p= 0.019, n = 17). (E), Scatter plot of synaptic currents recorded at a holding potential of -15 mV (unpaired t-test: p= 0.010, n ≥ 25).


Synaptic weights in an abstract network model such as this one, where neuronal state is activation rather than voltage, are not generally interpretable as synaptic conductances. Rather, they represent the functional effects of one neuron on another, such as the degree of excitation or inhibition produced by a unit change in activation. Thus, synaptic weights in the Stochastic Switch model cannot be said to predict the magnitude of synaptic conductances, but they can be said to predict aspects of functional connectivity in certain cases. For example, as command neurons AVA and AVB are behaviorally much more important than the others (Chalfie et al., 1985) (see also Figure 5A,B), it is reasonable to assume that the signs of their functional synaptic connections match the signs of the net functional connections in the biological network. Thus, the model predicts reciprocal inhibition (Qi et al., 2012) between AVA and AVB under this assumption. We tested this prediction by photoactivating either AVA or AVB with channelRhodopsin-2 and recording electrophysiologically from AVB or AVA, respectively (Figure 6B,C). We found that the reversal potential of optically induced synaptic currents in AVA and AVB was more negative than the zero-current potential in these neurons (Figure 6B,C,D), indicating synaptic inhibition as predicted by the model. This inhibition is likely to be monosynaptic as C. elegans command neurons are cholinergic and express inhibitory postsynaptic receptors that respond to acetylcholine (Pereira et al., 2015). Additionally, the connection from AVB to AVA appeared to be stronger thaCroninn the connection from AVA to AVB (Figure 6E), measured in terms of the amplitude of the synaptic current at a holding potential approximately equal to the membrane potential when command neurons are in their depolarized state (Figure 2B). However, we do not exclude the possibility that AVB was more strongly activated than AVA as a result of differential expression of the photoprobe. These findings demonstrate the feasibility of using the worm’s velocity, v(t), a simple behavioral measure, to predict functional synaptic connections between populations of neurons in a biological neural network, at least under certain assumptions concerning the relationship between model network weights and physiological synaptic strengths.

Genetic effects on command neuron function

Two classes of ion channel mutants that affect membrane conductances in the command neurons are also known to alter locomotory behavior in systematic ways, thus providing key insights into command neuron function (Zheng et al., 1999). The hyperpolarizing class (“HYP”) comprises three genotypes in which release of the excitatory neurotransmitter glutamate, presumed to be tonic, is disrupted by mutations that affect either presynaptic (eat-4(ad572), eat-4(ky5)) or postsynaptic mechanisms (glr-1(n2461)). These mutations are hypothesized to cause chronic hyperpolarization of the command neurons by reducing depolarizing currents. The depolarizing class (“DEP”) comprises two genotypes in which a constitutively activated glutamate receptor is expressed in the command neurons (glr-1::glr-1(A/T), nmr-1::glr-1(A/T)). These mutants are hypothesized to chronically depolarize the command neurons.

We found that the frequency of locomotory undulations was decreased in HYP mutants and increased in DEP mutants compared to wild-type controls (Table 5), consistent with the likely effects of respectively increasing and decreasing tonic drive to the presumptive pattern generator for locomotion. Importantly, however, it is possible that both classes of mutation also alter the input resistance of the command neurons. The closure or removal of glutamate receptors in HYP mutants should increase input resistance whereas the introduction of constitutively active glutamate receptors in DEP mutants should decrease it. Thus, the previously observed effects of these mutations on locomotory state transitions (Zheng et al., 1999) could be the result of changes in membrane potential (ΔV), input resistance (Δr), or both.

Table 5
Effects of mutations on mean undulation frequency, mean forward velocity and mean reverse velocity.

Values were computed separately for each worm and are shown as mean ± sem (n = 25–31). Undulation frequency was estimated as one-half of the reciprocal of the time of the first local minimum in the heading autocorrelation function. All p-values are from two-tailed t-tests and are shown without correction for multiple comparisons. Blue denotes significance at p<0.05. Red denotes significance at p<0.05 after Bonferroni correction for 15 comparisons.

Undulation frequency (Hz)Forward velocity (μm/s)Reverse velocity (μm/s)
GenotypeClassWild typeMutantp <Wild typeMutantp <Wild typeMutantp <
eat-4(ad572)HYP A0.272 ± 0.0110.222 ± 0.0074x10-4156 ± 5122 ± 41x10-5-228 ± 5-236 ± 90.5
eat-4(ky5)HYP B0.317 ± 0.0110.256 ± 0.0092x10-4184 ± 7143 ± 65x10-5-262 ± 10-271 ± 70.5
glr-1(n2461)HYP C0.294 ± 0.0080.291 ± 0.0100.9158 ± 5166 ± 60.3-236 ± 6-236 ± 51
glr-1::glr-1(A/T)DEP A0.272 ± 0.0110.642 ± 0.0296x10-13156 ± 5112 ± 53x10-7-228 ± 5-143 ± 52x10-15
nmr-1::glr-1(A/T)DEP B0.294 ± 0.0080.695 ± 0.0372x10-12158 ± 5138 ± 50.011-236 ± 6-144 ± 57x10-15

Changes in membrane potential and input resistance can both be represented in the stochastic switch model by changes in synaptic weights. We modeled the effects of ΔV by adding an increment Δh (1Δh 1) to wild type h values, with negative Δh for HYP mutations and positive Δh for DEP mutations. We modeled the effect of Δr as a change in the magnitude of synaptic weights (h and w quantities). This representation of Δr is appropriate because changes in input resistance alter the magnitude of the voltage change that would be produced by a fixed postsynaptic current. All weights were scaled by a common factor z (1 < z < 2 for HYP mutants; 0 < z < 1 for DEP mutants).

Here we consider the effects of ΔV and Δr on dwell times in the stochastic switch model to enable direct comparison with the original study of HYP and DEP strains (Zheng et al., 1999). Dwell times can be written as functions of weights:

(1) dX=aXF+aXR-1=[A exp(h)+A exp(h)]1                                                           
(2) dF=aFX+aFY-1=[A exp(hw)+A exp(h+w)]1                             
(3) dR=aRX+aRY-1=[A exp(hw)+A exp(h+w)]1                              
(4) dY=aYR+aYF-1=[A exp(hww)+A exp(hww)]1

These equations show that the ΔV and Δr hypotheses make qualitatively distinct predictions. The simplest case is dwell dX, which depends only on h and h. Equation 1 shows that dX rises and falls as h terms are made more negative or positive, respectively. Thus, under the ΔV hypothesis, dX should rise in HYP mutants and fall in DEP mutants (Figure 7A, row 4). In contrast, under the Δr hypothesis, in which weight magnitudes (|W| and |h|) decrease in DEP mutants and increase in HYP mutants, dX should rise in DEP mutants and fall in HYP. To distinguish between these hypotheses, we measured dwell times in mutants and wild type animals during local search. The pattern of observed changes in dX matched the pattern predicted by the ΔV hypothesis but not the Δr hypothesis (Figure 7C, row 4). Thus, the effects of membrane potential appear to dominate the effects of changes in synaptic strength in the case of mutant values of dX.

Predicted and observed effects of HYP and DEP mutations on dwell times.

(A) Predicted effects of changes in membrane potential. (B ) Predicted effects of changes in input resistance. (C) Dwell times in F, R, and P for cohorts of HYP mutants, DEP mutants, and wild type animals. Stars indicate significant change in dwell time (p<0.05 without () or with () correction for multiple comparisons; Table 6). In A-C wild type dwell times are indicated by gray bars. Horizontal lines indicate the estimated range of d0 , the dwell time in the uncoupled state. In the ΔV model, h terms were made more negative to model HYP mutants and more positive to model DEP mutants by subtracting or adding a constant Δh = 0.6; qualitatively similar results were obtained for 0 < h ≤ 0.8. In the Δr model, h and w terms were scaled by (1 + f) to model HYP mutants and by (1 - f) to model DEP mutants, with f = 0.6; qualitatively similar results were obtained for 0 < f ≤ 1. Strains, HYP A: DA572 eat-4(ad572); HYP B: MT6308 eat-4(ky5); HYP C: KP4 glr-1(n2461); DEP A: VM1136 lin-15(n765); akIs9 [lin-15(+), Pglr-1::GLR-1(A/T)]; DEP B: VM188 lin-15(n765); akEx52[lin-15(+), Pnmr-1::GLR-1(A/T)].

Table 6
Effects of mutations on model parameters.

Significance was determined using the likelihood ratio test as described in Table 4. The sign of the change (Δ) caused by the mutation is shown as “+” if the value moved away from 0, “–” if the value moved towards 0. All p-values are shown without correction for multiple comparisons. Blue denotes significance at p<0.05. Red denotes significance at p<0.05 after Bonferroni correction for 27 comparisons.

HYP A: eat-4(ad572)HYP B: eat-4(ky5)HYP C: glr-1(n2461)DEP A: glr-1::glr-1(A/T)DEP B: nmr-1::glr-1(A/T)
ControlMutantp <ControlMutantp<ControlMutantp<ControlMutantp<ControlMutantp<
dF (s)4.7719.564+10-874.9568.643+10-645.1817.871+10-334.7710.94010-995.1810.74210-99
dR (s)2.0432.821+10-71.9102.769+10-122.0183.004+10-162.0450.87510-992.0180.70910-9 9
dX (s)0.4811.040+0.0050.5290.844+10-430.4590.727+10-390.4820.32810-490.4600.23510-99
dY (s)0.2470.382+10-50.2380.290+0.0050.2210.16410-50.2470.09710-930.2210.07910-99
dp (s)0.4280.982+10-990.4660.793+10-520.4090.677+10-430.4280.28610-610.4090.20410-99

In contrast to dX, dF and dR depend on w terms as well as h terms. Under the ΔV hypothesis, the h terms but not the w terms would be affected by the mutations. Positive and negative increments in h have the effects shown in Figure 7A, rows 1 and 2; dF and dR are predicted to shift in opposite directions. Changes in dF are dominated by the effects of h on the first term in Equation 2 (which represents aFX) because the second term in the equation (which represents aFY) remains close to zero in the mutants. Analogously, changes in dR are dominated by the effects of h on the second term in Equation 3 (aRY) because the first term in the equation (aRX) remains close to zero in the mutants.

The Δr hypothesis makes a distinctly different prediction. In this version of the model, w terms and h terms would both be affected by the mutations. Now, the predicted pattern of dwell time changes across both dF and dR is such the both dwell times shift in the same direction (Figure 7B, rows 1 and 2); specifically, dwell times in DEP and HYP mutants move toward or away from their uncoupled dwell times, respectively. Taken together, the pattern of observed changes in dF and dR matched the pattern predicted by the Δr hypothesis (Figure 7C, rows 1 and 2) but not the ΔV hypothesis. We conclude that changes in synaptic strength may dominate the effects of changes in membrane potential on mutant values of dF and dR.

Neither hypothesis predicts the observed changes in dY (Figure 7C, row 5) which resembled the pattern of changes in dX (Figure 7C, row 4). However, the ΔV hypothesis correctly predicts observed dwell times in the overall pause state dp (Figure 7C row 3). This is because dp is dominated by dX and changes in dX are well-predicted by the ΔV model as noted above. Overall, our analysis of the effects of HYP and DEP mutations in terms of the Stochastic Switch Model points to a role for changes in both membrane potential and input resistance in regulating dwell times.

Regulation of search scale

The Stochastic Switch Model immediately suggests a family of models for the regulation of the spatial scale of random search in response to the availability of food and the worm’s physiological state. The scale of random search is determined primarily by mF, the mean distance traveled during a forward run. In C. elegans, a run begins with a transition from state R (via P) into state F and continues until the next transition into state R. Any run may include one or more visits to state P, but FPF transitions are not usually associated with changes in heading. In terms of the Stochastic Switch Model, mF=V¯FpF/fRPF, where V¯F is the average velocity in state F, pF is the probability of being in state F, and fRPF is the frequency of RPF transitions (Materials and methods, Equation 39), which coincide with random reorientations. Importantly, under the approximation aFY0 (Table 1, column A), mF is can be expressed as a function of just three of the six weights in the network:

(5) mFvFA¯·exp(h)+exp(h)exp(hhw)

We refer to these weights as potential control points in the network. In a minimal model of search scale regulation, mF could be controlled by sensory inputs represented by h and h (Figure 8A).

Figure 8 with 2 supplements see all
The Stochastic Switch Model accounts for the three main modes of random search in C. elegans.

(A) Plot of mean forward run length versus the weights h and h, illustrating a minimal model of search-scale regulation. (B-H) Calculated effects on search mode of the weights indicated in parentheses. The frequency of reversals (fFPR) is plotted against mF while these three weights are scanned from -6 to 6 weight units in steps of 0.4. Each point was categorized as cropping (magenta), local search (green), ranging (blue), or indeterminate (grey) according to value of fFPR and mF, and whether or not the associated value of mR (not shown) indicated a short or long reversal; see Materials and methods for definitions of search modes. Yellow diamonds mark the scanned points modeled in Figure 8—figure supplement 1. A = 1 Hz; similar results were obtained for A=Amax and A=Amin (Table 7).


Search scale (mF) together with the frequency of reversals (FPR transitions), have been used to define the three search modes commonly recognized in C. elegans: cropping, local search, and ranging. To find minimal models for regulation of search mode, we performed exhaustive searches of subregions of network’s six-dimensional weight space. Subspaces, defined by one, two, or three weights, were scanned across a wide range of values (-6 ≤ w ≤ 6) while other weights remained fixed at their wild type levels (Figure 7B–H). The performance of each configuration of the network was scored according to whether it matched the range of mF magnitudes and reversal frequencies characteristic of each mode (see Materials and methods). Another consideration was the number of distinct search modes available; accordingly, we also noted the density with which the plane defined by reversal frequency and mF was covered in the scan (Figure. 8B-H, gray symbols).

All three search modes were available in the subspace defined by the control points (h, h, W) (Figure 8B, Figure 8—figure supplement 1). However, only cropping and local search were available in the complementary subspace (W, W, W) (Figure 8C); thus, to achieve the full set of search modes, at least one of the weights in equation 5 must be free to change. None of the control-point weights was sufficient on its own to produce all three search modes (Figure 8D–F). Scanning the subspaces (h, W) and (h, W) showed these pairs of weights to be sufficient for all modes (Figure 8G,H), but a three-dimensional subspace containing at least one of the control-point weights was a necessary condition for both dense coverage of this plane and the presence of all three search modes (Table 7). We suggest that these three-weight subspaces constitute the most likely minimal models for the regulation of search in C. elegans. They could be tested by chronic manipulation of control-point weights utilizing a variety of approaches, such as chemical or optical probes that alter tonic inputs to the command network from sensory neurons and interneurons represented by the parameters h and h.

Table 7
Regulation of search mode.

The weights in each subspace were scanned from -6 to 6 weight units in steps of 0.4 with A=Amin or A=Amax. The letter x means that the indicated search mode was present for at least one point in the subspace when A=Amin and when A=Amax; the letters y and z mean that the mode was present only when A=Amin or A=Amax, respectively. See Materials and methods for definitions of search modes. Control-point weights as defined by the theoretical relationship between weights and search scale (Equation 5) are shown in bold. Only the three-weight subspaces are sufficient for producing all three search modes and full coverage of the plane defined by reversal frequency and mF plane as shown in Figure 8.

hh x ⋅ ⋅ ⋅
h xx⋅ ⋅ ⋅
wFF xx⋅ ⋅ ⋅
w x . . .
w x . . .
w x . . .
h, wyxx. . .
h, w xx. . .
h, w xx. . .
h, w xx. . .
h, wxxx. . .
h, w xx. . .
wFF, w xx. . .
wFF, w xx. . .
wFF, w xx. . .
h, w xx. . .
h, h xx. . .
h, w xx. . .
w, wxx .......
w, w y . . .
w, w x .......
h, w, wxxx.......
h, w, wxxx.......
wFF, w, wxxx.......
h, w, wxxx.......
h, w, wxxx.......
wFF, w, wxxx.......
h, w, wxxx.......
h, w, wzxx.......
wFF, w, wxxx.......
h, h, wxxx.......
h, h, wxxx.......
h, h, wxxx.......
h, wFF, wxxx.......
h, wFF, w xx.......
h, wFF, w xx.......
h, wFF, wxxx.......
h, wFF, wxxx.......
h, wFF, wyxx.......
h, h, wFFxxx.......
w, w, wxx .......

Biased random walks

Mean forward run length is also modulated during biased random walks, increasing or decreasing when the animal is moving in a favorable or unfavorable direction, respectively (Pierce-Shimomura et al., 1999; Block et al., 1982; Iino and Yoshida, 2009; Luo et al., 2014). When C. elegans is engaged in chemotaxis toward an attractive substance, the direction of motion relative to the gradient is represented by specialized chemosensory neurons that respond either to increases (ON cells) or decreases in concentration (OFF cells) (Thiele et al., 2009) ; moreover, interventions that activate ON cells or OFF cells promote runs and pirouettes, respectively (Suzuki et al., 2008). Thus, in one simple model of random-walk chemotaxis, ON cells increase h and decrease h, whereas OFF cells do the opposite. Simulations show that this model is sufficient to generate realistic chemotaxis in a point model of search behavior in C. elegans (Figure 8—figure supplement 2) when the worm is below the target concentration of attractant. Similar circuitry can explain biased random walks in response to other physical gradients (Lockery, 2011).

The Stochastic Switch Model and deterministic behaviors

In addition to random search, the command neurons in C. elegans are required for a variety of escape responses (Hart et al., 1995) that are deterministic in that pR closely approaches unity for strong stimuli (Wittenburg and Baumeister, 1999; Tobin et al., 2002; Liu et al., 2012; Mohammadi et al., 2013). C. elegans escape responses can be produced by two pathways, one that requires the reverse command neurons (Chalfie et al., 1985) and one that does not (Piggott et al., 2011). Three distinct circuit motifs for the functional connectivity underlying escape responses requiring reverse command neurons are conceivable (Figure 9A). In the Push motif, nociceptive neurons excite reverse command neurons via h thereby increasing the rate constants for transitions in which turns ON (aXR and aFY), and decreasing the rate constants for transitions in which turns OFF (aXR and aFY ). In the limit where h→ ∞, both aXR and aFY→ ∞, whereas aRX and aYF→ 0 (Figure 9B). The system now inhabits only states R and Y, and pR=aYR/(aYR+aRY). In the Pull motif, nociceptive neurons inhibit the forward command neurons via h. In the limit where h→ -∞, the system switches only between states R and X and pR=aXR/(aXR+aRX). In the third motif, in which Push and Pull are combined, R becomes an absorbing state (pR=1). Using the rate constants shown in column A of Table 1 to compute limiting values of pR in each motif, we found that the Pull and Push-Pull motifs are sufficient for deterministic escape, whereas the Push motif is not (Figure 9B). Thus, inhibition of forward command neurons is required for deterministic escape, predicting that nociceptive neurons functionally inhibit these neurons.

Extension of the Stochastic Switch Model to deterministic behaviors.

(A) Three functional circuit motifs for deterministic escape behavior initiated by the nociceptive neuron ASH. (B) Predicted steady-state probability of reversal behavior in the resting state and the activated state of the three motifs shown in A. Plotted values are means across the five wild type cohorts shown in Figure 1F. Error bars are ± sem. Numbers in parenthesis are predicted mean first latency to a reversal response. (C) Left, synaptic current in AVB when ASH was photoactivated (blue line). Right, mean synaptic current during the first 100 ms of the stimulus plotted against holding potential in AVB. The line is fit to the data at negative holding potentials. (D) Mean zero-current holding potential and mean reversal potential of synaptic currents (± sem) in AVB (paired t-test: p= 0.013, n = 4).


To test this prediction we examined the ASH neurons, a pair of nociceptive sensory neurons required for the majority of escape responses in C. elegans. ASH neurons have anatomically defined monosynaptic and polysynaptic connections to both the behaviorally dominant command neurons AVB and AVA (Chalfie et al., 1985; White et al., 1986). We have previously shown that the functional connection from ASH to AVA is excitatory (Lindsay et al., 2011). To test whether the functional connection from ASH to AVB is inhibitory, we photoactivated ASH neurons while recording from AVB (Figure 9C,D). The reversal potential of this connection was more negative than the zero current potential, indicating inhibition as predicted by the model. Thus, ASH-mediated escape may be controlled by a Push-Pull motif, further demonstrating the feasibility of using behavioral data to predict population-level synaptic connectivity. The source of the AVB inhibition could be the inhibitory connection from AVA, polysynaptic pathways from ASH to AVB, or both.

Notably, the Pull and Push-Pull motifs are equally effective in driving pR to 1.0 (Figure 9B). Nevertheless, computation of the expected latency to the first reversal event when a forward moving animal suddenly encounters a strong nociceptive stimulus indicates a 2.3-fold reduction in latency for the Push-Pull motif (Figure 9B, parenthetical values). We conclude that the ASH mediated escape circuit in C. elegans may be specialized for short latency escape responses.


The Stochastic Switch Model is cast at a level of biological detail that is minimally sufficient to capture the stochastic dynamics of C. elegans locomotion in neuronal terms. Despite its simplicity, the model predicts the unexpected effects of neuronal ablations and genetic manipulations. It also predicts the sign and strengths of key synaptic connections, which were confirmed by combining optogenetics with electrophysiology. The model is immediately extensible to random search at a variety of spatial scales, biased random walks such as chemotaxis, and deterministic escape behaviors. The predictive success of the model indicates that random search in C. elegans can be understood in terms of a neuronal flip-flop circuit involving reciprocal inhibition between two populations of stochastic neurons. Two likely sources of stochastic state transitions are quantal synaptic transmission and ion channel gating. Both of these sources derive their randomness from thermal fluctuations at the molecular level, a phenomenon that is common to all nervous systems. The stochasticity underlying search behavior in C. elegans could be intrinsic to the command neurons, their presynaptic neurons (Gordus et al., 2015), or both.

The simplifying assumptions of the model introduce several limitations worth noting. (i) By representing the ten command neurons as only two functional units, the model ignores possible functional differences between individual neurons within each group. (ii) By design, the model predicts exponentially distributed dwell times, but Figure 2—figure supplement 3 shows that this relationship is only approximate. (iii) The model also has no provision to explain the strong correlation between locomotory phase and entry into state Y (Figure 4), although this could be added by modeling feedback from the pattern generator as a time-varying component of h and h. (iv) The model does not take into account temporal correlations in velocity, but instead uses only the present velocity, along with the present state, to compute transition probabilities. For example, the fact that locomotion gradually slows before the worm enters the pause state (Figure 1G,H) suggests that transition probabilities might be more reliably calculated by including the recent velocity history, rather than just the present velocity. (v) Finally, the model does not attempt to explain the observation that the number of command neurons that are present and the degree of command neuron activation has an effect on velocity and undulation frequency (Figure 5A, Table 3, Table 5). Velocity modulation could be incorporated by relaxing the assumptions that command neurons within pools are co-active and have a single non-zero level of activation.

Although the model correctly predicts several unexpected and even paradoxical observations at the behavioral and electrophysiological levels, it would be premature to conclude that the biological system functions as assumed. This caution extends to all of the model's assumptions, including the mapping relationship between pause states X and Y and their behavioral correlates. We view the pause states as theoretical constructs having an epistemological status akin to theoretical constructs in many widely accepted models, such as the gating particles that were proposed in the Hodgkin-Huxley model of the squid action potential to explain the voltage sensitivity of ion channels.

An altogether different method for analyzing locomotory states in C. elegans also proposed the existence of two pause states (Stephens et al., 2008). In that work, each pause state was associated with a particular locomotory phase. In contrast, we found that only state Y occurred in association with a particular posture (a ventral bend in the middle of the body), whereas state X occurred with essentially no postural preference. The reason for this discrepancy may be that pauses are identified in different ways in the two studies. Here pauses are identified in terms of tangential velocity. In Stephens et al. (Stephens et al., 2008; 2011; 2010), however, pauses are identified in the phase space defined by the amplitudes of first two principle components of the worm's instantaneous shape. For the two approaches to yield the same result, minima in the magnitudes of tangential and phase velocity would have to be coincident at all times. We believe this outcome is unlikely because the third and fourth principle shape components, which account for approximately 30% of the shape variance (Stephens et al., 2008), meet the necessary and sufficient conditions for generating tangential thrust: a gradient of curvature along the worm’s centerline (Gray, 1946; Gray, 1953; Gray and Lissmann, 1964); this is one way thrust is believed to be generated during omega turns (Stephens et al., 2008). Thus, the worm can be moving with respect to the substrate even when phase velocity is zero. Overall, we speculate that pauses in phase velocity are a subset of pauses in tangential velocity. The extent to which this is true could be determined by performing spot tracking and shape analysis on the same individual worms.

It will be interesting to test several additional predictions of Stochastic Switch Model:

  1. The sign of the input weights, h and h predicts tonic excitation of the network. This could be the result of constitutive excitatory synaptic inputs, or depolarizing leakage currents in individual command neurons as has been proposed (Gao et al., 2015).

  2. The sign of the self-connections W and W predicts one or more mechanisms of self-excitation within command neuron pools. These might include excitatory connections between command neurons, or intrinsic membrane currents capable of producing plateau potentials (Mellem et al., 2008).

  3. The fate diagram (Figure 3) predicts that forward commands neurons generally lead the changes in direction during spontaneous locomotion. For example, transitions from F to R almost always begin with the unit turning off, whereas transitions from R to F almost always begin with the unit turning on. This prediction could be tested by calcium imaging in command neurons in freely moving animals (Nguyen et al., 2015); Venkatachalam et al., 2016).

  4. Finally, the prediction that forward command neurons lead the changes in direction, coupled with the observation that transitions from R to Y occur at a particular phase, predicts that the forward command neurons are the predominant site at which phasic feedback from the locomotion pattern generator influences the network. Direct observation of neuronal activity in freely moving animals would be the ideal experiment to confirm the existence of the two pause states proposed in the Stochastic Switch Model (Nguyen et al., 2015; Venkatachalam et al., 2016). In particular, it will be necessary to show that whenever all command neurons are OFF, or all are ON, tangential velocity goes to zero. These experiments will be challenging because they must be done by imaging neuronal activity in freely moving animals at a temporal resolution that exceeds what can be obtained with the current generation of calcium probes. In fact, it may be necessary to use voltage probes rather than calcium indicators because even a very fast calcium probe will be limited by the dynamics of calcium accumulation, which is slow on the time scale of the pause dwell times predicted by the model. Another potential complication is that velocity may not change instantaneously with changes in the state of the command network, but with a delay imposed by time constants in the motor system. A less direct approach, although one with much higher temporal resolution, would be to make whole cell current clamp recordings from command neurons or motor neurons in restrained animals, which cycle through global brain states analogous to forward and reverse locomotion (Kato et al., 2015) even though they cannot move. Instances in which both motor systems are OFF or ON would provide evidence for states X and Y, respectively.

Like the Stochastic Switch Model, a previous model of the command neuron circuit by Rakowski et al. (Rakowski et al., 2013) predicts reciprocal inhibition between command neurons. Although the two models analyze locomotion behavior in terms of the same three behavioral states – forward, reverse, and pause – the models have essentially no points of mathematical contact. In the Rakowski model, neurons are deterministic electrical compartments and only the long-term average state probabilities of the network are computed. In the Stochastic Switch Model, by contrast, neurons are inherently stochastic and instantaneous state is computed. These disparities are significant because only the Stochastic Switch Model can predict temporal phenomena including such fundamental quantities as transition rates and mean dwell times. The fact that the both models predict reciprocal inhibition may reflect that fact that the behavioral signal of reciprocal inhibition is strong enough to transcend large differences between models.

Mammalian sleep, like C. elegans locomotion, is composed of numerous abrupt alternations between opposing behavioral states. Sleep is punctuated frequently by brief periods of wakefulness, and dwell time distributions in sleep and wake states indicate that switching between them is a stochastic process (Lo et al., 2004). Sleep and wakefulness are controlled by mutually inhibitory brain-stem nuclei, implying a reciprocal inhibition motif. In a significant parallel to the effects of command neuron ablations on dwell times in C. elegans locomotion (Figure 5B), lesions of sleep-related nuclei simultaneously reduce the dwell times in both sleep and wake states, as do lesions of wakefulness nuclei (Saper et al., 2010). Thus the relationship between synaptic uncoupling of the circuit and changes in dwell times may be a general principle of reciprocal inhibition in stochastic neuronal networks. Further study of invertebrate models of this circuit motif would be a productive means of identifying the genetic and physiological underpinnings of such circuits.

The debut of the essentially complete wiring diagram of the C. elegans nervous system raised the prospect of the first account of the entire behavioral repertoire of an organism at single-neuron resolution (White et al., 1986; Varshney et al., 2011). To date, the repertoire of behaviors commonly recognized in C. elegans can be divided into three main functional categories, subsuming 23 different elementary actions (Faumont et al., 2012). Because the command neurons considered here are required for almost half of this repertoire, the Stochastic Switch Model is a significant step toward a comprehensive understanding of the neuronal basis of behavior in this animal, bringing us closer to the goal of computing the behavior of an entire organism. Though abstract by design in its representation of individual neurons and synapses, the model accommodates not only random search at multiple spatial scales (Figure 8), but also biased random walks (Figure 8—figure supplement 1) and deterministic escape behaviors (Figure 9). We propose, therefore, that the Stochastic Switch Model could serve as a multipurpose module for computing C. elegans behavior. Combining this mathematically tractable module with others representing sensory inputs, modulatory states, and the presumptive pattern generators for forward and reverse locomotion, could lead to essentially complete models of the C. elegans nervous system that are at once predictive and intuitively comprehensible (Abbott, 2008).

Materials and methods


All strains were cultivated at 22.5°C on low-density NGM (nematode growth medium) agar plates seeded with the E. coli bacteria (OP50) as described by Brenner (Brenner, 1974). Transgenic lines were made using standard protocols (Mello and Fire, 1995).

ExperimentFigureStrains and genotypes
Wild type1-8N2
AVA → AVB synaptic current5BXL238 ntIs[Prig-3::ChR2, Punc-122::dsRed]; ntIs35[Psra-11::tdTomato]; lite-1(ce314)
AVB → AVA synaptic current5CXL237 kyEx3801[Psra-11::ChR2::GFP, Punc-122::dsRed]; ntIs29[Pnmr-1::tdTomato]; lite-1(ce314)
AVA ablation4N2
AVD ablation4XL59 akIs [lin-15(+); Pnmr-1::GFP]
AVE ablation4XL59 akIs [lin-15(+); Pnmr-1::GFP]
AVB ablation4N2
PVC ablation4XL59 akIs [lin-15(+); Pnmr-1::GFP]
HYP A6DA572 eat-4(ad572)
HYP B6MT6308 eat-4(ky5)
HYP C6KP4 glr-1(n2461)
DEP A6VM1136 lin-15(n765); akIs9 [lin-15(+), Pglr-1::GLR-1(A/T)]
DEP B6VM188 lin-15(n765); akEx52[lin-15(+), Pnmr-1::GLR-1(A/T) ]
ASH → AVB synaptic current8XL194 ntIs27 [ Psra-6::ChR2::YFP, Punc-122::dsRed]; ntIs35 [Psra-11::tdTomato]; lite-1(ce314)
  1. Internal reference HYP A = HYP16, HYP B = HYP 56, HYP C = HYP20, DEP A = DEP14, DEP B = DEP19.

Physiological solutions

Request a detailed protocol

External saline for electrophysiology (mM): 5 KCl, 10 HEPES, 8 CaCl2, 143 NaCl, 30 glucose, pH 7.2 (NaOH); internal saline for electrophysiology (mM): 125K-gluconate, 1 CaCl2, 18 KCl, 4 NaCl, 1 MgCl2, 10 HEPES, 10 EGTA, pH 7.2 (KOH). Medium for behavioral assays (mM): NH4Cl 2, CaCl2 1, MgSO4 1, and KPO4 25, pH 6.5; M9 Buffer (grams): 3 KH2PO4, 6 Na2HPO4, 5 NaCl, 1 ml 1 M MgSO4, H2O to 1 liter.

Behavior and tracking system

Request a detailed protocol

Prior to each assay, an individual adult hermaphrodite was picked to a bacteria-free agar transfer plate by means of a platinum-wire pick. The worm was then washed in M9 to remove excess bacteria, then transferred in a pipette filled with assay medium to a 10 cm petri plate containing 1.7% agarose in assay medium. A black dot approximately 40 microns in diameter was applied to the center of the body as shown in Figure 1A (see Spotting procedure). The worm was allowed to recover from transfer and handling for 2 min., then recorded for 10 min. The assay plate rested on a motorized microscope stage (Applied Scientific Instrumentation MS-2000, Eugene, OR USA) fitted with position encoders (Gurely Precision Instruments LE-1800, Troy, NY USA) having a resolution of 0.5 μm. Behavior was recorded using an analog video camera (CCD Sony XC-ST70, 29.97 frames per second) fitted with a 12× zoom lens (Navitar 50486D, Rochester, NY USA). For tracking purposes, video was analyzed in real time by custom software to calculate the eccentricity of the ink spot relative to the center of the field of view, and to compute the stage movements required to re-center the spot. Motion blur was minimized by making stage speed during corrective movements an increasing exponential function of target eccentricity such that small corrections were made more slowly than large corrections. Position encoders were read in synchrony with the video stream and this information was stored for off-line analysis. The overall trajectory of the worm was computed by combining the location of the spot in the field of view with stage position in each video frame. The direction of movement (forward or reverse) at the start of each recording was keyed by the observer and subsequent assignments were made automatically by computer. Each recording was spot-checked for correct assignments at four or more points during the recording. In experiments involving neuronal ablations or genetic mutations, recordings of sham operated controls or wild type worms, respectively, were interleaved with worms in each treatment group.

Spotting procedure

Request a detailed protocol

The animal was immobilized by a stream of humidified CO2 emitted by a 1.5 mm diameter glass pipette positioned near the worm. The spotting ink was comprised of petroleum jelly (1 ml), mineral oil (1 ml), and black iron oxide (3 g). Ink was applied by means of 1.5 mm diameter glass rod that had been pulled to a fine point, fire polished to produce a bulbous tip, and dipped in the ink. The rod was positioned by means of a micromanipulator. To control for the effects of the spotting procedure, we compared the speed of locomotion of worms that had been immobilized, or immobilized and spotted, to untreated worms. There were no significant differences between these three groups.


Request a detailed protocol

Worms were glued to an agarose coated coverslip using cyanoacrylate adhesive as previously described (Lindsay et al., 2011). The coverslip formed the bottom of the recording chamber, which was filled with external saline. The cell body of the neuron to be recorded was exposed by making a small slit in the cuticle using a finely drawn glass rod. Recording pipettes had resistances of 10–20 MΩ when filled with internal saline. Voltage- and current-clamp recordings were made with a modified Axopatch 200A amplifier (Lockery and Goodman, 1998). In reversal potential measurements, recordings of photostimulation-evoked synaptic currents were filtered at 2 kHz and sampled at 10 kHz. Postsynaptic neurons (AVA, AVB) were identified using a combination of fluorescent markers and distinctive voltage clamp currents as described (Lindsay et al., 2011). Presynaptic neurons (AVA, AVB, and ASH) were activated by expression of ChannelRhodopsin-2 expressed under the control of neuron-specific promoters as described (see “Strains”). Worms were photostimulated in electrophysiological experiments using the blue channel (470 nm) of a dual-wavelength LED module (Rapp OptoElectronic, Wedel, Germany) that was focused by a 63×, 1.4 NA oil immersion objective lens (Zeiss, part number 440762–9904). Irradiance (12.5 mW/mm2) was determined by measuring the power emitted from the objective using an optical power meter placed above the front lens of the objective and dividing by the area of the field of illumination at the focal plane of the preparation.


Request a detailed protocol

Neurons were ablated using a laser as described previously (Bargmann and Avery, 1995). L1 larvae were mounted on 2.5% agarose pads containing 5–7 mM of the immobilizing agent NaN3. AVA and AVB neurons were ablated in N2 animals and identified by position. AVD, AVE and PVC were ablated in animals expressing nmr-1::GFP and identified by a combination of position and GFP expression. To limit potential behavioral differences in the two strains, we outcrossed (4×) the nmr-1::GFP strain to the N2 strain used for AVA and AVB ablations. All animals were remounted 1–3 hr after surgery to confirm the ablation; those with collateral damage were discarded. Sham-operated animals were treated in the same manner except that the laser was not fired.

Statistical tests

Request a detailed protocol

Statistical significance for the results shown in Figures 4B and 6C, and in Tables 4 and 6 were obtained using the likelihood ratio test (see Table 1 and 4 legends). Otherwise, two-tailed t-tests or 2-tailed Mann-Whitney U tests were used.

Descriptive statistics

The worm’s position in video frame k is represented as the row vector:

(6) R(tk)=xtk, ytk              k=1, 2, , N

where X(tk) and Y(tk) are the coordinates of centroid of the tracking spot in the frame of reference of the agar plate, tk=kΔt, t=33 ms, and N18000 is the number of video frames analyzed in a continuous recording of one worm. We made the following definitions:

Row vectors

Request a detailed protocol


(7) V(tk)= R(tk+1)R(tk) t


(8) H(tk)=V(tk)s(tk)

Scalar quantities

Request a detailed protocol


(9) s(tk)=Vtk=Vtk·Vttk            Vttranspose of V

Mean speed:

(10) s¯=1N-1k=1N-1stk

Instantaneous turn rate:

(11) φt (tk)=cos1Htk-1·Httkt            (0φπ)

Mean heading change:

(12) φ_____tj=1Nj1k=1Nj1cos1Htk+tj·Httk        (0φπ)

Speed autocovariance:

(13) As(tj)=1Nj1K=1Nj1(s(tk+tj)s¯)·(s(tk) -s¯)

Velocity autocorrelation:

(14) AV(tj)=1Nj1K=1Nj1V(tk+tj)·Vt(tk)

Heading autocorrelation:

(15) AH(tj)=1Nj1K=1Nj1H(tk+tj)·Ht(tk)

Mean squared displacement:

(16) r2___(tj)=1Nj1k=1Nj1 ||R(tk+tj)R(tk)||2

Maximum likelihood estimation of state transition rates in a hidden Markov model

Request a detailed protocol

To analyze locomotory states we converted the velocity vector, V(t), into a signed scalar quantity v(t) that represents the component of velocity in the direction of the worm’s track, with positive values indicating forward movement. We first smoothed x(t) and y(t) using an 11 frame window, assigned a direction to the smoothed track with respect to the head/tail orientation of the worm, and projected V(t) onto the smoothed track to obtain v(t). For each cohort of worms we collected all v(t) values into a single velocity distribution g(v). The central peak of g(v) was fit by a Cauchy distribution with median 0 and half-width b = 18 µm/s (Figure 2—figure supplement 2), which we used to approximate the pause velocity distribution for states X and Y for all worms:

(17) gX(v)=gY(v)=gP(v)=bπ(b2+v2) 

We used a Cauchy distribution because it has long tails that describe the pause velocity distribution better than a Gaussian distribution (i.e., the worm does not stop instantaneously when it switches from forward or reverse locomotion into one of the pause states). We estimated the forward and reverse velocity distributions gF(v) and gR(v) by scaling gP(v) to fit the peak at v=0, subtracting it from the overall distribution and splitting the remaining distribution into gF(v) for v>0 and gR(v) for v<0. Velocity distributions were scaled to be probability densities (area =1) and collected into a row vector:

(18) G(v)= [gF(v), gR(v),  gX(v),  gY(v)]

where gi(v) is the estimated probability density that worms move at velocity v when in state i.

The goal of the maximum likelihood fitting procedure is to find the set of state transition rates {aXF,aFX,aXR,aRX,aFY,aYF,aRY,aYR}that maximize the probability of the observed velocity time series v(t) given the velocity distribution G(v). All transition rates were constrained to be 0, and usually were additionally constrained to correspond to valid synaptic weights as described below. The likelihood is most conveniently calculated using matrix notation as follows; see Colquhoun and Hawkes, 1995 for a more complete explanation of these computations. Let:

(19) Q=(aFX+aFY)0aXFaYF0    (aRX+aRY)aXRaYRaFXaRX    (aXF+aXR)0aFYaRY0    (aYF+aYR)

Element qij (ij) of matrix Q is the transition rate from state i to state j (i.e., the instantaneous probability per unit time that the system in state i will make a transition to state j, and element qii is the negative of the total transition rate out of state i, which is related to the mean dwell time in state i by:

(20) di=1/qii

Matrix Q is composed of instantaneous transition rates, which can be converted into the matrix of transition probabilities during a brief time interval of duration ε by multiplying Q by ε and adding 1 to each diagonal element (i.e., by calculating ε·Q+I, where I is the 4×4 identity matrix). If ε is sufficiently small that multiple state transitions can be ignored, then element ij of matrix ε·Q+I is the probability that the system is in state j at the end of a time interval of duration ε given that it was in state i at the beginning of the interval. For longer time intervals during which multiple state transitions may occur, transition probabilities can be calculated by repeatedly multiplying matrix ε·Q+I by itself. Thus, if

(21) M=(ε·Q+I)K

then M is the matrix of transition probabilities during a time interval of duration Kε. If K and ε are chosen such that t=Kε, then element ij of matrix M is the transition probability from state i to state j during one video frame of duration t. We chose K=230 and let ε=t/K=30.7 picoseconds, a time interval during which multiple state transitions can safely be ignored. Since K was chosen to be a power of 2, M could be rapidly and accurately calculated by 30 serial multiplications using 64-bit floating point arithmetic.

Let P(t) be the row vector of history-dependent state probabilities:

(22) P(t)= [ pF(t), pR(t), pX(t),  pY(t)]

where pi(t) is the probability of being in state i at time t given v(u) for all u up to and including the present time (ut). The matrix product P(t)·M is the state probability vector at time t+t prior to accounting for the observed velocity at time t+t. To account for v(t+t) we used the information contained in G(v(t+t)) and applied Bayes theorem:

(23) P(t+t)=l·P(t)·M·diagG(v(t+t))

where diagG(v(t+t)) is the 4×4 matrix with the elements of G(v(t+t)) along the diagonal, and l is the scalar multiplicative factor required for the sum of the four elements of P(t+t) to equal 1 (i.e., P(t+t) is a vector of probabilities). Initially (t=0) we set P(0) equal to the steady-state probability vector P, which is given by:

(24) P·Q=0               P=U4·(Qa·Qat)1

where U4 is the 1×4 row vector of ones and Qa is the 4×5 matrix constructed by appending a column of ones to Q. To break the symmetry between the behaviorally indistinguishable states X and Y, we identified X as the state with higher steady-state probability.

We then calculated the log-likelihood, summed over all worms in the cohort:

(25) lnL=t,w ln(Pw(t)·Gt(vw(t)))

where VW(t) is the velocity and PW(t) is the history-dependent state probability vector of worm w at time t.

We used a random optimization algorithm to find the set of transition rates that maximized lnL. Initial guesses for 6 of the 8 rates were chosen independently from log uniform distribution between 0.01 Hz and 10 Hz. The remaining 2 rates were calculated to satisfy the constraints needed to generate valid synaptic weights (see below). At each iteration, each of the 6 independently chosen rates was altered by adding a random number chosen from a Cauchy distribution with median 0 and width brandom (initially brandom= 0.01 Hz), and the remaining 2 rates were recalculated. To avoid getting trapped in local likelihood maxima, the new rates were rejected and another set was calculated if any of the new rates were <0.01 Hz. If the new rates generated an increased likelihood, the new rates were accepted and brandom was increased by 3%. Otherwise the old rates were retained and brandom was decreased by 0.5%. The procedure was iterated until brandom< 0.001 Hz. The random optimization procedure was replicated 10 times for each cohort using different randomly chosen initial guesses. In 71% of the replicates the procedure converged on a set of transition rates in which none of the transition rates differed from the best set by more than 5%. The best set of transition rates was then refined by applying the optimization procedure using a success criterion of brandom< 10-5 and constraining transition rates to be ≥ 10–4 Hz.

The likelihood calculations described above use only past and present velocity observations to calculate P(t), but once the optimal transition rates were determined, the Forward-Backward algorithm (Rabiner and Juang, 1986) can be used to yield a better estimate of the state probabilities based on past, present and future velocity observations, and the Viterbi Algorithm can be used to find the sequence of states with the highest probability of producing the observed velocities (Figure 2E).

Stochastic model neurons

Request a detailed protocol

We expressed the effect of synaptic inputs to command units and by equations of the form:

(26) aON=A·eS
(27) aOFF=A·e-S

where aOFF is the transition rate from ON to OFF, aON is the transition rate from OFF to ON, and S is the total synaptic input to the unit. We do not attach any mechanistic significance to these equations, but note that they are analogous to the Arrhenius Equation (Stiller, 1989) an approximation commonly used to describe the rates of chemical reactions in terms of an activation energy, E:

(28) a=A·e- EkBT

where a is the reaction rate constant, A is an empirically determined constant, KB is the Boltzmann constant, and T is the absolute temperature. Under this interpretation, S is analogous to activation energy expressed in units of KBT. Thus, and are assumed to be symmetrical bi-stable units that change state at rate A when S=0. Deviations from this baseline condition are modelled as external synaptic inputs h and h.

We represented the total synaptic input onto units and , respectively, by:

(29) S=h+btw+btw
(30) S=h+btw+btw

where b(t) and b(t) are the states of and (1 = ON, 0 = OFF), W and W are the synaptic weights from onto and from onto , respectively, and W and W represent synaptic interactions among command neurons of the same class, plus any intrinsic membrane properties that may promote bistability. Applying these definitions to the rate constants in Figure 2C gives:

(31) aXF=A exp(h)                                          aXR=A exp(h)                              
(32) aFX=A exp(hw)                         aRX=A exp(hw)             
(33) aRY=A exp(h+w)                             aFY=A exp(h+w)                 
(34) aYR=A exp(hww)             aYF=A exp(hww)

In these experiments the sensory environment was kept constant (e.g., no chemical or temperature gradients). Therefore h and h were assumed to be constant. For simulations of chemotaxis h and h varied with position in the chemical gradient.

Equations 31–34 express the 8 transition rates in terms of 6 parameters and yield the following two constraints on the transition rates:

(35) aFX aXF = aRY  aYR                               aFY aYF=aRX aXR

The inverse relations between transition rates and synaptic parameters are:

(36) h=ln(aXF)lnA                              h =ln(aXR)lnA              
(37) w=ln(aRY/aXF)                                 w=ln(aFY/aXR)                  
(38) w=ln(aXF aFX)+2·lnA               w=ln(aXR aRX)+2·lnA

Derivation of the mean distance traveled during a forward run

Request a detailed protocol

The time series of the worm’s locomotory states can be divided into forward runs, during which the worm is in either the F or P state, and reverse runs, during which the worm is in either the R or P state. Forward runs always begin with an RPF transition and end with the next FPR transition, which marks the beginning of a reverse run. Thus forward runs and reverse runs occur in strict alternation, such that the number of forward runs equals the number of reverse runs.

Let mF denote the mean distance traveled during a single forward run, assuming that forward runs are straight. The value of mF is most easily calculated by dividing time into non-overlapping epochs, each of which begins with an RPF transition and ends immediately before the next RPF transition. Each epoch thus contains exactly one forward run, which includes all visits to state F during the epoch. Therefore, mF is also equal to the mean distance travelled while in the forward state during a single epoch:

(39) mF=vF¯pFfRPF

where V¯F is the mean velocity in the forward state and fRPF is the frequency of RPF transitions. Since FPR and RPF transitions occur in strict alternation they must occur in equal numbers: fRPF=fFPR. Thus, eq. 39 can also be written with fFPR in the denominator, which is more useful for the calculation that follows, although the form shown above is more directly interpreted in terms of the frequency of random reorientations, which occur at the RPF transitions. It is straightforward to calculate fFPR given pF, aFX, aFY, and the probabilities that the transitions out of states X and Y will be into state R:

(40) prob(XR)=aXR/(aXF+aXR)
(41) prob(YR)=aYR/(aYF+aYR)
(42) fFPR=pF(aFXaXRaXF+aXR+aFYaYRaYF+aYR)

Combining eqns. 39 and 42 yields:

(43) mF=vF¯ ((aXF+aXR)(aYF+aYR)aFXaXR(aYF+aYR)+aFYaYR(aXF+aXR))

An approximation to mF in terms of synaptic weights is obtained by noting that transitions from F to Y were extremely rare (aFY= 0.007 s-1; Table 1). Setting aFY0 yields:

(44) mFvF___(aXF+aXRaFXaXR)=vF___A(exp(h)+exp(h)exp(hhw))

Simulations of worm behavior

Request a detailed protocol

In Figure 8—figure supplement 1 and 2, the worm was represented as a point that moved forward or backward at speeds of 0.2 and 0.3 mm/sec, respectively, and was stationary during the pause state. Rate constants were calculated according to equations 31–34 based on the weights that pertain under random search or chemotaxis, using either Amin= or Amax=. Weights were used to compute the state transition matrix M. At each time step (∆t = 33 ms), the next state was selected randomly according to the state probabilities given by M. When an RPF transition occurred, a new direction of movement (heading) was selected from a uniform distribution. The random component of the heading was modeled as Gaussian noise having a standard deviation of 0.001 degrees. In the case of chemotaxis simulations, the values of h and h were updated at every time step according to the direction in which the worm was heading, leading to an updated set of weights and a new M matrix.

Definition of modes of random search in C. elegans

Request a detailed protocol

To date, these behaviors have been defined mainly in operational terms. Following the terminology of Jander (1975): (i) cropping is the locomotory behavior exhibited by well-fed worms on plates with densely populated patches of bacteria; (ii) local search (also “area restricted search” (Hills et al., 2004) or “pivoting” (Wakabayashi et al., 2004) is exhibited by well-fed worms within about 10 min after being transferred to a foodless plate; and (iii) ranging (“dispersal” (Gray et al., 2005) or “traveling” (Wakabayashi et al., 2004) is exhibited by well-fed worms tens of minutes after being transferred to a foodless plate. Each mode can be associated with approximate ranges of three parameters: mean forward run length (mF), mean frequency of reversals (fFPR), and mean reverse run length (mR). Local search serves as a useful reference point. During cropping, mF is greatly reduced, fFPR is greatly increased, and mR is also reduced, being limited to “short reversals” (the distance traveled in one or two head sweeps, or about 0.5 mm (Gray et al., 2005); during local search, reverse runs are almost always “long” (the distance traveled in at least three head sweeps). During ranging, mF is greatly increased, fRPF is reduced, and reversals are long. Cutoff values for search modes, inferred from behavioral data (Wakabayashi et al., 2004; Gray et al., 2005; Fujiwara et al., 2002; Hills et al., 2004) were: Dwelling – short forward run length (mF < 0.5 mm), high reversal frequency (fFPR > 6.0/min), short reversals (mR < 0.5 mm); Local search – moderate forward run length (0.5 mm ≤ mF < 5.0 mm), moderate reversal frequency (2.0/min ≤ fFPR < 6.0/min), non-short reversals (mR ≥ 0.5 mm); Ranging – long forward run length (mF ≥ 5.0 mm), low reversal frequency (fFPR< 2/min), non-short reversals (mR ≥ 0.5 mm).

Data archive

Request a detailed protocol

All data and the analysis program are publicly available at doi:10.5061/dryad.35qv6.

Data availability

The following data sets were generated
    1. Roberts WM
    2. Augustine SB
    3. Lawton KJ
    4. Lindsay TH
    5. Thiele TR
    6. Izquierdo E
    7. Faumont S
    8. Lindsay RA
    9. Britton MC
    10. Pokala N
    11. Bargmann CI
    12. Lockery SR
    (2016) Dryad Digital Repository
    Data from: A stochastic neuronal model predicts random search behaviors at multiple spatial scales in C. elegans.


    1. Böhm H
    2. Schildberger K
    Brain neurones involved in the control of walking in the cricket gryllus bimaculatus
    Journal of Experimental Biology 166:113–130.
  1. Book
    1. Boon JP
    2. Yip S
     Molecular Hydrodynamics
    Courier Dover Publications.
    1. Brenner S
    The genetics of Caenorhabditis elegans
    Genetics 77:71–94.
    1. Chalfie M
    2. Sulston JE
    3. White JG
    4. Southgate E
    5. Thomson JN
    6. Brenner S
    The neural circuit for touch sensitivity in Caenorhabditis elegans
    The Journal of Neuroscience 5:956–964.
    1. Deliagina TG
    2. Zelenin PV
    3. Fagerstedt P
    4. Grillner S
    5. Orlovsky GN
    Activity of reticulospinal neurons during locomotion in the freely behaving lamprey
    Journal of Neurophysiology 83:853–863.
    1. Gray J
    The mechanism of locomotion in snakes
    The Journal of Experimental Biology 23:101–120.
    1. Gray J
    Undulatory propulsion
    Quarterly Journal of Microscopical Science 3:551–578.
    1. Gray J
    2. Lissmann HW
    The locomotion of nematodes
    The Journal of Experimental Biology 41:135–154.
    1. Gray JM
    2. Hill JJ
    3. Bargmann CI
    (2005) A circuit for navigation in Caenorhabditis elegans
    Proceedings of the National Academy of Sciences of the United States of America 102:3184–3191.
    1. Harvey SC
    (2009) Non-dauer larval dispersal in caenorhabditis elegans
    Journal of Experimental Zoology Part B: Molecular and Developmental Evolution 312B:224–230.
    1. Hedwig B
    Control of cricket stridulation by a command neuron: efficacy depends on the behavioral state
    Journal of Neurophysiology 83:712–722.
    1. Hopfield JJ
    (1982) Neural networks and physical systems with emergent collective computational abilities
    Proceedings of the National Academy of Sciences of the United States of America 79:2554–2558.
    1. Pierce-Shimomura JT
    2. Morse TM
    3. Lockery SR
    The fundamental role of pirouettes in Caenorhabditis elegans chemotaxis
    The Journal of Neuroscience 19:9557–9569.
    1. Ryu WS
    2. Samuel AD
    Thermotaxis in Caenorhabditis elegans analyzed by measuring responses to defined Thermal stimuli
    The Journal of Neuroscience 22:5727–5733.
  2. Book
    1. Stiller W
    Arrhenius Equation and Non-Equilibrium Kinetics: 100 Years Arrhenius Equation
    BSB BG Teubner.
  3. Book
    1. Viswanathan GM
    The Physics of Foraging: An Introduction to Random Searches and Biological Encounters
    Cambridge University Press.
    1. Weeks JC
    2. Kristan WB
    Initiation maintenance and modulation of swimming in the medicinal leech by the activity of a single neurone
    The Journal of Experimental Biology 77:71–88.
    1. Wicks SR
    2. Roehrig CJ
    3. Rankin CH
    A dynamic network simulation of the nematode tap withdrawal circuit: predictions concerning synaptic function using behavioral criteria
    The Journal of Neuroscience 16:4017–4031.
    1. Zhao B
    2. Khare P
    3. Feldman L
    4. Dent JA
    Reversal frequency in Caenorhabditis elegans represents an integrated response to the state of the animal and its environment
    The Journal of Neuroscience 23:5319–5328.

Article and author information

Author details

  1. William M Roberts

    Institute of Neuroscience, University of Oregon, Eugene, United States
    Modeling, Conception and design, Analysis and interpretation of data, Drafting or revising the article
    Competing interests
    No competing interests declared
  2. Steven B Augustine

    School of Nursing, University of Pennsylvania, Philadelphia, United States
    Design and construction of tracking system, Acquisition of data
    Contributed equally with
    Kristy J Lawton, Theodore H Lindsay and Tod R Thiele
    Competing interests
    No competing interests declared
  3. Kristy J Lawton

    Biology Department, Reed College, Portland, United States
    Behavior, Acquisition of data
    Contributed equally with
    Steven B Augustine, Theodore H Lindsay and Tod R Thiele
    Competing interests
    No competing interests declared
  4. Theodore H Lindsay

    Division of Biology and Biological Engineering, California Institute of Technology, Pasadena, United States
    Electrophysiology, Acquisition of data
    Contributed equally with
    Steven B Augustine, Kristy J Lawton and Tod R Thiele
    Competing interests
    No competing interests declared
  5. Tod R Thiele

    Department of Biological Sciences, University of Toronto, Toronto, Canada
    Neuronal ablations, Acquisition of data
    Contributed equally with
    Steven B Augustine, Kristy J Lawton and Theodore H Lindsay
    Competing interests
    No competing interests declared
  6. Eduardo J Izquierdo

    Cognitive Science Program, Indiana University, Bloomington, United States
    Chemotaxis simulations, Analysis and interpretation of data
    Competing interests
    No competing interests declared
  7. Serge Faumont

    Institute of Neuroscience, University of Oregon, Eugene, United States
    Spotted worm tracking method, Acquisition of data
    Competing interests
    No competing interests declared
  8. Rebecca A Lindsay

    Department of Ophthalmology, The Vision Center, Children's Hospital Los Angeles, Los Angeles, United States
    Behavior, Acquisition of data
    Competing interests
    No competing interests declared
  9. Matthew Cale Britton

    Department of Neurology, University of Minnesota, Minneapolis, United States
    Behavior, Acquisition of data
    Competing interests
    No competing interests declared
  10. Navin Pokala

    Department of Life Sciences, New York Institute of Technology, Old Westbury, United States
    Molecular biology, Contributed unpublished essential data or reagents
    Competing interests
    No competing interests declared
  11. Cornelia I Bargmann

    Howard Hughes Medical Institute, Rockefeller University, New York, United States
    Molecular biology, Contributed unpublished essential data or reagents
    Competing interests
    No competing interests declared
    ORCID icon "This ORCID iD identifies the author of this article:" 0000-0002-8484-0618
  12. Shawn R Lockery

    Institute of Neuroscience, University of Oregon, Eugene, United States
    Modeling, Conception and design, Acquisition of data, Analysis and interpretation of data, Drafting or revising the article
    For correspondence
    Competing interests
    No competing interests declared
    ORCID icon "This ORCID iD identifies the author of this article:" 0000-0001-8535-7989


National Institutes of Health (RO1 MH051383)

  • Steven B Augustine
  • Kristy J Lawton
  • Theodore H Lindsay
  • Tod R Thiele
  • Serge Faumont
  • Rebecca A Lindsay
  • Matthew Cale Britton

The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.


This research was supported by a grant MH051383 from the National Institute of Mental Health to SRL.

Version history

  1. Received: October 26, 2015
  2. Accepted: January 19, 2016
  3. Accepted Manuscript published: January 29, 2016 (version 1)
  4. Version of Record published: March 8, 2016 (version 2)
  5. Version of Record updated: October 11, 2018 (version 3)


© 2016, Roberts 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.


  • 6,061
    Page views
  • 1,316
  • 64

Article citation count generated by polling the highest count across the following sources: Crossref, PubMed Central, Scopus.

Download links

A two-part list of links to download the article, or parts of the article, in various formats.

Downloads (link to download the article as PDF)

Open citations (links to open the citations from this article in various online reference manager services)

Cite this article (links to download the citations from this article in formats compatible with various reference manager tools)

  1. William M Roberts
  2. Steven B Augustine
  3. Kristy J Lawton
  4. Theodore H Lindsay
  5. Tod R Thiele
  6. Eduardo J Izquierdo
  7. Serge Faumont
  8. Rebecca A Lindsay
  9. Matthew Cale Britton
  10. Navin Pokala
  11. Cornelia I Bargmann
  12. Shawn R Lockery
A stochastic neuronal model predicts random search behaviors at multiple spatial scales in C. elegans
eLife 5:e12572.

Share this article


Further reading

    1. Computational and Systems Biology
    2. Neuroscience
    Domingos Leite de Castro, Miguel Aroso ... Paulo Aguiar
    Research Article Updated

    Closed-loop neuronal stimulation has a strong therapeutic potential for neurological disorders such as Parkinson’s disease. However, at the moment, standard stimulation protocols rely on continuous open-loop stimulation and the design of adaptive controllers is an active field of research. Delayed feedback control (DFC), a popular method used to control chaotic systems, has been proposed as a closed-loop technique for desynchronisation of neuronal populations but, so far, was only tested in computational studies. We implement DFC for the first time in neuronal populations and access its efficacy in disrupting unwanted neuronal oscillations. To analyse in detail the performance of this activity control algorithm, we used specialised in vitro platforms with high spatiotemporal monitoring/stimulating capabilities. We show that the conventional DFC in fact worsens the neuronal population oscillatory behaviour, which was never reported before. Conversely, we present an improved control algorithm, adaptive DFC (aDFC), which monitors the ongoing oscillation periodicity and self-tunes accordingly. aDFC effectively disrupts collective neuronal oscillations restoring a more physiological state. Overall, these results support aDFC as a better candidate for therapeutic closed-loop brain stimulation.

    1. Cancer Biology
    2. Computational and Systems Biology
    Sara Latini, Veronica Venafra ... Francesca Sacco
    Research Article

    Currently, the identification of patient-specific therapies in cancer is mainly informed by personalized genomic analysis. In the setting of acute myeloid leukemia (AML), patient-drug treatment matching fails in a subset of patients harboring atypical internal tandem duplications (ITDs) in the tyrosine kinase domain of the FLT3 gene. To address this unmet medical need, here we develop a systems-based strategy that integrates multiparametric analysis of crucial signaling pathways, and patient-specific genomic and transcriptomic data with a prior knowledge signaling network using a Boolean-based formalism. By this approach, we derive personalized predictive models describing the signaling landscape of AML FLT3-ITD positive cell lines and patients. These models enable us to derive mechanistic insight into drug resistance mechanisms and suggest novel opportunities for combinatorial treatments. Interestingly, our analysis reveals that the JNK kinase pathway plays a crucial role in the tyrosine kinase inhibitor response of FLT3-ITD cells through cell cycle regulation. Finally, our work shows that patient-specific logic models have the potential to inform precision medicine approaches.