MetaWorm: An Integrative Data-Driven Model Simulating <i>C. elegans</i> Brain, Body and Environment Interactions — part 2/6

Cleaned-text code points [15224, 30273). Bibliography omitted here; source.md includes it.

Coordinate System (SBCS). Then, we computed transformation M between the target body and
the standard body. Finally, we used M to perform three-dimensional transformation on the SBCS
to obtain the TBRCS. Details of this method are described in Methods. Using this method, we can
stably quantify not only the body’s locomotion trajectory (Fig. 7A), but also the body states
including the relative position and velocities of any points on the C. elegans body (Fig. 7B and Fig.
7C) and steering angle (Fig. 7D). For example, figure 7E displays the relative positions of 17
sampled 3D tracking points, while Figure 7F illustrates their corresponding velocities. In Figure
7E, the swing direction of body was Z direction of the TBRCS (dorsal-ventral direction). Also,
there was a spring movement in X direction of the TBRCS (head-tail direction) during forward
locomotion. Locomotion in Y direction of the TBRCS (left-right direction) was nearly flat since
muscle activations were approximately symmetric in this direction. Figure 7F shows that, in this
case, the primary propulsion of forward locomotion originated from tail (pink line), since speed
represented power. Moreover, our method enables the quantification of the body's steering. Figure
7D shows an example of a steering angle θ, which was defined as the angle between TBRCS x-
axis and the direction of velocity. The steering angle θ was also numerically stable.
In summary, our body model is simple yet preserving anatomical authenticity. Our environment
model provides a large-scale 3D scene for simulations. Our simulation is real-time and allows
simulations of C. elegans populations. Importantly, our model facilitates easy quantification of
behaviors.
Replicating locomotion behavior of C. elegans
In our model, we successfully replicated the locomotion behavior of C. elegans by a closed-
loop interaction between the neural network model and the body & environment model.
Specifically, the neural network model sensed the dynamic food concentration in the environment
by sensory neurons. This sensory information was used to calculate the membrane potentials of
motor neurons. The membrane potentials of motor neurons were subsequently translated into
muscle activation signals, which controlled the movement of C. elegans' body to navigate towards
the food in the environment. An overview of this closed-loop simulation is illustrated in Figure 8A.
Notably, we observed that the trajectory of the C. elegans movement in our model closely
resembled the trajectory recorded in the experiments45, with both exhibiting a zigzag pattern (Fig.
8B). Additionally, C. elegans in both the simulations (Supplementary Movie S1 and
Supplementary Movie S2) and experiments exhibited a dorsoventral fluctuation during 3D
movement46,47.
Regarding sensation, we assumed that the food concentration in the environment follows a
linearly distribution. To incorporate this sensory information into our model, we used the
derivative of the food concentration as the amplitude of an external current injected into the soma
of all sensory neurons. Regarding neuromuscular coupling, we employed a linear transformation,
treating the neural network model as a reservoir to generate muscle activities48 (Methods 3.6).
During locomotion, the input of sensory neurons exhibited fluctuations due to the zigzag
movement of the body’s head (Fig. 8C). The membrane potentials of each individual motor neuron
also oscillated in response to the sensory input, especially the head motor neurons (Fig. 8D). The
activation of muscle cells revealed traveling waves from the head to the tail, accompanied by
alternating contractions and relaxations of dorsal and ventral muscle cells (Fig. 8E). These
findings closely resemble observations in biological experiments49. To facilitate visualization, we
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint

have incorporated the locomotion of C. elegans, the activities of its neural network model, and
muscle activities into our graphical user interface (GUI) (Fig. 9).
In summary, our model successfully reproduced locomotion behavior in this closed-loop
simulation and facilitated the visualization and analysis of neuron dynamics, muscle activities, and
behavioral patterns.
Exploring the impact of neural network structure on dynamics and behaviors
We are interested in exploring the extent to which network structure influences the neural
dynamics and behaviors, thus we conducted synthetic perturbations on the structure of our neural
network model. Synthetic perturbations of the neural system often exceed individual tolerance
level in animals. However, our model enables researchers to carry out experiments without
concerns about experimental technique limitations or animal tolerance. Based on MetaWorm, we
performed experiments involving synthetic perturbations to quantitatively examine the impact of
network structure on network dynamics and behaviors.
In the absence of neurites, the body exhibits a higher degree of twisting during locomotion, as
indicated by the larger relative locations of tracking points on the head and tail compared to the
control group. This suggests that neurites play a crucial role in the computations associated with
network information processing (Fig. 10B). Moreover, shuffling connection locations within the
model leads to faster oscillations of the head and tail but slower forward locomotion (Fig. 10C).
This suggests that the specific locations of connections along the neurites are important,
potentially facilitating localized computations within neurons. Additionally, despite the neural
network model contains fewer gap junctions than synapses, the role of gap junctions in C. elegans
neural network appears to be more important than that of synapses (Fig. 10D-G), because
perturbations on gap junctions result in more obvious changes in the Pearson Correlation matrix
compared to perturbations on synapses. Perturbations on gap junctions accelerate the twisting of
the body compared to the control group, whereas perturbations on synapses result in slower
twisting. These results emphasize the importance of network structure in shaping network
dynamics and behavior patterns. By utilizing our model, researchers can gain valuable insights
into the contributions of network structure to neural network.
Discussion
In this study, we present MetaWorm, a data-driven model of C. elegans that integrates models
of neural network, body and environment. The neural network model of MetaWorm is highly
detailed and data-driven, capturing neural population activity patterns and encoding functions
observed in real C. elegans. The body & environment model of MetaWorm is realistic, efficient,
and allows for the quantification of behaviors. Based on the interaction of these two sub-models,
we achieved locomotion behavior in C. elegans. This represents the first time that an integrative
data-driven model replays a behavior with motor control and sensory feedback.
The neural network model of MetaWorm integrated experimental data including ion channel
dynamics, neural morphologies, electrophysiology, connectome, synaptic organization rules on
neurites, as well as neural activities. Although we collected and integrated as much data as
possible up until 2023, there remained a substantial amount of detail that could not be fully
implemented due to lack of data. Also, the physical parameters in body & environment model did
not correspond precisely to those of actual C. elegans, because they were difficult to measure
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint

