Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# A computational model of internal representations of chemical gradients in environments for chemotaxis of Caenorhabditis elegans

## Abstract

The small roundworm Caenorhabditis elegans employs two strategies, termed pirouette and weathervane, which are closely related to the internal representation of chemical gradients parallel and perpendicular to the travelling direction, respectively, to perform chemotaxis. These gradients must be calculated from the chemical information obtained at a single point, because the sensory neurons are located close to each other at the nose tip. To formulate the relationship between this sensory input and internal representations of the chemical gradient, this study proposes a simple computational model derived from the directional decomposition of the chemical concentration at the nose tip that can generate internal representations of the chemical gradient. The ability of the computational model was verified by using a chemotaxis simulator that can simulate the body motions of pirouette and weathervane, which confirmed that the computational model enables the conversion of the sensory input and head-bending angles into both types of gradients with high correlations of approximately r > 0.90 (p < 0.01) with the true gradients. In addition, the chemotaxis index of the model was 0.64, which is slightly higher than that in the actual animal (0.57). In addition, simulation using a connectome-based neural network model confirmed that the proposed computational model is implementable in the actual network structure.

## Introduction

The small roundworm Caenorhabditis elegans (C. elegans) represents one of the simplest model animals and is widely used to investigate neural computation. Its body consists of approximately 1000 cells, including 302 neurons with a known connectome1, as well as various types of sensory neurons and motor neurons whose anatomical structures were revealed in the 1970 s2,3, which allow the animal to sense external environments and select appropriate behavioural strategies for survival. Chemotaxis is one of the fundamental abilities of sensing chemical information and approaching a favourable environment based on the sensory information. C. elegans employs two types of behavioural strategies to perform chemotaxis. Pirouette is a strategy characterised by a series of behaviours starting with backward movement followed by sharp turns to change the travelling direction, and its occurrence depends on the chemical gradient parallel to the travelling direction of the body4. Weathervane represents a strategy of making a gradual curve toward a chemical peak, where the curving rate depends on the chemical gradient perpendicular to the travelling direction of the body5. If multiple sensory neurons are located spatially apart from each other, the gradients could be internally represented by the difference between their responses. However, the sensory neurons, for example, ASEL and ASER in the case of salt chemotaxis, are located in close proximity at the nose tip. Therefore, the neural network is required to calculate and internally represent two types of gradients using the temporal responses of the sensory neurons.

The input to a pair of interneurons (AIYL and AIYR) may play this role, as suggested by a study by Kocabas et al.6, which found that the symmetric input to the neurons changes the frequency of pirouette and that the asymmetric input controls the curving rate. In addition, model studies have predicted neural processing related to the weathervane strategy. Ferrée et al.7 constructed a simple nonlinear neural-network model to enable weathervane, and also extracted its computational rules using the impulse response of a linear neural network8. Morse et al.9 then verified the neural network model by navigating a robot to a light source. Izquierdo and Lockery10 subsequently proposed a simplified network structure that could adjust the curving rate from sensory inputs, and found that the nonlinearity and self-feedback of motor neurons may serve as key mechanisms for this function. Furthermore, their group demonstrated that the neural network model derived from the connectome was also able to perform weathervane11. Xu et al.12 proposed a dynamic neural-network model and simulated attraction and avoidance behaviour; in addition, their group recently combined a body dynamics model and a neural network model to enable chemotaxis13.

An understanding of chemotaxis acquired from the previous studies can be interpreted from the viewpoint of Marr’s level of analysis14. The behavioural analysis4,5 highlighted the problem at the computational level that the chemotaxis is closely related to the chemical gradients in the environments. The neural activity measurements6 revealed the phenomena at the implementational level. The simulation approaches7,8,9,10,11,12 analysed the information-processing mechanism at the algorithmic and implementational levels. However, these approaches did not directly treat the algorithm to calculate chemical gradients in the environments, which was explicitly or implicitly assumed given in the computational level. In other words, the relationships between the sensory input at the nose tip of C. elegans and internal representations of the two types of chemical gradients in the environments closely related to the observed strategies have not been formulated explicitly. Therefore, a gap exists between computational and implementational levels. Further, most previous models focused on revealing the mechanism of the weathervane and did not simulate the pirouette simultaneously.

This paper presents a simple and comprehensive computational model based on the motion of the animal involved in chemotaxis to bridge the gap of understanding between computational and implementational levels. The ability of the computational model to convert sensory inputs at the nose tip of C. elegans into internal representations of the chemical gradient parallel and perpendicular to the travelling direction was verified using a chemotaxis simulator that can simulate the body motions of pirouette and weathervane. The chemotaxis performance of the model was compared with previous experimental data5. For additional analysis of the implementational level, a connectome-based neural network model was constructed to test whether the computation could be implemented. Based on these results, we also discuss the relationship between the proposed computational model and the findings of the experimental6 and model11 studies.

## Results

### Chemical gradient with respect to the travelling direction derived from the NaCl concentration at the nose tip

Behavioural experiments revealed that pirouette and weathervane strategies are closely related to the chemical gradients parallel and perpendicular to the travelling direction4,5, respectively, but how can these gradients related to the traveling direction be obtained by using only the information accessible by the animal? To answer this question, we focused on the fact that ASEL/R responds to the time derivative of NaCl concentration, and the time derivative can be approximated by a directional derivative (see S2 Appendix 2 for the detailed derivation process). The internal representation of the gradients can then be obtained by decomposing the directional derivative of NaCl concentration sensed at the nose tip into the directional components parallel and perpendicular to the travelling direction. Based on this idea, a computational model is derived by using the directional derivative and first mean value theorem for definite integrals. The derived computational model is expressed by equations (1) and (2), to describe the relationships between the chemical concentration sensed at the nose tip and the internal representations of the chemical gradient in the environments, respectively.

