A Gate-and-Switch Model for Head Orientation Behaviors in Caenorhabditis elegans

Abstract The nervous system seamlessly integrates perception and action. This ability is essential for stable representation of and appropriate responses to the external environment. How the sensorimotor integration underlying this ability occurs at the level of individual neurons is of keen interest. In Caenorhabditis elegans, RIA interneurons receive input from sensory pathways and have reciprocal connections with head motor neurons. RIA simultaneously encodes both head orientation and sensory stimuli, which may allow it to integrate these two signals to detect the spatial distribution of stimuli across head sweeps and generate directional head responses. Here, we show that blocking synaptic release from RIA disrupts head orientation behaviors in response to unilaterally presented stimuli. We found that sensory encoding in RIA is gated according to head orientation. This dependence on head orientation is independent of motor encoding in RIA, suggesting a second, posture-dependent pathway upstream of RIA. This gating mechanism may allow RIA to selectively attend to stimuli that are asymmetric across head sweeps. Attractive odor removal during head bends triggers rapid head withdrawal in the opposite direction. Unlike sensory encoding, this directional response is dependent on motor inputs to and synaptic output from RIA. Together, these results suggest that RIA is part of a sensorimotor pathway that is dynamically regulated according to head orientation at two levels: the first is a gate that filters sensory representations in RIA, and the second is a switch that routes RIA synaptic output to dorsal or ventral head motor neurons.


