Sensorimotor integration in Caenorhabditis elegans: a reappraisal towards dynamic and distributed computations

The nematode Caenorhabditis elegans is a tractable model system to study locomotion, sensory navigation and decision-making. In its natural habitat, it is thought to navigate complex multisensory environments in order to find food and mating partners, while avoiding threats like predators or toxic environments. While research in past decades has shed much light on the functions and mechanisms of selected sensory neurons, we are just at the brink of understanding how sensory information is integrated by interneuron circuits for action selection in the worm. Recent technological advances have enabled whole-brain Ca2+ imaging and Ca2+ imaging of neuronal activity in freely moving worms. A common principle emerging across multiple studies is that most interneuron activities are tightly coupled to the worm's instantaneous behaviour; notably, these observations encompass neurons receiving direct sensory neuron inputs. The new findings suggest that in the C. elegans brain, sensory and motor representations are integrated already at the uppermost sensory processing layers. Moreover, these results challenge a perhaps more intuitive view of sequential feed-forward sensory pathways that converge onto premotor interneurons and motor neurons. We propose that sensorimotor integration occurs rather in a distributed dynamical fashion. In this perspective article, we will explore this view, discuss the challenges and implications of these discoveries on the interpretation and design of neural activity experiments, and discuss possible functions. Furthermore, we will discuss the broader context of similar findings in fruit flies and rodents, which suggest generalizable principles that can be learnt from this amenable nematode model organism. This article is part of a discussion meeting issue ‘Connectome to behaviour: modelling C. elegans at cellular resolution’.