accurately. However, with the influx of new experimental data, these models can be enhanced and
refined.
For the neuromechanical connections from motor neuron to muscle, the neural network model
served as a reservoir that processed data in a complex and nonlinear way. The input was mapped
onto an output linear layer to produce muscle activation. With only one linear readout layer, the
neural network model successfully controlled the body’s locomotion. This demonstrates the great
information processing ability of our neural network model. In the future, more realistic models of
the neuromuscular junction can be used in our neural network model, reflecting the real synaptic
properties from motor neuron to muscle.
When the input of the neural network model was a periodic standard signal, i.e. without sensory
feedback from the environment, the membrane potentials of motor neurons and the activations of
muscle cells were periodic (Supplementary Figure S1). This resulted in the movement trajectory
of the C. elegans body following a standard Z-shape, which was extremely similar to the
trajectory in the experiment45,50 (Supplementary Figure S1B and Supplementary Movie S3).
Conversely, When the input was a sensory signal dependent on the body’s location in the
environment (Fig. 8), the input was not periodic, leading to non-periodic dynamics in both
neurons and muscle cells. Therefore, the trajectory of the body was not as regular as that observed
in the experiment (Fig. 8B). Future studies will focus on designing more reasonable Central
Pattern Generators (CPGs) or motor control systems to achieve more realistic movement.
Training biophysically detailed neural network model is challenging and consumes much time
and GPU memory resources. In the future, we will improve the optimization algorithm to
effectively train larger detailed neural network that contains all 302 neurons, with more constrains
such as single neuron voltages, and reproduce more behaviors beyond zigzag locomotion.
MetaWorm serves as a white box model of C. elegans. Its two sub-models and their interaction
can be independently modified or extended. We provide researchers with user-friendly interfaces
to design their own model based on their experimental data. Moreover, our model serves as a
valuable reference for designing integrative data-driven models for other animals. In this era of
exponential growth in experimental data, these integrative data-driven models will enable us to
gain a deeper understanding of the neural computation that underlies specific behaviors.
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint

Figures
Fig 1. Overview of MetaWorm.
MetaWorm comprises two sub-models: the neural network model and the body & environment
model. The neural network model is a biophysically detailed. Its neuron models are multi-
compartmental, exhibiting electrophysiological features similar to real C. elegans neurons. These
neuron models are connected by synapses and gap junctions on neurites. An optimization tool is
employed to tune the weights and polarities of these connections. The body & environment model
consists of a biomechanical body, a 3D fluid environment and a real-time simulation engine. The
soft body is constructed using 3341 tetrahedrons, with 96 muscles arranged from head to tail as
actuators. The large-scale 3D environment allows for the integration of various agents and
elements including C. elegans, E. coli (food), and fluid. And it provides a range of auxiliary tools
for dynamic lighting, visualization, tracking, and behavior analysis. Real-time simulation is
achieved through a Finite Element Method (FEM) solver and simplified hydrodynamics. To
achieve foraging behavior in C. elegans, the neural network senses attractor’s concentration in the
environment, performs neural computations to control muscles’ contraction and relaxation, and
ultimately deforms the body to propel it towards the attractor.
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint

Fig 2. Construction of biophysically-detailed neural network model of C. elegans.
A. Experimental data collection to constrain models. These data include neural morphologies, ion
channel models, electrophysiological recordings of single neurons, connectome, connection
models, and neural network activities. B. Construction of multi-compartmental neuron models and
connection models (synapses and gap junctions). C. The biophysically detailed C. elegans neural
network model without functional neural activities. D. Optimization of the biophysically detailed
C. elegans neural network model to achieve realistic network dynamics. Neurons are color-coded
to represent membrane potential.
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint

Fig 3. Models of five representative neurons fitted to electrophysiological recordings in
experiments.
AWC(L), AIY(L), A V A(L),RIM(L), VD5 were selected as the representative neurons for each of
the five functional groups, respectively. Left, 3D morphology of each neuron32,33. Middle,
membrane voltage/current dynamics induced by current or voltage clamp steps. The simulated
responses (blue lines) are overlayed with biological experimental data (gray lines). The
corresponding current or voltage clamp protocol are shown in left. AWC(L): voltage clamp
protocol, in spans of 0.1 s, starting from -10 mV and increasing to 110 mV by 20 mV increments.
AIY(L): current clamp protocol, in spans of 5 s, starting from -15 pA and increasing to 35 pA by 5
pA increments. A V A(L):current clamp protocol, in spans of 5 s, starting from -20 pA and
increasing to 20 pA by 5 pA increments. RIM(L): current clamp protocol, in spans of 5 s, starting
from -15 pA and increasing to 25 pA by 5 pA increments. VD5: voltage clamp protocol, in spans
of 1.2 s, starting from -10 mV and increasing to 40 mV by 10 mV increments. Right, comparison
between experimental (red dot) and simulated (black star) I-V curves, including I-V curve at
steady-state (left) and I-V curve at the time when the rates of voltages/currents change reach a
certain threshold (right). Experimental data are from published articles36-39.
(which was not certified by peer review) is the author/funder. All rights reserved. No reuse allowed without permission. 
The copyright holder for this preprintthis version posted March 10, 2024. ; https://doi.org/10.1101/2024.02.22.581686doi: bioRxiv preprint