Introduction
Perception and action are intimately linked in the central nervous system. Our movements often have immediate sensory consequences, including changes in visual, proprioceptive, and mechanosensory inputs. Likewise, vocalization produces auditory self-stimuli, and inhalation can result in olfaction. To ensure accurate internal representations of the world, reafferent sensory stimulation caused by our own behavior must be processed and interpreted differently from other stimulus sources (Straka et al., 2018). To make this distinction, our sensory systems must continuously predict the consequences of our own actions. This is in part accomplished via inputs from motor areas, called efference copies or corollary discharge (Crapse and Sommer, 2008). Through processes that are only partially understood, our senses are precisely filtered and modulated in real time to compensate for ongoing behaviors and the sensory consequences of our actions. While some of the neural circuits that underlie these functions have been anatomically characterized to varying degrees, the sites and molecular mechanisms of this type of sensorimotor integration remain elusive in all but a few cases. The nematode Caenorhabditis elegans, which has a completely mapped and largely invariant nervous system, quantifiable behaviors, and a suite of genetic and imaging tools, provides an opportunity to probe these events at cellular resolution and directly link them to behavior (White and Southgate, 1986;Calhoun and Murthy, 2017).
The primary mode of C. elegans navigation is a biased random walk consisting of bouts of forward movement punctuated by quasi-random reorientations achieved through clustered sequences of reversals and turns. Directional movement is achieved by measuring changes in sensory input over time during forward bouts and modulating reorientation probability accordingly (Pierce-Shimomura et al., 1999). This behavior is directly analogous to the runs and tumbles of bacterial chemotaxis (Berg, 1975). C. elegans lie on their side, undulating in the dorsoventral plane as they crawl in a sinusoidal motion. Sensory structures located at the tip of the nose sweep back and forth as the head bends during forward movement. In contrast to the biased random walk, several navigation behaviors suggest that reafferent sensory input caused by head bending during locomotion is exploited as a way to sample the spatial distribution of environmental stimuli and guide navigation, a simple form of active sensing. For example, in radial temperature gradients, C. elegans will crawl in precisely curved trajectories to stay within a favored temperature range, a behavior called isothermal tracking (Hedgecock and Russell, 1975). Likewise, when crawling in a chemoattractant gradient, C. elegans exhibit gradual steering to orient in the preferred direction, a behavior called klinotaxis, as long as they are at an angle relative to the gradient that allows sensory sampling across head sweeps (Iino and Yoshida, 2009;Kato et al., 2014). Steering and the biased random walk operate on fundamentally different principles (Lockery, 2011). While the latter operates primarily by sensory integration over tens of seconds (Pierce-Shimomura et al., 1999;Luo et al., 2014a,b), steering requires constant, ongoing integration of sensory and motor information on a short time scale (Iino and Yoshida, 2009;Kato et al., 2014).
We previously showed that each of a pair of unipolar interneurons called RIA can simultaneously encode both head movements and sensory inputs through two types of calcium signal (Hendricks et al., 2012). Local, compartmentalized calcium events in the ventral and dorsal segments of the RIA axon (nrV and nrD) were correlated with dorsal and ventral head bends, respectively (Fig. 1A,B). These axonal compartments correspond to sites of synaptic input from two pairs of head motor neurons, the SMDs (White and Southgate, 1986). We will refer to these compartmentalized events within the nerve ring as mCa 2ϩ , for motor-evoked calcium events. In addition to mCa 2ϩ signals, removal of an attractive odor resulted in calcium increase throughout the entire axon, including nrV and nrD, while odor presentation resulted in whole-axon suppression of calcium levels (Fig. 1C). These events will be referred to as sCa 2ϩ , for sensory-evoked calcium events. These responses are dependent on synaptic input from upstream sensory neurons and interneurons that synapse onto RIA exclusively in the "loop" region of the axon in the ventral nerve cord (Fig. 1A).
Within the nerve ring, mCa 2ϩ and sCa 2ϩ signals overlap spatially and temporally. We previously showed that these signals were genetically separable, and they were additive with one another within each nerve ring compartment. This additivity suggests a simple mechanism for integrating head orientation and sensory input to calculate the spatial distribution of a stimulus across each head sweep. We therefore proposed a model for steering based on asymmetric output from RIA to head motor neurons (Hendricks and Zhang, 2013). The basis of this model is that RIA mediates negative feedback onto head motor neurons, limiting the extent of head bending and setting gait amplitude. This is supported by the observation that impairing RIA function led to increased gait amplitude (Hendricks et al., 2012). When stimuli are absent or distributed symmetrically (Fig. 1D), this negative feedback is also symmetric. However, if stimulus changes are experienced across head bends, as when crawling orthogonal to a gradient, sCa 2ϩ events are produced in phase with head bends, leading to enhanced negative feedback in the unfavored direction and suppressed negative feedback in the favored direction (Fig. 1E).
Here, we confirm and extend aspects of this model by examining simple head orientation behaviors and sensory encoding events in RIA, which have not been explored in detail and which reveal new features of sensorimotor integration in RIA. We propose a "gate and switch" model for RIA function in which sensory filtering prevents inappropriate activation of RIA when the head is not bent (gating), while mCa 2ϩ asymmetry constitutes a switch that routes an inhibitory signal to dorsal or ventral motor neu-rons to bias gait. Finally, we identify explanatory shortcomings of the model that require further study.

Animals
C. elegans were raised on nematode growth medium and fed with Escherichia coli strain OP50 according to standard methods (Brenner, 1974;Stiernagle, 2006). Experiments were conducted on young (3 d old) adult hermaphrodites. The strains used are N2, VC657 gar-3(gk305)V, MMH099 yxIs19 , MMH100 yxIs19; yxIs20  Figure 1. RIA overview and requirement for control of head orientation. A, RIA is a unipolar interneuron whose axon extends into the ventral nerve cord and throughout the nerve ring. There are two RIAs, left and right, one is shown. B, Two axonal compartments within the nerve ring, nrV and nrD, encode head movements via local calcium signals (mCa 2ϩ ) triggered by muscarinic input from SMD head motor neurons. C, Sensory pathways synapse on the loop domain of the RIA axon in the ventral nerve cord. Attractive stimuli lead to whole-axon reduction in calcium, while attractant removal causes whole axon calcium increases (sCa 2ϩ ). D, Model for RIA function in steering behaviors. Where stimuli are symmetric across head bends, inhibitory output from RIA to motor neurons is symmetric. E, If the stimulus changes across head sweeps, RIA output to motor neurons become asymmetric, driving steering behavior. F, Schematic of head orientation measurement in response to a unilaterally presented stimulus. G, Estimation plot of difference between wild-type preference for odor as measured by percentage of the assay time (120 s) with their head within the odor stream and RIA::TeTx animals or animals treated with scopolamine. ANOVA F (2,50) ϭ 5.7771, p ϭ 0.0055, ‫ء‬p Ͻ 0.05, ‫‪p‬ءء‬ Ͻ 0.01 post hoc Student's t test, n ϭ 13, n ϭ 20, n ϭ 20. V, ventral; D, Dorsal. Open circles and lines are mean Ϯ SD (top). Closed circles and lines are mean difference from control Ϯ 95% confidence interval, shown with distribution of estimated means (see Materials and Methods).