Introduction
More than three decades ago, the first complete connectome of a nervous system was published in this journal [1]. The Caenorhabditis elegans connectome provided some immediate insights into sensorimotor behaviour in the worm [2]. For example, most neurons could be classified as either sensory neurons (those with specialized sensory endings), motor neurons (those with neuromuscular junctions) or interneurons (those lacking both sensory and motor features). Motor neurons could be further subdivided into classes targeting head or body muscles. Five premotor interneurons appeared to be network hubs, receiving a large amount of inputs from sensory circuits and representing a bottleneck for the outputs to body motor neurons. 1 Many studies have since confirmed a primary role for premotor interneurons in locomotion [3][4][5]. These immediate insights allowed for one particularly tantalizing prediction: the computational rules underlying sensorimotor behaviour, from single-cue chemotaxis to multisensory integration, must be implemented somewhere in the dense connectivity of interneurons bridging sensory input and motor output.
Subsequent studies supported the predicted importance of interneurons. Many interneurons were shown, by genetics and laser ablation, to be required for chemotaxis to various sensory cues [6][7][8]. Depending on the sensory cue, a minimal circuit could be drawn consisting of a handful of neurons and connections [6][7][8][9]. For example, a connectome analysis by Gray et al. [9] identified two separate layers of interneurons between sensory input and motor output. This suggested a sequential computational strategy in which sensory information from multiple cues is integrated in four first-layer interneurons, which then send some ( perhaps transformed) output of the sensory information to three second-layer interneurons; these interneurons finally synapse onto head motor neurons and the premotor hub interneurons to instruct behaviour. This flow of sensorimotor transformation is schematically shown in figure 1a. All that remained to be shown was how sensory information, in the form of neural activity, flows through and is transformed by this small group of interneurons.
Such a detailed understanding of sensorimotor behaviour appeared within reach with the advent of calcium imaging more than one decade ago. Results so far, however, have been puzzling. Promisingly, controlled delivery of sensory stimuli to immobilized worms revealed a transfer of olfactory [10][11][12], gustatory [13,14], thermosensory [15] and gas [16] stimulus information to first-layer interneurons. However, in other studies, calcium imaging in freely moving animals revealed that these same neurons' activities are tightly coupled to the worm's instantaneous behaviour [17][18][19][20]. Remarkably, such strong relationships between interneuron activity and instantaneous behaviour were soon observed, by several groups, for all of the aforementioned interneurons. While this relationship was expected for premotor interneurons, both first-and second-layer interneuron activities were also shown to be tightly coupled to various behavioural parameters like direction, speed of locomotion or head posture. Importantly, all these behaviour-activity relationships were found in animals not presented with a sensory stimulus. Collectively, these studies showed that the worm's interneurons do not wait quietly for sensory inputs and subsequently pass the output of their computations onto the next layer. Rather, interneuron activity is extremely dynamic; sensory inputs must somehow be integrated into these ongoing dynamics, in many cases already at the first synapse [19,20].
For the majority of these interneurons, behaviourcorrelated activities were shown not to be solely proprioceptive and are therefore best understood as representing motor command signals. This interpretation comes from recordings in immobilized animals, in which interneuron (and motor neuron) activities were dynamic and coordinated among each other, and neurons co-active in these recordings were active in the same motor state in freely moving animals with rare exception [20]. In freely moving animals, activity in these neurons exhibited a nearly one-to-one relationship with behaviour [20]. We therefore refer to all such activity as reflecting motor command signals, which can be generated in immobilized animals presumably in an attempt to move. We further distinguish low-level motor command signals, which directly encode body posture, from high-level motor commands, which rather command longer lasting behavioural states (e.g. forward or reverse locomotion) or movement parameters (e.g. locomotion speed), but do not consist of signals patterned for coordinated muscle contraction. For example, activity of the interneuron RIB is correlated with the animal's forward locomotion speed [18,20]; this information has to be transformed by motor neurons into oscillatory activity controlling the animal's body undulation at the commanded speed. While RIB activity encodes a high-level representation of speed, motor neurons generate the corresponding low-level motor commands. With the exception of one interneuron,  How, then, do sensory inputs affect ongoing motor-related interneuron dynamics? In the following sections, we will explore this question. We will focus on how sensory inputs bias reversal probability, a fundamental behavioural strategy underlying worm chemotaxis [21]. In box 1 and box 2, we illuminate how these recent findings affect experimental design and the interpretation of results. In the next section, we integrate findings in the recent literature that call for an updated model for sensorimotor computations in C. elegans. We then discuss new non-mutually exclusive hypotheses raised by these recent discoveries. Specifically, we suggest that these motor representations could serve sensory gain control by behavioural state and/or forward internal models for precise motor control. We also put these findings in the larger context of sensorimotor integration in other species. Similar 'early' representations of motor state have been found in fruit flies and in mammalian cortical primary sensory areas. Combined with the discovery of population dynamics in the recurrent network underlying C. elegans behaviour, these observations suggest a great potential to learn generalizable principles from this model organism. Box 1. Interneuron activity is more strongly correlated to behaviour than to sensory input.
The finding that many interneurons' activities show tight coupling to the worm's instantaneous motor state has major implications for interpreting sensory responses. Here, we illustrate these implications using AVA interneuron activity and O 2 shifts as an example. AVA activity was recorded in freely moving animals during six consecutive 30 s switches between 4% O 2 and 21% O 2 [20]. During high O 2 periods, animals reverse more than during low O 2 periods [20]. Trial averaging AVA responses across stimuli and worms revealed a rise in AVA activity upon O 2 upshift (a, average + STD, n ¼ 36 shifts across six animals). This suggests that AVA is part of the sensorimotor pathway leading to reversal frequency modulation by this stimulus. However, AVA shows spontaneous activity changes in both freely moving and immobilized animals regardless of O 2 levels [20]; in moving worms, AVA activity rises correlate exclusively and reliably with reversal events [4,20,23 -26]. Indeed, trigger averaging AVA activity to reversal onset during the 21% O 2 period (b, grey shows 10th -90th percentiles, n ¼ 136 reversals from six animals) revealed a much stronger modulation of AVA activity by behaviour than by sensory stimulus (compare a and b, same y-axis scale).
An example trace in (c) shows two consecutive O 2 shifts (t ¼ 5 s and t ¼ 65 s). Here, we see that the trial average in (a) is misleading: in single trials, reversal neurons such as AVA do not show a long-lasting rise in activity but rather an increased probability of high activity states, corresponding to the increased probability of reversals. Furthermore, AVA upshift response varies in onset timing, slope, amplitude and secondary peak number; all of this variation is explained by variation in reversal behaviour events [20]. Still, O 2 levels modulate reversal probability, such that, on average, an AVA rise in response to O 2 upshift can be observed. Because many interneurons show similarly tight behaviour coupling (see the main text), the pitfalls in this example hold true across other interneurons and stimuli. Recordings in immobilized animals are even more susceptible to these caveats due to the lack of concurrent behaviour recording and longer timescales of spontaneous activity changes (see box 2). rstb.royalsocietypublishing.org Phil. Trans. R. Soc. B 373: 20170371 Box 2. Analysing interneuron activity responses to sensory stimulation.
Recent findings from several laboratories have shown that the vast majority of interneurons exhibit spontaneous activity changes in the absence of acute sensory inputs, in both freely moving and immobilized animals. If interneuron activity is dynamic, how do we assess the impact of sensory stimulation on these ongoing activities? Here, we propose three steps that should be taken to analyse such data. We go through these steps with an example, ultimately showing that they can lead to clearer, more mechanistic interpretations of interneuron sensory responses. We focus on a single interneuron and stimulus, but these steps generally suffice for most interneurons and stimulus paradigms.
Step 1: Record long pre-stimulus periods to characterize spontaneous activity changes and pre-stimulus activity state. We recorded GCaMP signals from interneuron AVA from each animal for a total of 12 min. The worms were paralysed and immobilized in a microfluidic device to allow controlled isoamyl alcohol (IAA) delivery [10]. After a 6 min pre-stimulus period, we presented six consecutive 30 s -on, 30 s -off IAA stimulations to the worm's nose. (i) Trigger-averaged AVA activity (+s.e.m.) in response to either IAA-offset (red) or control buffer-offset (black) at t ¼ 10 s. Control buffer switches were performed in a separate set of animals to ensure that any activity responses are not due to pressure changes in the laminar flow device. (ii and iii) Single trials (n ¼ 36 shifts across six animals for each condition). Statistically significant differences for the period shown by the green bars were calculated by a resampling procedure (Material and methods).
On average, AVA activity rises in response to IAA-off but not control buffer-off. However, panels (ii) and (iii) show that only about half of all animals responded. Most importantly, note the different pre-stimulus activity levels across trials within each condition: AVA responses are observed only for trials in which AVA activity was low at the time of stimulation. As discussed below, this result is crucial for understanding AVA sensory responses. Recording AVA activity for 6 min prior to the first stimulus allowed us to capture any spontaneous activity changes and measure the neuron's activity state at the time of stimulation, which clearly differed across trials. This difference is hidden if F 0 is calculated from only the 10 s pre-stimulus period or only the stimulus window, rather than from the entire recording including the 6 min pre-stimulus period. Here, we calculate F 0 from the neuron's natural Low state (Material and methods). Because many interneurons show spontaneous activity changes (see the main text), such long pre-stimulus recording periods are essential to (i) measure and report any spontaneous activity changes in the absence of acute sensory stimulation and (ii) determine the neuron's activity state at the time of stimulation.
(b) Step 2: Separate trials depending on neuron activity state at the time of stimulation and compare with control non-stimulated trials in the same state.
The same analysis as in (a) with trials separated depending on whether the stimulus arrived when AVA was in a High activity state (i) or in a Low activity state (ii). Kato et al. [20] and Gordus et al. [58] showed that AVA activity is bi-stable (see Material and methods for state classification). Colour bar in (a) applies to these panels.
This analysis revealed that if AVA is in a High activity state at the time of IAA-off, no response is observed (i). This is probably due to AVA's bi-stability: if AVA is already in a High state, it cannot rise further upon IAA-off. By contrast, if AVA is in a Low activity state pre-stimulus (ii), activity rises upon IAA-off much more compared with control buffer-off, because rises are observed in a higher fraction of animals.
This analysis is crucial, because AVA Low controls also show, on average, a spontaneous rise on the same timescale as do stimulated animals. We confirmed that AVA rises upon control buffer-off were indeed spontaneous, i.e. not induced by pressure change upon buffer switch, as the same change is observed during the pre-stimulus periods lacking buffer switches (data not shown). Furthermore, we can conclude that AVA response is, in fact, not very variable once pre-stimulus state is taken into account (80% responders in b(ii), versus 50% responders in a). These data lead to a new interpretation of IAA-off responses: High-state AVA does not appear to respond to this stimulus, while Low-state AVA responds reliably. Based on recent observations, a new big picture is emerging for how the worm brain could perform computations and generate decisions based on the sensory inputs it receives. In previous work, many researchers have made the reasonably assumption that information flow from sensory to motor circuits is largely segregated and feed-forward. In such a model, changes in the environment are detected by sensory neurons and then transmitted to first-and second-layer interneurons, which potentially perform specialized computations on their inputs. For example, the sensory neuron AWA detects the odour diacetyl and signals to the first-layer interneuron AIA. While AWA is sensitive to diacetyl concentration and stimulus history, AIA filters this information and reports only the qualitative change (increase) in odour concentration [12]. In a different study, the first-layer interneuron AIY was shown to invert the sensory polarity of the odour-OFF neuron AWC into an odour-ON response in AIY. In contrast to AIY, first-layer interneuron AIB computes a temporally prolonged OFF response from AWC's input [10]. Both studies were performed in immobilized worms. The most intuitive conclusion from these studies was that dedicated first-layer interneurons perform computations on each sensory input; these interneurons then output transformed sensory information to premotor interneurons to ultimately control the animals' reorientation rate. Reversals are a major component of these reorientation manoeuvres; hence, the premotor interneuron AVA is the most prominent candidate to integrate the output of first-and second-layer interneuron computations. The hub neuron AVA is a bottleneck in the connectome, forming most of the chemical and electrical synapses onto A-class motor neurons [1,27], which execute the movements for reversals. Consistent with a premotor interneuron role, several studies showed that AVA activity in moving animals is tightly positively coupled to the reversal motor state [4,20,[23][24][25][26]. Taken together, these studies suggested a feed-forward organization, with segregated circuits for stepwise sensory information processing (first-and second-layer interneurons) and motor command generation ( premotor interneurons and motor neurons).
The first challenge to this interpretation was posed by calcium imaging experiments of primary sensory interneurons in freely crawling worms: surprisingly, all first-and secondlayer interneurons mentioned above are strongly modulated by motor state. In freely moving animals, AIY shows activity changes in the absence of acute odorant stimulations. Here, AIY activity is correlated with the speed of forward locomotion and remains low or suppressed during reversal episodes [18]. These relationships between AIY activity and behaviour were observed as well in the presence of sensory input, when animals freely navigated salt gradients [19]. Also, AIA was found to be negatively modulated by reversal state; this modulation was preserved in the presence of a strong oxygen sensory stimulus [26]. In contrast to AIY and AIA, AIB interneurons are strongly positively coupled to the reversal state [19,20,26]; again, this activity -behaviour relationship is preserved in salt gradients [19] and under different oxygen conditions [26]. In addition, low amplitude calcium transients of AIB activity coincide with transient slowing manoeuvres during forward locomotion [20]; a fraction of these events then transit into reversals, which is when the highest amplitude signals in AIB can be observed [20]. Strikingly, high-amplitude calcium transients in AIB were coupled to reversals as reliably as activity of the premotor (c) Step 3: Convert activity changes to state probabilities to reveal how the stimulus affects behavioural state. Many interneurons have been characterized to belong to either a forward or reverse command state ensemble (see the main text). For these neurons, the instantaneous brain-wide motor command state can be read out from the neuron's activity in a binary manner: for AVA, Rise and High correspond to reverse command state and Fall and Low correspond to forward command state [20]. For the AVA Low pre-stimulus trials, we binarized AVA activity according to these command states (Material and methods) and plotted the instantaneous probability of Rise þ High states across trials (i). Panels (ii) and (iii) show rasters, with black corresponding to reversal command (Rise or High) state.
From this figure, we can read out that 80% of animals in a forward state respond to this stimulus by entering the reversal command state, whereas the spontaneous reversal command state probability seen in control recordings is only 40%. Importantly, this analysis highlights that the increased response amplitude in IAA-off in (b) can be accounted for by an increased response probability across trials rather than an increased response amplitude within each trial. These figures can be compared directly with recordings in freely moving animals to determine whether the immobilized preparation shows a successful sensorimotor transformation that can be further explored [20].
For an interneuron showing spontaneous activity changes that have not been as thoroughly characterized as AVAs, recordings made in freely moving animals can be used to link spontaneous activity to behaviour. An alternative is to record activity in immobilized animals while co-recording a well-characterized neuron like AVA to determine participation in shared motor command states.
Once these analyses have been performed, a further step is to assess whether sensory input impacts the behaviour-related activity of the neuron beyond biasing transition probabilities. If recordings are performed in immobilized animals, ideally several neurons are co-recorded, so that changes in correlations between interneurons can be assessed. In freely moving animals, it is important to quantify behaviour carefully to determine the full scope of interneuron activity correlations to behaviour. For example, AVA and AVE neurons show subtle but significant modulations in their activity slope or peak, respectively, depending on reversal speed [20]. Any stimulus that causes animals to perform slower reversals, such as O 2 downshift, will lead to smaller AVA slopes and AVE peaks, results that might be misinterpreted as changes in these neurons' activities independent from their behaviour-related activities. On the other hand, careful quantifications might reveal a change in the relationship between interneuron activity and behaviour specifically due to sensory input, which might hint at a mechanism for sensorimotor integration (see the main text).
The second line of evidence suggesting a distributed rather than segregated representation of motor behaviours in C. elegans came from brain-wide calcium imaging experiments. In these experiments, worms are immobilized by muscle paralysis and confined to microfluidic channels; in the absence of both movement and experimentally induced acute sensory stimuli, surprisingly, about one-fourth of all measured head ganglia neurons are engaged in vigorous activity [20,28,29,37]. Currently, we assume that these activities are spontaneous, i.e. not triggered by transient sensory inputs. However, it is possible that dynamics are driven by tonic sensory neuron activity. For example, the confinement condition itself could represent a constant arousing stimulus. One has to keep further in mind that it might be practically impossible to perform such experiments under perfectly isotropic and constant conditions. Strikingly, most of these presumably spontaneous network activities were, however, highly structured across the neuronal population. Many interneurons, a set of head motor neurons, and body motor neurons in the retrovesicular ganglion exhibit coordinated collective network activity: AVB and RIB interneurons, SIA/B and RME head motor neurons and B-class motor neurons form a synchronized ensemble that activates in an antagonistic fashion to another ensemble of AVA, AVE, RIM and AIB interneurons along with A-class motor neurons. Transitions between these ensemble activities coincide with transient activations of RIV, SMDV and SMDD 2 head motor neurons. Similar brain-wide correlations involving the aforementioned neuronal classes could be confirmed by pan neuronal calcium imaging in freely crawling animals [30,31], demonstrating that correlated brain-wide dynamics are not specific to the immobilized preparation. However, we described some qualitative differences in neuronal activity comparing freely moving with paralyzed worms [20], which will be discussed further below. The activity of most of these neurons can be subdivided into four discrete states, through which they cycle: Low, Rise, High and Fall [20]. Moreover, some neurons, primarily those of the AVB ensemble, exhibit fluctuating calcium levels during their high states. Representative neurons participating in brain dynamics were imaged in freely moving animals systematically; these data showed that these neurons encode behavioural states with a near-perfect reliability, comparable to the classical premotor interneurons: AVB ensemble High-state fluctuations correspond to changes in crawling speed during forward locomotion, while during reverse movement, these neurons are in the Low state and AVA ensemble neurons are in Rise or High states [20]. Computational analysis of brain-wide activity recordings showed that brain activity is bound by a low-dimensional attractor manifold, which can be visualized by principal components analysis (PCA) (figure 2). PCA reveals a neural state trajectory that recurrently revisits the same sub-regions, which correspond to particular neuronal ensemble activity patterns that are repeated in a cyclical fashion over time in a single recording (figure 2). The aforementioned calcium imaging recordings in freely moving worms enabled the assignment of a motor command to each sub-region, such that the cyclical progression of ensemble activities determines the cycle Forward crawling-Forward Slowing-Reverse crawling-Dorsal or Ventral turn-Forward crawling. Hence, the attractor manifold is a neuronal representation of the worm's major action cycle [20] (figure 2).
In summary, the motor command activities of the classical premotor interneurons are only a small part of globally distributed network states that also reliably recruit first-and secondlayer interneurons such as AIB and RIB, along with motor neuron outputs. This finding calls for a major reappraisal of earlier results. However, first, we have to consider some caveats. First, there are cases where modulation of calcium transients does not follow modulation of membrane potential [32,33]. Second, the calcium transients in AIY, AIA and AIZ are typically measured in neurites [10][11][12]15,18], and hence could not be detected in brain-wide recordings of nuclear-localized calcium indicators (though, note that one study reported nuclear calcium signals in AIY [34]). It therefore remains to be shown whether AIY, AIA and AIZ are additional members of the motor command ensembles. Alternatively, behaviour-correlated activities in these neurons could result from proprioceptive feedback as a direct consequence of movement and thus be non-observable in immobilized worms. This question should be addressed in any future experiment examining these neurons side by side in immobilized and freely moving animals (box 2).
Could behaviour-related signals in first-and second-layer interneurons in immobilized or moving animals be a consequence of pure feedback (i.e. efference copy) from premotor interneurons or others driving the motor state? Two different results suggest that feedback cannot be the only purpose of this activity. First, when premotor interneuron AVA was inhibited via a histamine-gated chloride channel, preventing animals from executing reversals [20,35], the attractor manifold was remarkably robust to this manipulation: other neurons of the reversal ensemble still generated the reversal command in a manner almost indistinguishable from unperturbed animals, and only the transmission of this command information to motor neurons was affected. As a result, freely moving worms interrupt the action cycle during reverse command  Figure 2. Phase plot of the first two principal components (PCs) of an 18 min long C. elegans brain-wide calcium imaging dataset from Kato et al. [20]. Activity of a subset of neurons with known motor output allows classification of brain state into different motor command states: forward, forward slowing, three reversal states, as well as ventral and dorsal turns (see [20]). These brain states are colour-coded, and schematics of the movements are shown. The brain state is continuously changing; the direction of brain state time evolution is shown by dashed arrows. Note that the manifold assembles individual behavioural commands into the major action sequence of the worm; moreover, discrete transitions between behavioural command states are embedded in a smooth progression of brain state. rstb.royalsocietypublishing.org Phil. Trans. R. Soc. B 373: 20170371 states and they freeze instead of reversing; however, the brain still attempts to execute the reversal [20]. A second piece of evidence suggesting that first-and second-layer interneuron behaviour-related activities act as command signals is the robustness with which their manipulation affects behaviour. For example, AIB and AIZ ablation greatly reduces reversal frequency [9,18] while activation of these neurons triggers reversals [17,18,36]. The opposite effects have been found when activating AIY and RIB [18]. Altogether, these data suggest that motor commands are generated in a distributed, brain-wide manner that includes first-layer classical 'primary sensory' interneurons ( figure 1b).
The global brain dynamics representing motor commands were surprisingly robust to sensory inputs. Strong oxygen stimuli, switches between 4 and 21% oxygen, did not alter the relationship between interneuron activity and global motor command states. Hence, the shape of the attractor manifold was largely unaffected. However, an effective sensory to motor transformation was observed, as the stimuli entrained the instantaneous phase on the action command cycle: the reverse motor command state occurred with increased or decreased probabilities at high versus low oxygen, respectively [20,37]. These observations were surprising, because oxygen sensory neurons directly synapse onto AVA, AVE and RIB, which still show strong motor command signals but lacked purely sensory evoked activity patterns; these neurons, in fact, together receive a large portion of synaptic output from O 2 sensory neurons. Moreover, only a few sensory-tuned interneurons were observed in these recordings: RIG reported in [20] and AUA and RMG reported in [37]. Calcium imaging of AVA, AVE and RIB in freely moving animals exposed to oxygen shifts confirmed that these neuronal classes retain their strict tuning to motor state under stimulus conditions [20] (box 1). These results showed that the attractor manifold is largely robust to sensory stimulation. Similar preserved behaviour-correlated interneuron activities were observed in freely moving animals, during salt gradient navigation [19] and in other neurons in different oxygen environments [26], despite effective sensory-induced changes in behaviour in both studies. In other words, sensory inputs trigger, in a probabilistic manner, pre-patterned network activity that is nearly indistinguishable from spontaneous activity.
It remains to be shown whether these features hold when worms are presented with more complex multisensory inputs, or engaged in behaviours other than the aforementioned action cycle such as mating [38] or nictation [39]. Moreover, it is still unclear to what extent the manifold can encode or control the postural diversity in worm behaviour that has been reported [40], or three-dimensional locomotion [41]. So far, studies have shown that the manifold is preserved under different developmental [37] and feeding [29] conditions. Still, analyses of larger neuronal populations in mammals have shown that neuronal dimensionality can vary with stimulus complexity [42], task complexity [43] and recording time [43]. In line with these considerations, we have observed much more variation in our recordings of neural activity in freely moving compared to paralyzed worms ( [20], figure S3; our observations); these variations often correspond to variations in behaviour. We therefore expect the precise structure of the manifold to depend on recording conditions, and expect that the manifold described in paralyzed, unstimulated animals in [20] will be seen as a simple scaffold as more complex recording conditions are used.
Motor state modulation of neuronal activity must not be exclusive to interneurons but perhaps extends to a subset of sensory neuron classes. Decreases in ambient oxygen levels evoked highly variable calcium fluctuations in BAG sensory neurons [22]. Kato et al. [20] showed that these fluctuations are correlated with brain state, i.e. BAG sensory responses are transiently attenuated during reversal command states. Ghosh et al. [44] showed that feedback from RIM affects ASH sensory responses to ultimately affect decision-making. Moreover, Chalasani et al. [11] showed that neuromodulatory feedback from AIA to AWC shapes the dynamics of AWC sensory responses and subsequent behaviours. These results are important hints that motor state modulation and feedback mechanisms in C. elegans potentially extend to the domain of primary sensory neurons.
While several studies together have shown that sensory stimulation does not produce qualitative changes in interneuron relationships to motor command state [19,20,26], subtle effects were reported [20,26], the consequences of which remain to be explored. Such small quantitative alterations could be signatures of or even underlie observed changes in behavioural state transition probability or other parameters of locomotion, such as crawling speed. One case in which subtle modulations of ongoing behaviour-related dynamics have been shown to implement a sensorimotor transformation is in the interneuron RIA. Two seminal studies showed that the RIA neurite has three compartments with independent calcium dynamics, that two of these compartments receive input from motor neurons regarding the worm's head-bend direction while the third receives sensory input, and that sensory input modulates the motor-related dynamics in RIA to ultimately bias the worm's head-bend [45,46]. This sensorimotor programme allows the worm to steer towards an odour source [46]. Whether such compartmentalized calcium dynamics are common in the worm remains unknown. Whether or not compartmentalization is widespread, it remains unclear how such activity modulations might act on the population of recurrently connected interneurons that underlies forward/reverse locomotion switches. See box 2 for a description of how a typical interneuron sensory response experiment could be analysed to begin to address this question. We propose hypotheses in the following section that take into account the functional implications of distributed, mixed sensorimotor representations.