$$\frac{d{y}_{p}}{dt}=-\,{a}_{p}{y}_{p}+{b}_{p}\frac{dc({{\boldsymbol{x}}}_{0},t)}{dt}+{{\epsilon }}_{p}$$
(1)
$$\frac{d{y}_{w}}{dt}=\{\begin{array}{c}-{a}_{w}{y}_{w}+{b}_{w}\frac{dc({{\boldsymbol{x}}}_{0},t)}{dt}+{{\epsilon }}_{w}\,\,({q}_{0} > 0)\\ -{a}_{w}{y}_{w}-{b}_{w}\frac{dc({{\boldsymbol{x}}}_{0},t)}{dt}+{{\epsilon }}_{w}\,\,({q}_{0}\le 0)\end{array}$$
(2)

where yp and yw are the internal representations of the gradients parallel and perpendicular to the travelling direction at the body centre, respectively, and q0 is the head-bending angle (cf. Materials and Methods; Multibody model); ap and aw are the reciprocals of the time constants that smooth the time derivative of the NaCl concentration sensed at the nose tip, and bp and bw are the gain constants to scale the inputs. The parameters in the model were adjusted and then set as follows: ap = 0.58, aw = 0.73, bp = 1.20, bw = 1.46. Because the derivation process involves several assumptions and approximations, we use $${{\epsilon }}_{p}$$ and $${{\epsilon }}_{w}$$ to express the accumulated approximation errors (see S2 Appendix 2).

The computational model can be interpreted as follows: Equation (1) works as a low-pass filter to eliminate the head-bending component, and equation (2) allows the comparison of the NaCl concentration between the ventral and dorsal sides using head-bending angles required to calculate the internal representation of the gradient perpendicular to the travelling direction (note that C. elegans lies on its side and navigates by dorsoventral motions).

To test the computational model, a chemotaxis simulation involving both weathervane and pirouette strategies was performed by using a multibody model of C. elegans and the chemical environmental model.

### Chemotaxis simulation using the multibody model

To evaluate the computational model represented by equations (1) and (2), it is necessary to determine the true chemical concentration at the nose tip and responses of sensory neurons (ASEL and ASER) as well as internal representations of the gradient. However, it is difficult to retrieve this information using experimental approaches. Therefore, we constructed a chemotaxis simulator including a multibody model that can perform motions related to pirouette and weathervane and an environmental model that can simulate the NaCl distribution on the agar plate (cf. Materials and methods, Chemotaxis simulator). This method enables the verification of the computational model at the behavioural level without measurement of internal representations of the gradients in the actual neural network. Figure 1a shows travelling path examples of the body centre obtained by chemotaxis simulation using the chemotaxis simulator. The chemotaxis simulation was repeated 10 times. In this simulation, the internal representation of the gradients parallel and perpendicular to the travelling direction were calculated using the computational model (equations (1) and (2)), and the calculated values were used to control the motion of the body model to perform pirouette and weathervane. The average travelling speed of the model was 1.28 ± 0.09 mm/s, which is consistent with the experimental data5. Figure 1b compares the chemotaxis index between the body model and the animals. Based on the previously defined chemotaxis index5, it is calculated as (Tin − Tout)/Ttotal, where Tin is the time spent within $$\sqrt{(2/{\rm{\pi }})}$$ cm from any NaCl peak, Tout is time spent outside the area, and Ttotal is the total simulation and experiment time, which is 1200 s in this case. The figure confirms a chemotaxis index of 0.64 ± 1.38 for the simulation. A comparison between the multibody model and the animal is presented in Supplemental Information S3 from the following aspects: the pirouette motion of the multibody model, a relationship between the curving rate and the gradient perpendicular to the traveling direction, a relationship between the bearing angles and the sharp turn angle, and evaluation of the error caused by converting body postures into the travelling path by using the multibody model.

The true values of the gradients parallel and perpendicular to the travelling direction, denoted as $${y}_{p}^{G}$$ and $${y}_{w}^{G}$$, respectively, were then geometrically calculated based on the chemotaxis simulation path of the body centre, using equations (14)–(17), as described in Materials and Methods (Geometrical calculations of NaCl gradient), and compared with the internal representation of the gradients calculated using the computational model (equations (1) and (2)). Figure 2 shows comparison examples. The figure confirms a high correlation of r = 0.91 (p < 0.01) and r = 0.89 (p < 0.01) for the gradients parallel and perpendicular to the travelling direction, respectively. The average correlations over 10 chemotaxis simulations were r = 0.90 ± 0.03 and r = 0.91 ± 0.02, and the average root mean square error (RMSE) values were 1.71 ± 0.32 × 10−6 mM/s and 0.14 ± 0.01 × 10−3 mM/cm, for the respective gradients.

The computational model was derived based on several assumptions and approximations regarding the inputs. We thus tested input (q0, dc(x0, t)/dt) dependency of the errors, as shown in Fig. 3. Here, the errors are defined as $${e}_{p}={y}_{p}^{G}-{y}_{p}$$ and $${e}_{w}={y}_{w}^{G}-{y}_{w}$$, respectively, for the gradient parallel and perpendicular to the travelling direction. The figure confirms low correlations between the inputs and the errors. The average correlations of the 10 simulation results are as follows:

• q0 vs ep: 0.01 ± 0.02

• dc(x0, t)/dt vs ep: 0.08 ± 0.05

• q0 vs ew: 0.01 ± 0.02

• dc(x0, t)/dt vs ew: 0.1 ± 0.06

*p < 0.001 for all correlations.

These results demonstrate low correlations between the errors and inputs, indicating almost no input dependency.

### Generating internal representations of the chemical gradient based on the neural network structure of C. elegans

The computational model indicates that generating the internal representation of NaCl gradients requires the time derivative of NaCl concentration at the nose tip and head-bending angle. We thus tested whether the connectome-based neural network exhibited the ability to generate the internal representations from this information. A neural network model was constructed based on the neural connection structure derived from WormAtlas15 and neurons included in the model are were chosen based on those treated in Iino and Yoshida5. The simulation results were then compared with the computational model described by equations (1) and (2). The structure of the network model is shown in Fig. 4.

The model considers the response characteristics of sensory neurons ASEL and ASER using equations (20)–(21) (cf. Materials and Methods, Neural network model) based on measured data16. In addition, although previous studies4,6,7 suggested that the gradients are not directly coded in the neural network of C. elegans, to facilitate the evaluation of the implementability of the computational model in the neural network, we assumed that the interneurons explicitly represent these gradients. In this case, PVC(L/R) and AVB(L/R) interneurons were assumed to output the gradient parallel to the travelling direction because these neurons are responsible for controlling forward motion17 and may inhibit backward motion followed by a sharp turn. In addition, the RIA(L/R) and AIZ(L/R) interneurons were assumed to output the gradient parallel to the travelling direction because these neurons control head bending1,18, which can generate turning bias. The model considers both chemical synapse connections and gap junctions; these connection weight parameters were trained using back-propagation through a time algorithm19 modified to simultaneously train the parameters of both gap junctions and chemical synapses. The training datasets were generated using data from the chemotaxis simulation performed using the multibody model, wherein the inputs were the NaCl concentration sensed at the nose tip of the multibody model and the head-bending angles, and the teacher signals comprised true chemical gradients that were geometrically calculated from the path of the body centre obtained from the chemotaxis simulation.

Figure 5a,b show an example of comparison results between the output of the trained neural network model and the true chemical gradients, where the data in the time interval of 0–300 s are used for training the neural network and the data in the remaining 300 s are used to validate generality. The result confirmed the correlations of r = 0.94 (p < 0.01) and r = 0.99 (p < 0.01) for the gradients parallel and perpendicular to the travelling direction in the training interval, and r = 0.92 (p < 0.01) and r = 0.95 (p < 0.01) for the gradients parallel and perpendicular to the travelling direction in the validation interval, respectively. The average correlations over 10 chemotaxis simulation datasets were r = 0.91 ± 0.04 and r = 0.97 ± 0.03 for the gradients parallel and perpendicular to the travelling direction in the training interval, and r = 0.89 ± 0.04 and r = 0.91 ± 0.03 for the gradients parallel and perpendicular to the travelling direction in the validation interval, respectively. It should be noted that the gradients were normalised to a range of [−0.5, 0.5] considering the output range of the sigmoid function used in the neural network model.

Finally, we compared the computational model with the neural network model. For this comparison, the outputs of the computational model (equations (1) and (2)) were calculated for the 10 chemotaxis-simulation datasets using the previously described parameters. Figure 6a,b show examples of the outputs of the neural-network model and the computational model. Figure 6c shows the correlations between the outputs of the neural network model and those of the computational model where the average correlations were r = 0.93 ± 0.04 for both gradients parallel and perpendicular to the travelling direction and p < 0.01 for all simulation datasets.

## Discussion

### Relationship between NaCl concentration at the nose tip and the internal representations of chemical gradients

This paper presents the computational model that can describe the relationships between the chemical concentration sensed at the nose tip of C. elegans and the internal representations of chemical gradients closely related to pirouette and weathervane strategies, and tests if the computational model is implementable in the connectome-based neural network model. This analysis concept is based on Marr’s level of analysis where the computational model corresponds to the analysis on the computational level, and the neural network simulation corresponds to the analysis on the implementational level.

To verify the computational model, we constructed a chemotaxis simulator which includes the environment model expressing NaCl distribution and the multibody model of C. elegans. The results shown in Fig. 1 and the supplemental data indicate that the chemotaxis simulator has the ability to simulate the behaviour during chemotaxis, and is therefore applicable for testing equations (1) and (2). Figure 2 then confirms that equations (1) and (2) could convert the NaCl concentration sensed at the nose tip into the internal representation of the NaCl gradient parallel and perpendicular to the travelling direction. Equation (2) indicates that generating the internal representation of the gradient perpendicular to the travelling direction requires the head-bending angle. It is commonly considered that head bending is generated by a central pattern generator20 involving stretch receptors21; thus, its information may be obtained through these neurons.

The derivation process (see S2 Appendix 2) shows that the directional decomposition of the time derivative of NaCl concentration requires cosine (symmetric) and sine (asymmetric) functions of the head-bending angle, respectively, for parallel and perpendicular to the travelling direction. Similar decomposition process could be performed in the pair of AIY neurons or their upstream neurons because the results of an experimental study6 indicated that the symmetric input of the pair of AIY neurons controls the pirouette frequency and the asymmetric input controls the gradual turn (weathervane).

In addition, one of the findings of the model study by Izquierdo & Beer11 indicated that the asymmetrical response characteristics of the ventral and dorsal motor neurons are required to perform gradual turns (weathervane). That is, the response characteristic of either side of the motor neuron would be shifted to the region of lower sensitivity and the other side to that of higher sensitivity, by the sensory input, so that the motor neurons generate a biased sinusoidal wave to regulate body motion. From the computational model (equation (2)), it can be interpreted that the motor neurons perform the directional decomposition, and the gradient parallel to the travelling direction is coded in the motion of the animal.

As described above, the proposed computational model suggests that both findings obtained from the observation of AIY neurons and motor neurons in the simulation could be explained by directional decomposition. From the viewpoint of Marr’s level of analysis, the computational model can bridge the gap between the problem defined in the computational level and implementational level.

### Generating internal representations of chemical gradients based on the neural network structure of C. elegans

Figure 5 confirms that the training algorithm successfully adjusted the parameters of the neural network model and that it could internally represent gradients with respect to the travelling direction using the NaCl concentration sensed at the nose tip and the head-bending angle. High correlations between the respective gradients generated by the computational model, neural network model, and geometrical calculation (shown in Fig. 6) indicate that the computational model can be implemented in the connectome-based neural network.

### Limitation

In the neural network model, AVB and PVC were assumed to output the gradient parallel to the travelling direction. However, in the measurement experiments, activities in these neurons were observed despite the absence of a gradient22, which indicates that AVB and PVC are redundant in the calculation of the gradients. We confirmed this redundancy by excluding AVB and PVC from the connectome-based neural network model, setting AIY as the output neuron, and readjusting the parameters. Accordingly, AIY generated the gradient parallel to the travelling direction with a correlation of 0.98 (p < 0.001), indicating that the computational model could be implemented with various parameter sets. This redundancy in the parameter space limits the analysis of the contribution of the respective neuron to chemotaxis.

The parameters of the multibody model and motions such as body forms and reversal durations are chosen such that the body model can approximate the motions of the actual animal as close as possible (see Supplemental Information S3). Although the approximation error affects the analysis results, the error of generated gradients (see Fig. 2) caused by the multibody model may be partial (see Fig. S5 in Supplemental Information S3). The modelling error, however, is inevitable in a process to approximate the motion of C. elegans. To reduce the modelling error, merging the simulation and experimental approaches can be a candidate solution for future research. In addition, the motion of the multibody model was given by a sinusoidal function, as shown in equations (5) and (6) in Material and Methods: Chemotaxis simulator. Thus, the model ignores small random wriggling motions of the nose tip that can be observed in the actual animal. As the sensory neurons are located at the nose tip, this motion can affect the sensory inputs. However, this evaluation is not performed in this study.

## Conclusion

In this study, a simple and comprehensive computational model was derived to convert the response of a single sensory input into two types of internal representations of the NaCl gradient parallel and perpendicular to the travelling direction and enabled simultaneous simulation of the pirouette and weathervane strategies. The derived computational model suggests that internal representations of the gradients can be generated by combining head-bending angles and sensory input from ASEL/R neurons. It could also be used to interpret the functions of AIY neurons and motor neurons, respectively, identified in previous experimental6 and simulation studies11, and thus can bridge the gap between the chemotaxis problems at the computational and implementational levels.

The connectome-based neural network model included in the chemotaxis simulator demonstrated that the computational model could be implemented in it, although the coding manner of the chemical gradient might differ from that of the actual animals. The connectome-based neural network model may allow further analysis of the functions of respective neurons by introducing the biological constrictions and measured neural activities and by simulating ablation experiments.

## Materials and Methods

To evaluate the derived computational model [equations (1) and (2)], we developed a chemotaxis simulator including the multibody and environmental models. The body model can perform both weathervane and pirouette motion. The NaCl chemical gradients parallel and perpendicular to the travelling direction in an environment, which are called a true gradient in this paper, were calculated from the simulated body centre path. To test the implementability of the proposed computational model under actual neural structure representations, a connectome-based neural network model was constructed. All simulations described in this study were performed using MATLAB 2013. Model parameters are given in S1 Appendix 1. The following text explains each part of the chemotaxis simulator, simulation method, and neural network model.

### Chemotaxis simulator: Multibody model

C. elegans body was approximated using a multibody model, as shown in Fig. 7, defined by the following Newton-Euler equations based on a previous study23:

$${\boldsymbol{I}}({\boldsymbol{q}})\frac{{d}^{2}{\boldsymbol{x}}}{d{t}^{2}}+{\boldsymbol{h}}({\boldsymbol{q}},\frac{d{\boldsymbol{q}}}{dt})+{\boldsymbol{g}}({\boldsymbol{q}})={\boldsymbol{\rho }}+\sum _{j}\,{{\boldsymbol{J}}}_{{\boldsymbol{j}}}^{{\bf{T}}}{{\boldsymbol{F}}}_{{\boldsymbol{j}}},$$
(3)
$${{\boldsymbol{I}}}_{{\rm{g}}}({\boldsymbol{q}})\frac{{d}^{2}{{\boldsymbol{x}}}_{{\boldsymbol{g}}}}{d{t}^{2}}+{{\boldsymbol{h}}}_{{\rm{g}}}({\boldsymbol{q}},\frac{d{\boldsymbol{q}}}{dt})+{{\boldsymbol{g}}}_{{\rm{g}}}({\boldsymbol{q}})=\sum _{j}\,{{\boldsymbol{F}}}_{{\boldsymbol{j}}},$$
(4)

where x = [xi, yi]T represents the i-th body centroid position, xg = [xg, yg]T represents the body centre position, q = [q0, q1, …, qL−1]T represents the angles between adjacent modules, I(q) and Ig(q) represent the inertia matrix, $${\boldsymbol{h}}({\boldsymbol{q}},\frac{d{\boldsymbol{q}}}{dt})$$ and $${{\boldsymbol{h}}}_{{\rm{g}}}({\boldsymbol{q}},\frac{d{\boldsymbol{q}}}{dt})$$ are centrifugal and Coriolis force terms, g(q) and gg(q) are gravity force terms, ρ = [ρ0, ρ1, …, ρL−1]T is the driving torque generated from the motors, Fj = [FT,j, FN,j] is the friction vector between the floor and the j-th body, and Jj is the Jacobian matrix. Please note that we omit the explicit notation of time dependence of the variables for simplification, but all variables depend on time in equations (3) and (4). The parameters related to inertia, centrifugal, Coriolis, and gravity forces are determined based on animal size and weight (Tables in S1 Appendix 1). The friction forces were determined based on the average velocity of the animal on the chemotaxis plate (0.12 mm/s)5.

### Chemotaxis simulator: implementing pirouette and weathervane

Body model motion is controlled by a sinusoidal function determining each i-th joint angle qi(t).

$${q}_{i}(t)={q}_{{\rm{Max}}}\,\sin \,(\omega t-{\varphi }_{i}(t))+\kappa (t),$$
(5)
$${\varphi }_{i}(t)=-\,2\pi \psi \,(i-1),$$
(6)

where qMax is the maximum joint bending angle, ω determines the angular velocity of bending, ϕi(t) determines the wavelength of the animal body as well as switching between forward and backward motion, and ψ (in rad) is determined by the measured body wavelength24. The bias parameter κ(t) = κw(t) + κR(t) is determined by the weathervane turning rate κw(t) and random walk κR(t). Pirouette and weathervane were implemented by changing ϕi(t) and κ(t) as follows:

Weathervane.

$${\kappa }_{w}\,(t)=-\,{C}_{w}{d}_{s}\,(t)$$
(7)

where ds(t) (in mM/mm) represents the gradient perpendicular to the traveling direction and Cw is derived from the measured weathervane curvature5.

#### Pirouette

Pirouette frequency fp(t) (in events/s) is given by the following equation5:

$${f}_{p}\,(t)=\frac{0.023}{0.4+\exp \,(140{d}_{t}(t))}+0.0033$$
(8)

where dt(t) (in mM/s) is the gradient parallel to the travelling direction. A uniform random number R(t)  [0, 1] is generated every sampling time and pirouette is initiated if R(t) < fp(t).

The pirouette starts with backward motion by switching the phase ϕi(t) using the following equation:

$${\varphi }_{i}(t)=\pi +2\omega {T}_{p0}-{\varphi }_{i}({T}_{p0})$$
(9)

where Tp0 is the pirouette initiation time. The backward motion lasts for Tb = 6.0 s because measurement data indicate that most sharp turns occur after a long reversal with around three head-bending cycles25 and their probability is approximately 90% after 6.0 s of backward motion26. When the backward motion is finished, equation (9) is applied again to switch back to forward motion.

A sharp turn is then initiated after the backward motion using the following equation:

$${\varphi }_{i}\,(t)=\{\begin{array}{l}{\varphi }_{i}\,(t-{\rm{\Delta }}t)+\frac{{C}_{p}}{{T}_{P1}}{\rm{\Delta }}t,\,{T}_{{\rm{\Omega }}0} < t < {T}_{{\rm{\Omega }}1}\,\\ \,{\varphi }_{i}\,(t),\,\,\,{T}_{{\rm{\Omega }}1} < t < {T}_{{\rm{\Omega }}2}\\ {\varphi }_{i}\,(t-{\rm{\Delta }}t)-\frac{{C}_{p}}{{T}_{P1}}{\rm{\Delta }}t,\,{T}_{{\rm{\Omega }}2} < t < {T}_{{\rm{\Omega }}3}\end{array}$$
(10)

where TΩ0 = Tp0 + Tb is the sharp turn initiation time, TΩ1 = TΩ0 + Tp1, TΩ2 = TΩ1 + Tp2, and TΩE = TΩ2 + Tp3 are duration parameters for linearly changing the ϕi(t), and Cp is the maximum phase delay. The total sharp turn duration is set to TΩE − TΩ0 = 3.18 s, and Cp was adjusted to generate turns larger than 1.75 rad based on definitions from a previous study5. Temporal changes in φi(t) allow the body shape to change from the S shape to the Ω shape and back, as illustrated in Fig. S2 in Supplemental Information S3.

#### Random walk

The random walk was introduced based on measured curvature in the absence of a chemical gradient as in the following equations:

$${\kappa }_{T}=N(0,{C}_{r})$$
(11)
$${\kappa }_{R}\,(t)={\kappa }_{R}\,(t-{\rm{\Delta }}t)+\frac{{\kappa }_{T}-{\kappa }_{T-1}}{{\rm{\Delta }}T}$$
(12)

Based on simulations performed by Iino and Yoshida5, a random curvature parameter bT was chosen every ΔT = 12 s and linearly altered for every sampling time Δt (in s).

#### Chemotaxis simulator: Environmental model

The environmental model and its parameters were derived from a previous study5. NaCl concentration at an arbitrary position x can be calculated by solving Fick’s equation as follows:

$$c\,(x,t)={N}_{0}\sum _{k=1}^{K}\,\frac{\exp (-\frac{|{\boldsymbol{x}}-{{\boldsymbol{x}}}_{k}|}{{r}_{1}Dt})}{{r}_{2}EDt}$$
(13)

where N0 is the NaCl solution concentration, D is the NaCl diffusion coefficient, E is the agar plate thickness, and xk is the coordinate of the k-th NaCl point.

Chemotaxis simulations were performed after 3600 s of NaCl diffusion, with each being performed for 1200 s and repeated 10 times using the multibody model. Notably, NaCl continued to diffuse during the simulation based on equation (13).

### Chemotaxis simulator: Simulation procedure and gradient calculation

#### Simulation

Chemotaxis simulation was performed according to the following procedure, wherein the time step was set to 0.01 s.

1. 1.

The multibody model was placed in the environmental model centre [xg=(xg, yg)=(0, 0)].

2. 2.

The multibody model posture was calculated by using equations (5) and (6).

3. 3.

The dynamics were calculated by solving equations (3) and (4) and used to update the current position xg.

4. 4.

NaCl concentration at the nose tip (x0) was calculated by using equation (13).

5. 5.

Nose tip NaCl concentration was converted into the internal representation of the gradients parallel and perpendicular to the travelling direction by using the proposed computational model (equations (1) and (2)).

6. 6.

Pirouette initiation was judged by using equation (8)

7. 7.

Pirouette was simulated by using equations (9) and (10); otherwise, weathervane was simulated by using equation (7) and random walk by using equations (11) and (12).

8. 8.

Steps 2–7 were iteratively implemented for each succeeding time step until the total simulation time of 1200 s was attained.

### Geometrical calculation of NaCl gradient

Using the environmental model, the true gradient parallel to the travelling direction $${y}_{p}^{g}$$ was geometrically calculated as follows:

$${y}_{p}^{g}=\frac{c({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t),t)-c({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t-{\rm{\Delta }}t),t-{\rm{\Delta }}t)}{{\rm{\Delta }}t},$$
(14)

The true gradient to the travelling direction $${y}_{w}^{g}$$ was also geometrically calculated as follows:

$${y}_{w}^{g}=\frac{c({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)+{\rm{\Delta }}{{\boldsymbol{x}}}_{{\boldsymbol{v}}},t)-c({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)+{\rm{\Delta }}{{\boldsymbol{x}}}_{{\boldsymbol{d}}},t)}{2\delta },$$
(15)
$${\rm{\Delta }}{{\boldsymbol{x}}}_{{\boldsymbol{v}}}(t)=\delta \frac{[\begin{array}{cc}0 & 1\\ -1 & 0\end{array}]({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)-{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t-{\rm{\Delta }}t))}{|{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)-{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t-{\rm{\Delta }}t)|},$$
(16)
$${\rm{\Delta }}{{\boldsymbol{x}}}_{{\boldsymbol{d}}}(t)=-\,\delta \frac{[\begin{array}{cc}0 & 1\\ -\,1 & 0\end{array}]({{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)-{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t-{\rm{\Delta }}t))}{|{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t)-{{\boldsymbol{x}}}_{{\boldsymbol{g}}}(t-{\rm{\Delta }}t)|},$$
(17)

where xg(t) − xg(t − Δt) is the body centre travelling direction and δ is a small displacement; thus Δxv(t) and Δxd(t) are the vectors perpendicular to the travelling direction.

### Neural network model

The neural network model shown in Fig. 4 was defined based on the actual connection structure derived from WormAtlas15 considering both synaptic connections and gap junction, and neurons included in the model were derived from Iino and Yoshida5. The model receives inputs of the head-bending angles and NaCl concentration at the nose tip of the multibody model from RIV(L/R) and amphid sensory neurons ASE(L/R), respectively. The ASEL and ASER responses are determined from the previous experimental data16 and sent to the interneurons in both amphid and nerve ring. To facilitate the evaluation of implementability of the computational model on the neural network, we assumed that the interneurons could directly generate the gradients, although previous studies6,10,11 have suggested that these gradients are not directly coded in the C. elegans neural network. In this case, PVC(L/R) and AVB(L/R) interneurons were assumed to output the gradient parallel to the travelling direction because these neurons are responsible for controlling forward motion17 and may inhibit backward motion followed by a sharp turn. Additionally, interneurons RIA(L/R) and AIZ(L/R) were assumed to output the gradient perpendicular to the travelling direction because these neurons control head bending1,13, which can generate turning bias. The following equations give a mathematical definition of the neural network model:

The dynamic characteristic of a neuron is given as follows:

$$\begin{array}{rcl}{u}_{i}(t+1) & = & \tfrac{1}{1+{T}_{s}{\tau }_{i}}{u}_{i}(t)+\tfrac{{T}_{s}}{1+{T}_{s}{\tau }_{i}}\{\sum _{j}^{n+m}\,{w}_{ij}{z}_{j}(t)+\sum _{j}^{n}\,{s}_{ij}({u}_{j}(t)-{u}_{i}(t))\}\\ & & +\,\tfrac{1}{1+{T}_{s}{\tau }_{i}}\{\sum _{j}^{n+m}\,{w}_{ij}^{d}({z}_{j}(t)-{z}_{j}(t-1))\},\end{array}$$
(18)
$${U}_{i}(t+1)=\frac{1}{1+\exp (-{u}_{i}(t+1))},$$
(19)

where ui(t) corresponds to the electrical current to the i-th neuron, Ui(t) corresponds to the membrane potential, Ts is the sampling time, τi is the time constant caused by leakage current, wij, and $${w}_{ij}^{d}$$ are the chemical synapse connection strengths from the j-th to the i-th neuron, sij = sji is the conductance of a gap junction, n is the total number of neurons, and m is the total input number. Additionally, zj(t) = uj(t) when j ≤ n, and zj(t) = Ijn(t) when n < j ≤ n + m where Ij(t) is the external input including NaCl concentration and head-bending angle q0(t).

ASER and ASEL neurons were modelled based on the experimental data16 as follows:

$${I}_{1}(t)=\{\begin{array}{c}{a}_{L}\,\mathrm{log}({b}_{L}\frac{dc}{dt}+1),\,\frac{dc}{dt} > 0\\ 0\,\,\,\,\,\frac{dc}{dt}\le 0\end{array},$$
(20)
$${I}_{2}(t)=\{\begin{array}{ll}{a}_{R}^{+}\,\mathrm{log}({b}_{R}^{+}\frac{dc}{dt}+1),\, & \frac{dc}{dt} > 0\\ {a}_{R}^{-}\,\mathrm{log}({b}_{R}^{-}\frac{dc}{dt}+1) & \frac{dc}{dt}\le 0\end{array},$$
(21)

where I1(t + 1) and I2(t + 1) represent inputs to ASEL and ASER neurons, respectively. dc/dt is the NaCl concentration time derivative at the nose tip. The parameters $${a}_{L},\,{b}_{L},\,{a}_{R}^{+},\,{b}_{R}^{+},\,{a}_{R}^{-},\,{b}_{R}^{-}$$ are adjusted to fit the response peaks of ASEL and ASER neurons. Figure 8 shows the fitting results, which confirms that the model could generate a response similar to the experimental data16.

Adjustments of chemical synapse connections wij and gap junctions sij were performed using back-propagation through a time algorithm, which uses the chain-rule of partial differential on the following evaluation function:

$$H=\frac{1}{2}\sum _{t=1}^{T}\,\sum _{i=1}^{n}\,{\mu }_{i}{({U}_{i}(t)-{d}_{i}(t))}^{2}$$
(22)

where μi = 1 if index i corresponds to the neuron that outputs a gradient either parallel or perpendicular to the traveling direction; otherwise μi = 0, di(t) is the target gradient that is desired to be outputted from the corresponding neuron. The chemical gradient is normalised to produce di(t) by using the following equations as the output values of a neuron model are in the range of [0, 1].

$${d}_{i}(t)=\frac{{c}_{\zeta }(t)-\mathop{{\rm{\min }}}\limits_{t}({c}_{\zeta }(t))}{\mathop{{\rm{\max }}}\limits_{t}({c}_{\zeta }(t))-\mathop{{\rm{\min }}}\limits_{t}({c}_{\zeta }(t))},$$
(23)

where cζ is a gradient either parallel or perpendicular to the traveling direction. The parameters wij, sij, τi are then iteratively updated based on the partial differential of H by the following equations:

$${w}_{ij}\leftarrow {w}_{ij}-{\eta }_{w}\frac{\partial H}{\partial {w}_{ij}},$$
(24)
$${s}_{ij}\leftarrow {s}_{ij}-{\eta }_{g}(\frac{\partial H}{\partial {s}_{ij}}+\frac{\partial H}{\partial {s}_{ji}}),$$
(25)
$${\tau }_{i}\leftarrow \{\begin{array}{cc}{\tau }_{i}-{\eta }_{\tau }\frac{\partial H}{\partial {\tau }_{i}}, & {\tau }_{i} > 0\\ 0 & {\tau }_{i}\le 0\end{array},$$
(26)

where ηw, ηg, ητ represent the learning rate. As shown in the above equations, the gap junction is constrained to sij = sji, and the time constant is constrained to τi > 0.

## References

1. 1.

White, J. The Anatomy in The nematode C. elegans (ed. Wood, W. B.), Chapter 4, 81–122 (Cold Spring Harbor Laboratory Press, 1988).

2. 2.

Ward, S., Thomson, N., White, J. G. & Brenner, S. Electron microscopical reconstruction of the anterior sensory anatomy of the nematode Caenorhabditis elegans. J. Comp. Neurol. 160, 313–337 (1975).

3. 3.

Ware, R. W., Clark, D., Crossland, K. & Russell, R. L. The nerve ring of the nematode Caenorhabditis elegans: sensory input and motor output. J. Comp. Neurol. 162, 71–110 (1975).

4. 4.

Pierce-Shimomura, J. T., Morse, T. M. & Lockery, S. R. The fundamental role of pirouettes in Caenorhabditis elegans chemotaxis. J. Neurosci. 19, 9557–9569 (1999).

5. 5.

Iino, Y. & Yoshida, K. Parallel use of two behavioral mechanisms for chemotaxis in Caenorhabditis elegans. J. Neurosci. 29, 5370–5380 (2009).

6. 6.

Kocabas, A., Shen, C. H., Guo, Z. V. & Ramanathan, S. Controlling interneuron activity in Caenorhabditis elegans to evoke chemotactic behaviour. Nature. 490, 273–277 (2012).

7. 7.

Ferrée, T. C., Marcotte, B. A. & Lockery, S. R. Neural network models of chemotaxis in the nematode Caenorhabditis elegans. Adv. Neural. Inf. Process Syst. 9, 55–61 (1997).

8. 8.

Ferrée, T. C. & Lockery, S. R. Computational rules for chemotaxis in the nematode C. elegans. J. Comput. Neurosci. 6, 263–277 (1999).

9. 9.

Morse, T. M., Lockery, S. R. & Ferrée, T. C. Robust spatial navigation in a robot inspired by chemotaxis in Caenorhabditis elegans. Adapt. Behav. 6, 393–410 (1998).

10. 10.

Izquierdo, E. J. & Lockery, S. R. Evolution and analysis of minimal neural circuits for klinotaxis in Caenorhabditis elegans. J. Neurosci. 30, 12908–12917 (2010).

11. 11.

Izquierdo, E. J. & Beer, R. D. Connecting a connectome to behavior: an ensemble of neuroanatomical models of C. elegans klinotaxis. PLoS Comput. Biol. 9, e1002890 (2013).

12. 12.

Xu, J. X., Deng, X. & Ji, D. Study on C. elegans behaviors using recurrent neural network model. In 2010 IEEE Conference on Cybernetics and Intelligent Systems. 1–6, https://doi.org/10.1109/ICCIS.2010.5518591 (IEEE, 2010).

13. 13.

Deng, X., Xu, J. X., Wang, J., Wang, G. & Chen, Q. Biological modeling the undulatory locomotion of C. elegans using dynamic neural network approach. Neurocomputing. 186, 207–217 (2016).

14. 14.

Marr, D. & Poggio, T. From understanding computation to understanding neural circuitry. Neurosci. Res. Program. Bull. 15, 470–488 (1977).

15. 15.

Altun, Z. F. et al. WormAtlas (eds) 2002–2016, http://www.wormatlas.org [accessed2016 Mar 30].

16. 16.

Suzuki, H. et al. In vivo imaging of C. elegans mechanosensory neurons demonstrates a specific role for the MEC-4 channel in the process of gentle touch sensation. Neuron. 39, 1005–1017 (2003).

17. 17.

Chalfie, M. et al. The neural circuit for touch sensitivity in Caenorhabditis elegans. J. Neurosci. 5, 956–964 (1985).

18. 18.

Gray, J. M., Hill, J. J. & Bargmann, C. I. A circuit for navigation in Caenorhabditis elegans. Proc. Natl. Acad. Sci. USA 102, 3184–3191 (2005).

19. 19.

Werbos, P. J. Generalization of backpropagation with application to a recurrent gas market model. Neural Netw. 1, 339–356 (1988).

20. 20.

Karbowski, J., Schindelman, G., Cronin, C. J., Seah, A. & Sternberg, P. W. Systems level circuit model of C. elegans undulatory locomotion: Mathematical modeling and molecular genetics. J. Comput. Neurosci. 24, 253–276 (2008).

21. 21.

Sakata, K. & Sihingai, R. Neural network model to generate head swing in locomotion of Caenorhabditis elegans. Network: Comput. Neural Syst. 15, 199–216 (2004).

22. 22.

Bargmann, C. I. & Horvitz, H. R. Chemosensory neurons with overlapping functions direct chemotaxis to multiple chemicals in C. elegans. Neuron. 7, 729–42 (1991).

23. 23.

Niebur, E. & Erdös, P. Theory of the locomotion of nematodes: control of the somatic motor neurons by interneurons. Math. Biosci. 118, 51–82 (1993).

24. 24.

Fang-Yen, C. et al. Biomechanical analysis of gait adaptation in the nematode Caenorhabditis elegans. Proc. Natl. Acad. Sci. USA 107, 20323–20328 (2010).

25. 25.

Zhao, B., Khare, P., Feldman, L. & Dent, J. A. Reversal frequency in Caenorhabditis elegans represents an integrated response to the state of the animal and its environment. J. Neurosci. 23, 5319–5328 (2003).

26. 26.

Pierce-Shimomura, J. T. et al. Genetic analysis of crawling and swimming locomotory patterns in C. elegans. Proc. Natl. Acad. Sci. USA 105, 2098220987 (2008).

## Acknowledgements

The authors thank the Caenorhabditis Genetic Center for providing strains of C. elegans and E. coli., and members of our laboratories for the valuable discussion. This work was supported by JSPS KAKENHI Grant Number 15H03950 to T.T and MEXT KAKENHI Grant Numbers 20115010 to T.T. and 20115002 to Y.I.

## Author information

Authors

### Contributions

Z.S. and K.S. performed modelling and simulations, analysed and interpreted the data, and wrote the paper. M.S. performed the behavioural experiments, analysed the data, and revised the paper. Y.I. collected the data, interpreted the simulation data, and critically reviewed the paper. T.T. designed the study, conceived simulations, and revised the paper. All authors provided critical feedback and helped shape the research, analysis, and the paper.

### Corresponding authors

Correspondence to Zu Soh or Toshio Tsuji.

## Ethics declarations

### Competing Interests

Kazuma Sakamoto is employee of Sony Corporation. Zu Soh, Michiyo Suzuki, Yuichi Iino, and Toshio Tsuji declare no potential conflict of interest.

Publisher’s note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Soh, Z., Sakamoto, K., Suzuki, M. et al. A computational model of internal representations of chemical gradients in environments for chemotaxis of Caenorhabditis elegans. Sci Rep 8, 17190 (2018). https://doi.org/10.1038/s41598-018-35157-1

• Accepted:

• Published:

### Keywords

• Weathervane
• Pirouette
• Chemotaxis Index