Microfluidic device fabrication
Standard soft lithography methods were used to fabricate photoresist (SU8) masters for microfluidic devices (San-Miguel and Lu, 2013). Two-component polydimethylsiloxane (PDMS; Dow Corning Sylgard 184, Ellsworth Adhesives #4019862) was mixed at 10:1 w/w, degassed under vacuum, poured over masters, degassed again, and cured at 60°C for at least 3 h. Devices were replica mastered in a two-part epoxy resin (Smooth Cast 310, Sculpture Supply Canada #796220) according to the manufacturer's instructions. Inlet holes were made with a Milltex 1 mm biopsy punch (Fisher). Chips were cleaned with ethanol and Scotch tape (3M) and then bonded to glass coverslips using air plasma generated by a handheld corona treater (Haubert et al., 2006;Electro-Technic Products). Coupling to fluid reservoirs was done by directly inserting PTFE microbore tubing (Cole-Parmer #EW-06417-21) into inlet holes.

Calcium imaging
Fluorescence time lapse imaging (100-ms exposures, five frames per second) was performed as described (Hendricks et al., 2012). Briefly, animals were restrained in a microfluidic channel with a depth of 28 m to prevent movement in the z-axis and that allows the anterior portion of the head to move freely (Chronis et al., 2007). They were exposed to alternating streams of NGM buffer (1 mM CaCl 2 , 1mM MgSO 4 , and 25 mM KPO 4 ; pH 6.0) or 100 M isoamyl alcohol (IAA; BioShop ISO900) in NGM buffer. Fluid flow was driven by negative pressure from a vacuum pump and controlled with a ValveBank (AutoMate Scientific). Images were captured at five frames per second, 100-ms exposures using a 40ϫ objective. Movements in xy were corrected by stack registration, and ROIs corresponding to the RIA axonal domains were selected manually. GCaMP3 (Tian et al., 2009) intensity was measured from axonal compartments and normalized with the for-  Left to right, n ϭ 14, n ϭ 6, n ϭ 18, n ϭ 22, n ϭ 23, n ϭ 21, n ϭ 13, n ϭ 9. E, Comparison of the magnitude of loop calcium responses to odor removal when the head is bent (head orientation Ͼ 0.5 or Ͻ -0.5) or unbent (head orientation between -0.5 and 0.5). Pre-and post-measurements are mula (F t -F min )/(F max -F min ). Asymmetry between the nerve ring compartments (Ѩnr) was defined as (nrV -nrD). All calcium imaging analysis was done using the FIJI distribution of ImageJ (Schindelin et al., 2012). During calcium imaging, animals were free to move the anterior portion of their head, and these movements were captured as well. Motion artifacts affecting the GCaMP3 signal can in principle produce spurious correlations with the animal's movement. If our correlations were artifacts of animal movement, these correlations should persist in gar-3 mutants or in scopolamine-treated animals, in which there are no compartmentalized mCa 2ϩ events. However, both in previous work using an identical imaging configuration (Hendricks, 2012) and here, correlations between head movement and local GCaMP3 signals are completely eliminated, demonstrating that they are not produced by motion artifacts.

Head orientation assays
Microfluidic chips (60 m deep) were based on a design by McCormick et al. (2011). Fluid flow was gravity driven and controlled with manual one-way stopcocks (Cole-Parmer). Animals were exposed to streams of NGM buffer and 100 M IAA on either side of their heads. For scopolamine treatment, animals were immersed in NGM buffer containing 100 M scopolamine (Sigma) for 5 min before and during the assay. Worms were loaded individually into the chip, and once in place, their movements were recorded for 2 min, with a switch between buffer and IAA at the 1-min mark, using a USB camera (Aven Mighty Scope, #2700-200) and VirtualDub software.

Head orientation measurements
In head orientation assays, head bending was measured at each time point as the angle between the tip of the animal's nose and the midline of its body at the most anterior restrained point using MATLAB. For calcium imaging, head bending angle was calculated as the angle between the major axis of an ellipse fit to the free portion of the animal's head and neutral (unbent) position using FIJI. Comparison to previously used methods based on the ratio of pixels on either side of the midline (Hendricks et al., 2012) showed that these approaches yield equivalent results.

Code accessibility
MATLAB code used to measure head orientation in Figure 1 is available from the authors on request.

Statistics and data presentation
All time series data are presented as lines with shading indicating the standard error of the mean. Where compar-isons are made, we have adopted the use of estimation plots, which focus on effect sizes and confidence intervals (Gardner and Altman, 1986;Ho et al., 2018). Estimation plots employ a secondary axis that shows the size of the difference between test condition and control as a mean and 95% confidence interval. For paired comparisons, this is the within-group difference. A probability distribution of the test mean was produced by generating 2500 Bayesian bootstrapped means using sampling with replacement from the experimental data (Rubin, 1981). The implementation used here weighted each observed mean according to a gamma distribution with shape parameter (n -1)/n and a scale parameter of 1. Where multiple comparisons are made, significance markers are for post hoc Student's t test with Bonferroni correction. All statistical analysis and plotting were done in JMP Pro 13 (SAS). Figures were prepared with Adobe Illustrator.

RIA and head orientation
Ablating RIA does not grossly affect random walk dynamics in isotropic environments or in response to olfactory stimuli (Gray et al., 2005;Ha et al., 2010). In contrast to the temporal integration of the biased random walk, steering behavior depends on asymmetric head bends that propagate through the normal locomotor body wave, producing curved forward movement (Iino and Yoshida, 2009;Izquierdo and Lockery, 2010;Lockery, 2011). To test the idea that RIA is involved in biasing head movements in response to an asymmetrically presented olfactory stimulus, we analyzed head movements in a microfluidic chip designed for this purpose (Fig. 1F). In this device, animals are restrained in approximately the middle third of their body using gentle suction. Two fluid streams flow on either side of the head. Animals exhibit spontaneous head bends and body undulations and are able to express a preference for one of the two streams by restricting their movements to keep their head in the preferred odor stream (McCormick et al., 2011).
Because our previous characterization of RIA physiology used the chemoattractant IAA (3-methylbutan-1-ol) and steering has been demonstrated in IAA gradients, we used it as an olfactory stimulus (Hendricks et al., 2012;Kato et al., 2014;Liu et al., 2018). We recorded each animal for two minutes. To control for any intrinsic bias in head bending direction, the odor and buffer streams were switched after one minute. Wild-type animals showed a clear preference for the IAA stream, as measured by the proportion of time spent with their heads bent toward the odor (Fig. 1G). continued mean loop Ca 2ϩ levels in 1s windows just before odor OFF and centered on the peak of the mean response, respectively, shown as paired responses (lines) and mean Ϯ SD (open circles and lines). Estimations of the mean changes are shown below as mean difference Ϯ 95% confidence interval (closed circles and lines) along with probability distributions of the means (see Materials and Methods). In both wild-type (n ϭ 84, n ϭ 42) and gar-3 (n ϭ 20, n ϭ 12) animals, the loop response magnitude is larger when the head is bent (repeated measures ANOVA F (1,154) ϭ 41.4529, p Ͻ 0.0001, ‫‪p‬ءءء‬ Ͻ 0.001 post hoc Student's t test). gar-3 mutants have larger responses under both head orientation conditions, but there is no significant interaction between loop Ca 2ϩ responses, head position at odor off, and genotype (repeated measures ANOVA F (1,154)  To test the role of RIA in this behavior, we used animals expressing tetanus toxin under an RIA-specific promoter. Tetanus toxin prevents synaptic vesicle release by cleaving synaptobrevin (Schiavo et al., 1992). In contrast to wild type, RIA::TeTx animals exhibited no preference (Fig. 1G). Next, we treated animals with scopolamine, a muscarinic acetylcholine receptor antagonist previously shown to abolish mCa 2ϩ events (Hendricks et al., 2012). Like RIA:: TeTx animals, scopolamine treated animals show no directional preference (Fig. 1G). RIA-defective animals exhibit normal sCa 2ϩ responses and RIA-ablated animals are capable of olfactory chemotaxis and thus are not sensory impaired (Ha et al., 2010;Hendricks et al., 2012). These results are consistent with the hypothesis that RIA is involved in responses to asymmetrically presented stimuli but not the temporal integration that underlies the biased random walk strategy.

RIA mediates directional head withdrawal
Steering requires posture-dependent responses to sensory inputs. We therefore examined the position and velocity of the head immediately before and after IAA removal in animals restrained in a chip that allows the head to move while facilitating temporal control of odor presentation and calcium imaging (Chronis et al., 2007;Hendricks et al., 2012). While analyzing head movements in restrained animals prevented us from measuring navigation behavior directly, it has the advantage of allowing continued removal. Shading is SEM, dashed lines indicate position of nrV and nrD mean peaks. B, Head orientation predicts the mean lag between nrV and nrD peaks post-odor removal. ANOVA F (1,124) ϭ 13.47, p ϭ 0.0004. C, Cross-correlation of nrV, nrD, and mCa 2ϩ asymmetry (Ѩnr) and head orientation, showing mCa 2ϩ lag with head movements. gar-3 mutants lack mCa 2ϩ and do not show head correlations. Re-expression of gar-3 cDNA in RIA partially rescues this relationship. D, nrV and nrD cross-correlations with head velocity for wild-type, gar-3, and RIA-specific gar-3 rescue in a 6-s time window comprising 2-s pre-odor removal and 4-s post-odor removal in relation to head orientation at odor off. When the head was bent, we observed no lag between head withdrawal and peak calcium responses in the nerve ring compartment ipsilateral to the direction of bending. gar-3 mutants show no distinction between nerve ring compartments. Expression of gar-3 cDNA in RIA in gar-3 mutants does not rescue the temporal features of sensory responses in the nerve ring. Analysis groups are the same as Figure 4. us to unambiguously assign a stimulus change to a specific point in the head bending cycle.
We first examined whether there was any relationship between head movements and olfactory stimulus changes. To better visualize oscillatory head bending, we plotted head movements on a 2D position-velocity space that captures its phasic properties ( Fig. 2A). We then analyzed head movements that occurred immediately after odor removal in relation to each phase of the head bending cycle (Fig. 2B). Large ventral head movements were associated with odor removal during dorsal head bends, and odor removal during ventral head bends triggered rapid dorsal head movements (Fig. 2C).
Because locomotion involves regular, oscillatory head movements, head withdrawal (returning toward center) is expected to follow immediately after each head bend. We predicted that stimulus-evoked movements would alter this normal oscillation. To distinguish the latter active head withdrawal events from normal behavioral progression through the oscillatory cycle, we compared head movements before and after odor withdrawal to head movements associated with either odor presentation or at an arbitrary time point with no stimulus change. Because responses to stimuli should be mirrored across the dorsoventral axis, for these experiments we defined head deflection in either direction as positive. Thus, positive velocities correspond to head bending and negative velocities to head withdrawal (Fig. 3A). While head bending does tend to be followed by head withdrawal (Fig. 3B), as expected, only odor removal elicits a characteristic, transient, rapid head movement and only when the head is bent (Fig. 3C,D).mCa 2ϩ events rely on synaptic input from SMD motor neurons via the muscarinic AChR (mAChR) GAR-3 (Hendricks et al., 2012). Our model suggests that these events play a role in modulating head movements in response to sensory stimuli. We therefore examined stimulus-evoked head withdrawal in gar-3 mutants and in RIA::TeTx animals. Neither of these strains exhibited stimulus-evoked head withdrawals (Fig. 3D). Expressing a wild-type gar-3 cDNA specifically in RIA showed partial rescue of odor removal-evoked head withdrawal, but these responses were not significantly different from those of gar-3 mutants (Fig. 3D).

RIA sensory responses are gated according to head position
Models of steering rely on symmetry breaking by phasic modulation of the effects of sensory input on motor networks (Lockery, 2011). Support for a role for RIA in this process was provided in a recent paper in which selective inactivation of RIA synapses in either nrV or nrD produced curved locomotion in the predicted direction (Liu et al., 2018). This relies on generating deeper head bends in the direction of curvature, essentially the inverse of head withdrawal. Both mechanisms rest on the idea that differential mCa 2ϩ levels in nrV and nrD function as a switch to route output from RIA to ventral or dorsal motor neurons. This output is predicted to be inhibitory and to limit head bends in the unfavorable direction. However, restricting head bends must be balanced against the need to main-tain forward locomotion. Because mCa 2ϩ levels are only partially correlated with head movements and frequently do not show dorsal-ventral differences (Hendricks et al., 2012), there is a potential for inappropriate symmetrical activation or inhibition, which would be predicted to disrupt the animal's gait.
We therefore analyzed the relationship between head movements, mCa 2ϩ asymmetry in the nerve ring, and sCa 2ϩ responses in the loop domain. Consistent with previous observations, mCa 2ϩ asymmetry (Ѩnr) shows a clear relationship to head oscillations (Fig. 4A). There is no apparent overall relationship between loop sCa 2ϩ and head movement (Fig. 4B). Because odor switches occur at set time points while head movements are spontaneous, the relationship between head position and odor removal is arbitrary. Spontaneous sCa 2ϩ events may mask a relationship between head movement and stimulus-evoked events because the latter are much less common. We therefore examined whether stimulusevoked loop sCa 2ϩ events that occur on odor removal are dependent on head phase.
We found an unexpected relationship between loop responses and head position at the time of odor removal. Odor removal triggers calcium influx throughout the RIA axon via inputs from upstream interneurons, and the magnitude of these responses was large when the animal's head was bent, in either direction, and small or absent when it was not (Fig. 4C,D). This effect is the same for dorsal or ventral bends, so as in Figure 3, we defined all bends as positive and classified head positions as "bent" or "not bent" if they were more or less than half the maximal degree of head deflection, respectively. This posture classification revealed a robust difference in the magnitude of sCa 2ϩ responses in response to odor removal (Fig.  4E).
Posture dependence in behavioral responses to pulsed thermal stimuli was observed by Stephens et al. (2008). In that study, animal posture was defined through a dimensional reduction procedure, and an animal's state defined by the first two components was predictive of responses to a sudden temperature increase. With only a behavioral readout, it is difficult to tell whether posture dependence is based on an active neural mechanism or is a constraint of the motor program. In the case of RIA, we have clear evidence of a sensory gating mechanism. This has important implications for sensory coding in RIA. First, gating allows preferential attention to stimuli encountered during head bends, consistent with a function in steering in response to asymmetrically distributed stimuli. Second, it resolves the issue raised above of potential gait disruption caused by symmetrical output from RIA to head motor neurons. Gating ensures that large sCa 2ϩ events are only likely to occur when mCa 2ϩ in the nerve ring is asymmetric, i.e., only when the downstream "switch" is engaged to favor either dorsal or ventral synaptic output.
The sensory gating mechanism may act directly on RIA or be a feature of upstream interneurons. We first tested the hypothesis that the gate and switch mechanisms are in fact the same: motor inputs via GAR-3 that produce local mCa 2ϩ events may also somehow gate sCa 2ϩ responses. To do so we repeated our analysis of sensory-evoked sCa 2ϩ relative to head orientation in gar-3 mutants. In this mutant, mCa 2ϩ events are absent while sCa 2ϩ responses are intact, leading to perfectly symmetrical calcium activity in the nerve ring (Hendricks et al., 2012). gar-3 mutants exhibited normal sensory gating (Fig. 4E). This suggests that an independent gating mechanism exists at the level of the RIA loop or upstream interneurons. There are several candidate mechanoreceptor neurons in the head, and this mechanism may rely on a hitherto unidentified proprioceptive pathway.

Head bending desynchronizes local calcium responses to sensory input
How sCa 2ϩ and mCa 2ϩ interact and influence synaptic release is critical for understanding of RIA function. We previously showed that sCa 2ϩ and mCa 2ϩ are additive within the nerve ring compartments (Hendricks et al., 2012). Therefore, we analyzed nrV and nrD responses separately during whole-axon sCa 2ϩ events with respect to each other and head velocity.
We found that head bending introduced a notable lag in peak responses within the nerve ring that was dependent on head orientation (Fig. 5A,B). The polarity of this lag depended on head position, such that the ipsilateral nerve ring compartment exhibited a shorter rise time and earlier peak with respect to the contralateral compartment. This is consistent with a simple additive model of mCa 2ϩ and sCa 2ϩ . That is, the nerve ring compartment corresponding to the direction of head bending exhibits not only a stronger calcium signal but a shorter latency to peak calcium levels.
As previously shown, we observed that mCa 2ϩ responses typically lag behind head movements (Fig. 5C). Possible reasons for this lag include the relative timing of the muscle contractions (via nicotinic acetylcholine receptors) and mCa 2ϩ (via muscarinic receptors) elicited by acetylcholine released from head motor neurons. We have interpreted this lag as evidence that mCa 2ϩ in RIA function as a representation of ongoing head movement. To understand how the shift in peak local calcium (the sum of sCa 2ϩ and mCa 2ϩ calcium sources within each compartment) might relate to stimulus-evoked head withdrawal, we examined the relative timing of these events. We performed cross-correlation analysis of head velocities with respect to nrV and nrD calcium dynamics in a restricted time window corresponding to odor removal. In these plots, positive peaks near the y-axis indicate a calcium signal that is coincident with head motion. Those to the left are calcium signals that are delayed relative to head motion, and thus are unlikely to play a causal role in the initiation of the behavior.
During sensory stimulation (odor removal) while the head is bent, peak sensory responses in the nerve ring are coincident with head withdrawal in the contralateral direction but lagged in the ipsilateral direction (Fig. 5D). That is, when the head is bent ventrally, the peak nrV calcium signal is synchronous with the highest head velocity in the dorsal direction (withdrawal) while nrD calcium lags, and vice versa during dorsal head bends. When the head is not bent, this relationship is lost due to the absence of strong sCa 2ϩ responses. This desynchronization is ab-sent in gar-3 mutants, which completely lack mCa 2ϩ (Hendricks et al., 2012). Re-expression of gar-3 specifically in RIA restored some compartmentalization (Fig. 5D) but was not sufficient to rescue the temporal structure of stimulus-evoked responses in nrV and nrD, which may relate to its failure to fully rescue head withdrawal (Fig.  4D). This implies either GAR-3 plays additional roles outside RIA in mediating the temporal features of RIA signaling and head withdrawal, or that the rescue construct causes mislocalization, inappropriate expression levels, or otherwise does not sufficiently restore GAR-3 function in RIA.
Overall, these results show that the additive properties of mCa 2ϩ and sCa 2ϩ lead to decoupling of local calcium event timing in the nerve ring in response to odor removal. This has important functional implications for mCa 2ϩ . Because these signals slightly lag head movement, it was unclear how they might play an instructive role in controlling rapid response to sensory stimulus. Our results suggest that one possible role is to function additively with sCa 2ϩ to reduce latency and facilitate more rapid transmitter release on one side of the RIA axon than the other, triggering head withdrawal.

Discussion
RIA is uniquely well-situated in the C. elegans wiring diagram to play a role in integrating head orientation and sensory input. It is one of very few interneurons that receive substantial motor feedback, and it receives convergent input from odor, taste, and temperature sensory pathways. Here, we confirmed a role for RIA in head orientation in response to an asymmetrically presented stimulus, following previous work demonstrating roles for RIA in steering in response to odor and temperature (Mori and Ohshima, 1995;Liu et al., 2018).
The recent study by Liu et al. (2018) demonstrated that asymmetrically suppressing neurotransmitter release from RIA, mimicking an attractive odor being presented on that side, led to deeper head bends and curving in that direction. Here, we describe the mirror-image behavior, head withdrawal and limiting of head bends in response to odor removal. Both are predicted by our model to contribute to steering (Fig. 1). Blocking RIA synaptic release or genetically removing asymmetric local mCa 2ϩ in the RIA axon prevented directional head withdrawal. We identified a posture-dependent sensory gating mechanism that may prevent aberrant symmetric RIA output and causes RIA to be selectively responsive to stimuli encountered during head bending.
Phasic behaviors that produce reafferent stimulation often exhibit sensory gating coupled to the behavior. In mice, examples include olfaction, where cholinergic inputs to the olfactory bulb modulate sensory gain in phase with respiration during sniffing, and a functionally similar gating mechanism is evident during whisking (Eggermann et al., 2014;Rothermel et al., 2014). RIA may be part of a similar circuit mechanism, in which phasic inputs from head motor networks both gate sensory responses and tune motor outputs to respond appropriately to spatially asymmetric stimuli.
A shortcoming of our model is that the rapid head withdrawal movements we observed, which often involve sudden reversals of head velocity, probably cannot be explained by inhibition of ipsilateral motor neurons alone but must also involve contralateral motor neuron activation and muscle contraction. In the nerve ring, the RIA axon receives input from ventral head motor neurons only in nrV and dorsal motor neurons only in nrD. However, output synapses from RIA to SMD and RMD head motor neurons are not segregated in the same way. nrV and nrD both contain interspersed output synapses to both dorsal and ventral motor neurons. However, the postsynaptic anatomic arrangement of these synapses suggest that these connections may be of opposite valence (Fig. 6A). Ipsilateral connections are in the distal portion of the axon near neuromuscular junctions, while contralateral synapses are clustered near the motor neuron cell body. This is at least consistent with the possibility of differing effects of output from nrV and nrD on their ipsilateral contralateral motor neuron targets. Exploration of this will require identification of postsynaptic receptors and direct measurement of RIA's effects on its target neurons.
Our observation of dynamic sensory gating adds a new layer to the RIA sensorimotor circuit and resolves potential shortcomings of our previous model, in which RIA outputs but not sensory representations are regulated by head movements. We propose a two-level gate and switch model, in which an unidentified posture-dependent signal gates sensory sCa 2ϩ responses while differential mCa 2ϩ between the nerve ring compartments functions as a switch to produce asymmetric synaptic output from the nrV and nrD axonal domains (Fig. 6A,B). This switch may depend on the temporal decoupling we observed between nrV and nrD during sensory-evoked responses when the head is bent. mCa 2ϩ introduces a temporal bias that reduces the time to peak response in the compartment contralateral to the direction of head withdrawal. This peak is coincident with head withdrawal, and the duration of the behavior is similar to the lag introduced between the two axonal compartments. Again, how plausible a mechanism this is will depend on analyzing the effects of these calcium events on synaptic release from RIA and the activity of postsynaptic motor neurons.
Despite its small size and simple morphology, RIA exhibits striking computational potential as a sensorimotor integrator. Along with clear behavioral readouts, this relative simplicity makes it an attractive system to probe sensorimotor integration at the cellular level, both in terms of molecular mechanisms and circuit logic. This work underscores the fundamental role of circuits that link self-motion and ongoing behavior to interpretation of the sensory environment.