Putting behaviour first: towards a new understanding of sensorimotor circuitry
These recent findings suggest that we must reimagine how to best perform and interpret experiments involving sensorimotor transformations. With nearly all interneurons showing spontaneous motor command dynamics, researchers must first describe and understand those ongoing dynamics under their recording conditions before studying sensory input responses (box 1 and box 2). In light of this, in this section, we will first focus on how the brain generates behaviour in the absence of experimentally evoked sensory stimulation. Only after exploring these ideas does it make sense to hypothesize how sensory stimuli are incorporated into ongoing behaviour-related dynamics. In our view, the worm brain is best understood as a distributed and dynamic system meant to produce appropriate behaviour, which rstb.royalsocietypublishing.org Phil. Trans. R. Soc. B 373: 20170371 involves most interneurons and motor neurons. This distributed network receives inputs from sensory neurons that act to modify its dynamics for the sake of decision-making. First, how do we best understand the ongoing production of behaviour? Motor commands are best summarized by the attractor manifold, a low-dimensional representation of highdimensional neuronal activity. There are three major features of network activity in the worm that contribute to the manifold: (i) the participation of a relatively large number of neurons, (ii) strong correlations and anti-correlations between them and (iii) a cyclical repetition of network activity states that reproducibly recruit the same classes of neurons in each cycle [20]. What could be the functional advantage of such a low-dimensional dynamical system coding for behaviour?
The participation of many neurons in motor command generation raises the possibility that information about behaviour is encoded at the level of the population; if this is the case, behaviour cannot be fully decoded from individual neuron traces alone. Population codes were shown in larger neuronal networks of various model organisms ranging from invertebrates to rodents and primates [47][48][49][50][51][52]. However, some key differences have to be noted: for example, in large spiking cortical networks, neurons with similar anatomical or functional features can be represented in great quantities, but in single trials the participation of individual neurons is often sparse and variable; both have substantial impact on the properties of the underlying population code [53]. Even in larger invertebrates, for example in an Aplysia motor ganglion, rhythmic motor patterns arise as an emergent property of neuronal populations [50]. Unlike in cortex, in the compacted worm brain, most neuronal classes are represented only by two bilaterally symmetric members and their recruitment to the neuronal ensemble is very reliable in single trials. As a result, the motor states of the action cycle can be easily inferred from the activity of few or even single neurons [20], suggesting that population coding for discrete motor state might not be the most salient feature of the system.
On the other hand, a prominent neuronal population-level feature found in C. elegans is the smoothness of the attractor manifold, i.e. the lack of abrupt switches and fixed points (figure 2). This smooth transitioning of network activity might serve the need to gradually adjust metrics of motion while animals switch between different locomotor programmes. For example, the transition from forward to backward crawling, which are two incompatible movement patterns, and which are generated by distinct and dedicated motor neuron circuits (B-versus A-class motor neurons), is accompanied by smooth deceleration and acceleration of locomotion speed [20,26] (see also Roberts et al. [5], who reported an intermittent discrete pause state). Imagine, you are driving your car through the city to find a parking spot; before you can back up and turn into a free spot, you need to first hit the breaks to slow your vehicle down; hence your discrete action of switching to the reverse gear must be embedded in another smoothly executed action command. To test this population coding hypothesis, it will be necessary to verify in a quantitative manner that population-level features are not trivial or epiphenomenal outcomes of simple primary features found already in individual neurons; sophisticated computational methods for scrutinizing these hypotheses have been recently developed [54]. Moreover, whole-brain imaging in freely moving worms should reveal whether other possible population-level features have indeed behavioural correlates.
Whether or not population coding exists in worms, strongly correlated and reliably recruited network activity underlies motor commands in the worm. We propose that one purpose of these features is the ability to robustly produce behaviour: in this view, the attractor manifold provides a backbone of pre-patterned network activity that persists under a stream of complex multisensory inputs, like the ones worms must encounter in their natural soil habitats. In this way, understanding the motor command system is a prerequisite for understanding how sensory inputs are processed. A striking feature of the interneurons that are recruited to motor command ensembles is their privileged role in the C. elegans connectome: due to their exceptional high in-and outdegree connectivity [27] and interconnectivity among themselves, they form a so-called rich club [55]. They receive plenty of synaptic input from primary sensory interneurons as well as directly from primary sensory neurons. This provides ample potential regulatory knobs by which sensory inputs can control behaviour. We hypothesize that transition probabilities on the attractor manifold depend both on internal dynamics and on a weighted function of sensory-related inputs received by interneurons. For example, when the system is in the forward command state, the probability of transiting to the reversal command state can be pushed towards high values by strong nociceptive inputs to acutely trigger escape reversals; other subtle inputs and internal dynamics could modulate the basal, perhaps stochastic, rate of 'spontaneous' transitions. Both the synaptic strengths and the identity of the receiving interneuron could be a means to modulate the weights function. This also explains the apparent redundancy in the motor command-related activity patterns of different interneurons: in this view, individual interneurons are not redundant but represent channels that can differentiate inputs into a distributed motor command network, while participating in that network by receiving and sending signals that affect ongoing dynamics.
Importantly, the behaviours encoded by brain-wide dynamics are high level. The cyclical progression of brain state along the attractor manifold, like the underlying activity patterns of individual neurons, should not be mistaken for a central-pattern-generator circuit for the undulatory movement of the worm; i.e. while it is possible to decode the worm's progression through the action command cycle, there is little or no information about its exact instantaneous posture dynamics like the dorsoventral bending pattern. Note again that neurons like RIB encode the speed of locomotion but not the underlying oscillatory movement. Hence, the action command cycle in the brain conveys high-level control variables of behaviour. This control model is consistent with a wide variety of results in the literature. Optogenetics experiments targeting individual neuron classes can modulate the probability of motor state transitions [17,18,36], and closedloop optogenetic control of just the AIY neurons was sufficient to achieve steering in a virtual gradient landscape [36]. Furthermore, in [9], ablation of individual interneurons resulted in differential effects on behavioural state; the authors consequently proposed a similar control model for the role of individual interneurons (without accounting for their additional role in motor command generation) [9]. In line with this role in high-level control, these studies reported no obvious effects of interneuron ablations and activations on posture dynamics, but rather showed that these perturbations biased the probabilities of behaviours to occur more or less rstb.royalsocietypublishing.org Phil. Trans. R. Soc. B 373: 20170371 often, but with normal coordination (except in cases where motor neurons are also affected [4]). Still, finer-grained measurements may be required to quantify possible effects of neuronal ablations on posture dynamics; for examples, see [56,57]. These experiments demonstrate that inputs via individual channels can, in principle, be sufficient to trigger behaviours, and in the context of our interpretation, the distributed network must be sensitive not only to motor command dynamics but also to individual sensory input channels. This view expands on the results of Gordus et al. [58] by suggesting that the integration of motor commands and sensory inputs takes place not only in primary sensory interneuron AIB but also in a vast majority of interneurons, including premotor interneurons [20]. In future work, multisensory stimulation experiments and optogenetics combined with whole-brain imaging can test this hypothesis. Moreover, determining properties of the proposed weights function (e.g. linear versus nonlinear processes) will be crucial to understanding the computations and decision-making processes of this system. Interestingly, in mice, it was recently shown that sensory inputs do not generate new behaviours but instead bias a set of spontaneous behaviours [59], just like sensory inputs bias spontaneous reversal probability in worms. Hence, these principles found in C. elegans might apply and scale to the larger brains of rodents. Our prediction is that the multitude of stereotypic motor motifs of mice might be encoded by and can be selected from pre-patterned, perhaps more plastic and higher dimensional, attractor dynamics in motor areas of the rodent brain.
We argue here that the studies describing sensory computations performed by interneurons AIA, AIY and AIB [10,12], mentioned in the previous section, do not necessarily contradict the imaging studies performed in freely moving worms. However, the exciting and important challenge for future studies is to address how and why these neurons multiplex. One possibility is that both functions are compartmentalized at the subcellular or even molecular level. Alternatively, these neurons exhibit mixed tuning, i.e. their activity is instantaneously computed from both motor and sensory inputs.
Mixed neuronal representations in individual neurons is not a peculiarity of the compacted nematode nervous system. In both rodent and primate cortex, the same neurons can be tuned to several task parameters, like sensory inputs, decision variables and behaviour [60]. It has been proposed that mixed representations can enhance the coding and decoding ability of neuronal activity in these larger neuronal networks (see [61] for details). Whether such principles can be found in a downscaled form in C. elegans remains to be shown. A prerequisite to address these questions is to record activity of interneuron populations in freely moving worms performing tasks in response to sensory stimuli, ideally in multisensory environments; then, the relative contributions of motor variables and sensory inputs to neuronal activity must be carefully disentangled.
At the mechanistic level, RIA neurons solve the problem of multiplexing signals within one cell by compartmentalizing them in different subcellular domains of the neurite. So far, no study reported compartmentalized calcium domains in the processes of other primary sensory interneurons AIY, AIZ and AIA; hence, we must assume that sensory and motor information to be truly mixed in these neurons. However, it should be noted that neuronal compartmentalization could be more common than currently accounted for; for example, electron microscopy studies show that many neurons have spatially segregated synaptic domains which could indicate compartmentalization [1]. Calcium imaging in animals freely navigating odorant gradients should give new insights into the function of these mixed representations. One possibility that we propose is that sensory processing in interneurons is gated by motor state: for example, AIY might only process sensory inputs while the worm is moving forward and ignores them during reversals. Because AIY activity is modulated by forward crawling speed, this gating mechanism could be a means of active gain control. In this model, animals would be more sensitized to certain inputs when in a fast crawling mode, e.g. during roaming periods [62,63] or in the absence of food [5]. In this line, previous work showed that behavioural responses to thermal stimuli depended on the locomotory phase of the worm's posture [64]. Moreover, higher-level behavioural context gating of sensory response was recently reported [65,66]. It therefore will be necessary to further develop behavioural paradigms where neural circuit activity can be studied under controllable open-and closed-loop conditions, i.e. like in Kocabas et al. [36]. Interestingly, movement modulates neuronal activity in sensory cortical areas in the mouse [67,68]. In Drosophila, both walking and flying strongly modulate the activity of neurons early in the visual pathway [69,70]. This modulation persists in blinded flies and its strength is tuned quantitatively to movement parameters, similar to worm interneuron activities that show a quantitative representation of movement speed. Cohn et al. [71] showed that the fly's instantaneous behavioural state, represented by dopamine neuron ensemble activity, could drive plasticity of odour responses. These studies show that behavioural state can have a pronounced effect on higher sensory processing areas in more complex brains.
Other possible functions besides gain modulation could be to predict the effects of movements on sensation, as occurs during processing of visual flow fields in rodents and flies [72,73]. Moreover, theories of motor control suggest that efference copies of motor commands feed into internal forward models that predict the outcomes of movements, which then can be optimized based on detecting a prediction error [74,75]. In this context, we suggest that the widespread motor command representation in worms could be integrated with proprioceptive feedback to optimize the execution of behaviour. This hypothesis is supported by our observations that the reversal motor command is sustained in pharmacologically paralyzed as well as in physically constrained animals, compared to untreated unrestrained worms. This suggests that information about lack of movement is conveyed to the brain to prolong the motor command [20]. C. elegans could be a tractable system to scrutinize these hypotheses.
In fact, it appears that brain-wide representations of ongoing multi-dimensional behaviour also dominate mouse brain activity [76,77]. Behaviour representations explain the vast majority of variance in these brain-wide datasets, and they persist unperturbed by, and in orthogonal dimensions to, both sensory input [76] and multi-stage decision-making task parameters [77]. Both studies address similar issues of data interpretation as we describe in box 1, and Musall et al. [77] point out that many results in the rodent decisionmaking literature may require re-evaluation in light of these findings, as we have argued here for C. elegans literature. rstb.royalsocietypublishing.org Phil. Trans. R. Soc. B 373: 20170371 Multi-dimensional behaviour-related activity also pervades sensory cortices, leading [76] to argue that sensory cortex function will probably only be understood in relation to the animal's ongoing behaviour, as we argue for primary sensory interneuron function in worms. In conclusion, work across phyla suggests that concurrent, distributed integration of sensory and motor dynamics is a fundamental principle of nervous system function. Hence, we propose C. elegans as a tractable model to study the functions and computational advantages of these brain-body-environment interactions.

Material and methods
(a) Calcium imaging in freely moving animals with O 2 delivery Data in box 1 are from Kato et al. [20]. Briefly, the automatic recentering system described in [24] was used to keep the worm's head centred on the objective. Young adult worms expressing GCaMP and mCherry in AVA under the flp-18 promoter were recorded on an inverted microscope, moving freely on an agar surface in an airtight chamber with inlet and outlet connectors for gas flow delivery. Simultaneous recordings of animal behaviour were made via infrared illumination and an additional lowmagnification objective and camera from above. A GCaMP and mCherry ratio was calculated to correct for motion artefacts, and the mean of the bottom 10% of the data was used as R 0 to calculate (R2R 0 )/R 0 ¼ DR/R 0 .
(b) Calcium imaging in immobilized worms with isoamyl alcohol delivery Animals were immobilized using 1 mM tetramisole and restricted in the microfluidic four-flow device for olfactory stimulation described in [10]. This device uses laminar flow to ensure little to no diffusion between the two buffers that make contact with the worm's nose. Recordings were 12 min long; in both stimulus and control recordings, for the first 6 min, NGM þ fluorescein (20 mM) buffer contacted the worm's nose. Then, every 30 s, this buffer was switched with a buffer lacking fluorescein, either NGM þ IAA (9.2 Â 10 24 M) in the stimulus condition or NGM alone in the control condition. Fluorescence intensity measurements near the worm's nose were used to quantify fluorescein levels to ensure laminar flow and to determine stimulation times. Nuclear-localized GCaMP5 K was expressed in AVA under the flp-18 promoter (strain: ZIM747; lite-1 (xu7); mzmEx458 ¼ [Pflp-18::mCherry-His58; Pflp-18::NLSGCaMP5 K]). Images were acquired on an inverted compound microscope (Zeiss Axio Observer.Z1) using a CCD camera (Evolve 512, Photometrics). Excitation light (470 nm) was provided by a CoolLED pE excitation system. A 40Â oil immersion objective (N/A 1.3) was used to obtain unbinned images at 33 ms exposure time with the VisiView software (Visitron Systems GmbH, Germany).

(c) Resampling test
The combined data from the last 20 s (horizontal bars in the figure of box 2) of the IAA-off or control buffer-off stimulations were randomly redistributed into two surrogate control groups. The number of trials in each surrogate sample was the same as in the two experimental conditions. In each of 1 million iterations, we calculated the difference between the integrals of the surrogate IAA sample and the surrogate control sample. The p-values are the fraction of results when the distance between the resampled datasets was equal or larger than the observed one; hence, they estimate the probability that the observed differences occurred by chance.

(d) Neuron states
Many C. elegans interneurons are bi-stable, displaying mainly Low and High states, as well as falls and rises when transition between the states. We performed phase-segmentation on the AVA traces into Low, Rise, High and Fall as was described in [20]. Briefly, periods were classified as rises when the time derivative of the trace was higher than a small and manually determined threshold, while periods were classified as falls if the time derivative was lower than another threshold. High and Low states were then assigned to remaining periods based on lawful order and a threshold. In box 2, High state corresponds to combined Rise and High, which for AVA is known to correspond to reversal behaviour [20], while Low corresponds to combined Fall and Low, known to correspond to forward command state. Classification into High and Low in box 2 required these states to be constant for 10 s pre-stimulus.