Measuring and modeling whole-brain neural dynamics in Caenorhabditis elegans

The compact nervous system of the nematode Caenorhabditis elegans makes it a powerful playground to study how neural dynamics constrained by neuroanatomy generate neural function and behavior. The ability to record neural activity from the whole brain simultaneously in this worm has opened several research avenues and is providing insights into brain-wide neural coding of locomotion, sleep, and other behaviors. We review these ﬁndings and the development of new methods, including new microscopes, new genetic tools, and new modeling approaches. We conclude with a discussion of the role of theory in interpreting or driving new experiments in C. elegans and potential paths forward.


Introduction
Small transparent organisms have played a starring role in studies of brain-wide neural activity. After larval zebrafish [1,2], the nematode Caenorhabditis elegans became the second organism in which whole-brain calcium activity was recorded at cellular resolution [3]. Since then, technical advancements permit nearly all the neurons in the head of a C. elegans to be recorded simultaneously while moving unrestrained [4 ,5 ]. This worm's compact and optically accessible nervous system of only 302 neurons, its genetic tractability, and its fully mapped connectome [6][7][8] suggest that C. elegans should be an ideal platform for probing how neural dynamics constrained by neuroanatomy generate neural function and behavior. And indeed whole-brain recordings in C. elegans are beginning to shed light on population neural coding of locomotion and neural representation of internal states. Nonetheless, the emerging subfield of brain-wide population recordings in C. elegans now finds itself at an interesting juncture. For the first time many of the tools we desire to record from neural activity are in place. But now the field must grapple with an abundance of data as it asks hard questions about how to best make sense of the neural dynamics and behavior that we can record.
Here we briefly review some of the milestones in large scale population recordings in C. elegans and the insights they have already revealed (Section 'Large scale population recordings in C. elegans: recent findings'). Next we explore what is still missing conceptually from our understanding of whole-brain neural dynamics in C. elegans, and what is still needed experimentally (Section 'Experimental capabilities: current and desired'). Finally we will discuss the role of modeling and theory in C. elegans (Section 'Whole-brain modeling in the worm') and potential paths forward (Section 'Outlook and conclusion').

Large scale population recordings in C. elegans: recent findings
There is a broad trend in systems neuroscience towards capturing a more complete picture of neural activity in the brain. Compared to sequential single unit recordings, simultaneous population recordings not only provide information from more neurons more quickly, but the simultaneity of the recording itself can sometimes provide new insights. The discovery of replay is a clear example [9]. In replay, a rodent rapidly repeats patterns of neural activity corresponding to its past spatial navigation. The discovery of replay was only possible with large scale simultaneous population recordings. This suggests that there may be other phenomena that lurk in the brain that may only be accessible via population recordings.
Whole-brain recording of neural activities is appealing in part because of its promise of completeness. Under a seductive line of reasoning, recording from all neurons in an organism with detailed mapped neuronal wiring should eliminate many of the usual excuses as to why we do not understand a given neural phenomenon. For example, you can no longer attribute unexplained observations to neurons you did not record, or connections you did not catch. This constrains models and helps refine the field's understanding. While in animals with larger nervous systems this scenario involves a daunting number of degrees of freedom, in C. elegans the approach is technically feasible, and it promises to provide the community with concepts that can then be scaled up to larger networks.
Pioneering work in larval zebrafish [1,2] and then C. elegans [3] bring the field closer to this record-it-all ideal by permitting nearly simultaneous calcium imaging of all neurons in the head at cellular resolution. Works in both species provided new insights. We focus here on C. elegans.
C. elegans nervous system shares genes and molecules with vertebrates but also has important differences. For example, the C. elegans nervous system primarily has slowly varying graded potentials and lacks the fast action potentials common to vertebrates. Despite these differences, the study of information processing, circuit motifs, and the relation between nervous systems structure and function all promise to provide insights that may inform our understanding across species.
Following single-neuron recordings in immobilized [10], and freely moving worms [11], the first whole-brain recordings from C. elegans came from worms that were immobilized in a microfluidic chip under the influence of a paralytic drug [3,12].
Those whole-brain recordings in immobilized animals show calcium dynamics that are highly synchronized among neurons [13 ]. Two subsets, or populations, of neurons show slow anti-phase dynamics on timescales of 50-100 s. The neural dynamics are low-dimensional because they are well-approximated by a small number of degrees of freedom evolving in time. Moreover they are stereotyped in that they follow specific trajectories in a phase space defined by those degrees of freedom. Lowdimensional trajectories have been observed also in larger brains, for example, in the brain of monkeys during reaching tasks [14].
In C. elegans, it is hypothesized that these trajectories may represent the animal's attempted, or fictive, locomotion. During immobilization, selected neurons' activity was compared to that observed in single unit recordings from freely moving animals. Through this correspondence, the low-dimensional neural state space trajectories are suggested to be global encodings of motor command sequences [13 ]. In contrast to low-dimensional trajectories seen in monkey motor cortex which are all from the same brain region, the strongly correlated population dynamics in immobilized worms span sensory, inter-, and motor neurons.
Similar approaches have been used to study a sleep-like state called quiescence [15], and neural coding of head oscillations [16] in C. elegans. During quiescence, population-wide neural activity was found to decrease dramatically with the exception of a few specific neurons that became active, like the neuron RIS. During fictive head bending (identified in immobilized worms via the activity of head-bending-associated neurons) collections of neurons, like the SMDD and SMDV neuron pairs, were found to be active at different phase relations to the fictive head bending. By using a whole-brain population recording approach, both of these studies were able, in a single experiment, to identify the role of several neurons in these behaviors, and revealed details of how their activities correlated to one another and how they related to fine grained descriptions of behavior.

Neural coding of locomotion in moving animals
Recording awake and unrestrained animals allows one to directly observe how neural dynamics relate to behavior, and is part of a broader trend in neuroscience towards probing the brain under more naturalistic conditions [17][18][19]. Recently, new methods have been developed to allow for recording brain-wide activity in freely moving C. elegans [4 ,5 ,20,21 ]. The methods themselves are discussed in Section 'Current state-of-the-art for measuring whole brain activity during movement'.
Brain-wide recordings in moving C. elegans exhibit neural dynamics that are richer and far less synchronized than those observed in immobilized animals [21 ]. Moreover, they show that neural signals related to the animal's velocity and body curvature are distributed throughout the brain among populations of neurons with a variety of tuning relations, some of which are positively tuned to velocity or curvature, others negatively tuned.
Recordings in moving animals offer a behavioral ground truth with which to test hypotheses about neural coding of locomotion. For example, a linear decoding scheme was able to sufficiently decode the animal's actual (not fictive) locomotion from neural activity alone [21 ]. Measurements like these provide new insights into neural representations of behavior in the brain.
The same decoding approach has been applied to studying neural dynamics underlying mating behavior. In an impressive recent work, population recordings from the male tail during the act of mating reveal how the male's nervous system represents the location and orientation of the hermaphrodite to guide mating behavior [22 ].
Despite early advances, more work is needed to move beyond cataloging neural correlates of sensory inputs or behavioral outputs to gain a mechanistic understanding of how neural dynamics are created, how they evolve, and how they drive decision-making and behavior. A number of outstanding questions remain: to what extent is neural activity low-dimensional and stereotyped? What role do population codes play in the C. elegans brain? How are sensorimotor transformations implemented at the circuit level, and how do they make decisions faced with competing stimuli? In Section 'Outlook and conclusion' we discuss the methodological advances needed to achieve this level of understanding.

Experimental capabilities: current and desired
Current state-of-the-art for measuring whole brain activity during movement Recently developed methods to record brain-wide neural dynamics during behavior [4 ,5 ,20,21 ,23] have relied on technical advances to record activity at high spatiotemporal resolution, track neurons and extract calcium activity during locomotion.
The first major challenge is to keep up with the worm as it moves. Computer vision software tracks the worm's head as it crawls and automatically adjusts a motorized stage and the focus of the microscope's objective to keep the worm centered in the microscope's field of view [4 ,5 ].
Early experiments used two-photon [3] or light-field microscopy [12] to rapidly record volumetric images of the worm brain. Now fluorescent spinning-disk confocal microscopy is the most widely adopted technique [4 ,5 ,13 ,15,16,20,21 ,23,22 ] because it offers reasonably thin optical sectioning, sufficiently fast volume acquisition, and is comparatively simple to add to an existing microscope.
Spinning disk systems build up volumes by scanning through the worm's brain along the optical axis at scan speeds of 4-10 volumes per second while recording individual optical sections at high speed, for example 200 Hz. This allows each neuron's activity to be recorded every 100-250 ms, which is faster than the fall time of typical calcium indicators, like GCaMP6s.
The C. elegans head ganglion has a diameter of order 50 mm, and a neuronal cell soma diameter of a few microns. A 40Â high NA oil objective is sufficient to individually resolve neurons when they are labeled with nuclear localized fluorophores.
Once images are acquired, another major challenge is to reconstruct 3D volumes from the single image planes acquired during animal motion. The worms' brain moves and deforms non-linearly both between and during the acquisition of individual volumes. Computationally intensive analysis pipelines have been developed to reconstruct the 3D volumes, segment individual neurons and then track them through time using computer vision and machine learning approaches such as nonrigid pointset registration and clustering [20].

Desired experimental capabilities
Technology for recording whole-brain activity in freely moving animals is still in its infancy. Current approaches for C. elegans are limited by the robustness, throughput, and duration of their recordings, by challenges in registering recordings across animals, and by difficulties in incorporating optogenetic stimulation. This section focuses on needed advances to experimental methods.
Needed advances for theoretical approaches are discussed in Sections 'Whole-brain modeling in the worm' and 'Outlook and conclusion'.
Recording duration. The current state-of-the-art allows neurons in the animal's head to be simultaneously recorded during unrestrained movement for up to 15 min [4 ,5 ]. While this is a big advance from just a few years ago, such short recordings sill make it difficult to fit quantitative models of more than a handful of parameters. Short recordings also make it hard to study longlived behavior states, or to observe long time-scale changes across development or during aging.
There are several bottlenecks that prevent longer wholebrain recordings. Practical constraints like hard disk size and arena size can likely easily be overcome. More challenging, however, is overcoming limits posed by photobleaching of fluorophores. A worm in a whole-brain imaging experiment will express in each of its neurons a fluorescent indicator of neural activity, usually a calcium reporter such as GCaMP, and one or more activity-insensitive labels, such as a red fluorescent protein (RFF), which can be imaged separately from GCaMP, for tracking and identification. The intense excitation light required to excite these fluorophores during fast highresolution volumetric imaging causes rapid photobleaching. Upon photobleaching the brightness of the calcium indicator and other fluorescent labels become too low to be detected above background, forcing a premature end to the experiment. New calcium indicators [24] have already provided improvements to the quality and duration of recordings. These calcium indicators require less excitation light to achieve the same signal-to-noise, thereby reducing photobleaching. Similarly, the continual development of brighter and more photostable fluorophores will also help decrease the rate of photobleaching and increase the length of recordings.
More sensitive cameras and new imaging modalities may also increase recording length. For example, single-objective light-sheet microscopy is compatible with movinganimals and promises more efficient illumination compared to spinning disk, therefore reducing photobleaching and increasing recording length [25,26].
In other contexts, throughput has been used to compensate for short recordings. For single unit recordings in C. elegans, many animals can be recorded simultaneously [ 27]. That approach trades off spatial resolution to achieve the larger field-of-view needed to record many animals at once. Whole-brain recordings, however, require ordersof-magnitude higher spatial resolution to resolve densely packed neurons and therefore will remain low-throughput for the foreseeable future.
Registering neurons across animals. The ability to confidently register neurons across animals is needed to study stereotypy or variability of neural dynamics, and to combine recordings from individuals so as to constrain models with many parameters. All worms have the same set of somatic cells and their development is well-determined, such that each neuron has its own identity [28]. In principle, this makes inter-animal comparisons possible at the cellular level and allows one to link brain-wide results to previous literature, to known atlases of gene expression [29] and to the known wiring diagram or connectome [6,8].
Despite the worm's overall stereotypy, the spatial arrangement of neurons in the head varies sufficiently to make robust neural identification challenging. Identifying neurons across animals is particularly difficult for whole-brain imaging because neurons are labeled uniformly with nuclear-localized markers. Nuclear localization helps distinguish the spatial extent of densely packed neurons, but it also obscures morphological features that, under sparse labeling, would normally inform identity.
Recently, several laboratories have developed multicolor labeling strategies that use gene expression to help assigning neural identities [30 ,31]. This approach is reminiscent of brainbow [32], except here the color of each neuron is genetically pre-determined by the neuron's gene expression profile which is preserved across individuals. A human or computer then assigns a neuron's identity based on a combination of its color-coded gene expression and its relative spatial location [33]. The most fully developed of these multicolor approaches [30 ] expresses combinations of four different fluorophores, driven by nearly 40 different promoters, and has already been used with GCaMP to achieve whole-brain recordings in immobilized animals, with the measurement of responses to sensory stimuli. Multicolor labeling strategies promise to allow neural recordings to be compared across animals and connected back to the known literature and known conenctome.
What should be measured? So far, most brain-wide recordings have been collected during spontaneous activity. Spontaneous activity can reveal correlations between neurons or provide insights into neural coding of sensory inputs or motor output. But ultimately this picture is a kinematic one -it describes the temporal evolution without reference to underlying mechanisms. Measures of spontaneous activity are less natural for revealing how information flows through the network, or for finding causal mechanisms that govern neural state trajectories.
Causal interactions, by contrast, can be measured via the responses of neurons to perturbations of other neurons, or well-targeted sensory stimuli. In C. elegans, small sets of neurons (usually a single pair), can be perturbed using electrophysiology or optical methods [34 ,35 ,36 ], including with patterned optogenetic stimulation and calcium imaging delivered simultaneously [37 ,38]. Simulataneous optogenetic stimulation and calcium imaging has been explored even more extensively in the mammalian literature [39][40][41]. Ideally one would like to perturb neural activity and simultaneously image neural dynamics at whole-brain scale. A major challenge is to find compatible pairs of opsins and activity indicators that have sufficiently small overlap between their absorption spectra for their simultaneous use. The indicator GCaMP and opsin Chrimson are a typical example of this challenge. The 488 nm blue light typically used to excite GCaMP will induce photocurrents in Chrimson at 35% of the maximal [42]. Blue shifted opsins [43], or red shifted indicators [43,44], including voltage indicators [45] offer potential avenues for resolving issues of spectral overlap.
Mapping out causal interactions allows one to move beyond the anatomical connectome to reveal a 'functional' connectome. While the anatomical connectome tells us which neuron is connected to which, the functional connectome would provide information like the excitability of the neurons and the strength, sign, and temporal properties of the connections between them. This additional information is crucially needed for understanding the equations governing neural dynamics. Comparing the functional and anatomical connectomes in C. elegans will provide a reference for connectomics investigations in other organisms. Particular attention should be given to locating and characterizing relevant nonlinearities in functional connections in the brain. Nonlinearties are thought to be ubiquitous in the brain, and allow the brain's internal state to alter its response to stimuli. A hypothetical brain with only linear connections would always give the same response to a stimulus, which contrasts with observations that neural responses [46 ,47] and behavioral responses in the worm [48] and in primates [49] depend on the brain's internal state. Nonlinearities are likely also important for capturing the effects of neuromodulators that are well known to play important roles in the C. elegans brain [50].
Surprisingly, even though we expect to find non-linear connections throughout the brain, the few well-characterized synapses in the worm [34 ,35 ,36 ] all exhibit approximately linear responses across physiological ranges of activity. This raises questions about how the network generates the nonlinearities we would expect, and is ripe for further investigation through theory and experiment.

Whole-brain modeling in the worm
Understanding whole-brain activity in the worm will require both theory and experiment. Below, we present a brief overview of the theoretical modeling that has been applied to C. elegans. In the next section, we discuss what features we think a theoretical framework should have to allow for an optimal interplay with experiments.
Models of whole-brain activity are relatively recent in the worm. Earlier modeling work primarily focused on either the sensory periphery [51] or on locomotion, for example using biomechanical models [52][53][54][55][56][57] or effective stochastic models [58]. Whole-brain neural dynamics have been modeled using a variety of mathematical formalisms, including dynamical systems and maximum entropy models, and supported by statistical inference, including Bayesian methods. Each modeling effort has crucial differences in the type of parameters and how they are set, in the degrees of freedom, the level of biophysical detail, and in the treatment of time and temporal dynamics, see Table 1.
Each model confronts tradeoffs between representing biophysical details, accurately matching experimental data, and providing a conceptual framework that simplifies or clarifies. For example, a detailed biophysical model may explicitly account for each synapse making the model very interpretable, but the detailed properties of the synapses included in the model are difficult to extract from the data, and the resulting model framework may not by itself provide clarifying insights. Instead, a model with an effective description of the network using latent variables may be easier to fit to data, and the model itself may also provide clarifying features like internal states.
The numerical properties of synapses included in the model, or the abstract connections between neurons are both examples of parameters. The choice of parameters and how they are acquired is a defining feature of different models.
One of the earliest modeling approaches is to numerically simulate every one of the 302 neurons in C. elegans as single electrical compartments showing graded membrane potentials in response to synaptic activation. These models parameterize the biophysics of synapses, gap junctions, and ionic channels [59,60 ] based on anatomical connectivity [6][7][8]. Differential equations describe the nonlinear dynamics of neural activity in the brain. These models have been used to explore critical slowing down of neural dynamics at bifurcations under externally injected large driving currents [61], and to study locomotion by incorporating proprioceptive feedback from simulated muscles [62].
Many biophysical parameters in these models, such as synaptic and channel conductances, are manually set by the modeler based on informed guesses because detailed properties of neural connections have not been measured for most of the brain. Consequently these simulations may miss important features of neural dynamics that depend on the detailed properties of neural connections.
Ideally, one would like to obtain detailed parameters of neural connections directly from measurements. This is not straightforward even in experiments that can Measuring and modeling whole-brain neural dynamics in Caenorhabditis elegans Randi and Leifer 171 Table 1 Models used to explore C. elegans whole-brain neural dynamics vary in crucial ways. For example, some models derive the parameters of the neural network from a priori knowledge of the anatomical connectome and biophysical estimates, whereas others learn their parameters by fitting to recordings of neural activity; the parameters used in the equations can either explicitly represent the biophysics of the neurons and of the synapses (membrane resistance and capacitance, release probability of neurotransmitters) or be effective parameters that abstract away biophysical elements; finally, the equations that describe the dynamics can be linear or nonlinear, of 1st order (i.e. the activity at the next time-step depends only on the activities at the current time-step), or higher-order, or contain driving ('control') terms or even consider only time-independent properties. While a biophysical and nonlinear description might be the most realistic description, other approaches can be more informative Time-independent Chen et al. [68 ] stimulate neurons while measuring postsynaptic responses. Ultimately the parameters needed are local properties of isolated neurons and their direct connections. In contrast, the results of measurements of the brain are determined by the effective interactions between neurons embedded in a network, which include also indirect connections, sometimes called 'polysynaptic' connections. For now detailed systematic measures of local direct interactions between neurons remain inaccessible.
Instead of measuring properties of neural connections directly, several approaches describe the network as a set of neural couplings that can be fit from recordings of spontaneous neural activity, for example via Bayesian inference methods [63 ]. These approaches abstract away biophysical details. For example, the neural couplings in the model might not have a straightforward relation to anatomical connections, or the model might describe additional latent or effective variables that do not correspond to any neuron. In exchange these models gain simplicity and the ability to capture abstract features of the network. As an example, rather than considering individual neurons, a model might instead focus only on the state space distributions of the two largest principal components of the neural dynamics. With fewer degrees of freedom, the model now needs less experimentally derived parameters to describe neural activity, in this case with first-order nonlinear dynamics [64].
Each of the approaches described so far seeks to use a single nonlinear description to capture the neural dynamics of a worm for all time-points. An alternative approach is to split the neural recordings into segments in time that are each described by different first-order linear models using switching, or adaptive, linear dynamical systems [ 63 ,65 ]. This approach has the advantage that over any local time window the system is described in a linear manner which is simpler to interpret than a nonlinear one. Moreover, studying how the simple linear model evolves can yield insights into how the more complicated nonlinear neural dynamics evolve in time. Switching between different linear systems can also be linked to latent states in the model, which may provide insights into changes in internal brain states in the animal [63 ]. Switching linear systems have been used also to model electrocorticography measurements in monkeys and recordings from neurons in the visual cortex of the mouse [65 ].
A very recent approach called 'dynamical mode decomposition with control' also models neural dynamics by separating them into two parts [66]. In this case, the neural activities evolve according to a first-order linear system of differential equations that involve 'control signals,' which depend on the activities in a non-Markovian way. While this system is fully linear, the formulation separates the simple first-order linear contributions from other higher order effects, making the interpretation easier. The couplings between the control signals and the neural activities are learned from recordings of neural activity, and the learning algorithm allows for an identification of the state transitions determining such 'control'.
All of these approaches focused on capturing the timevarying dynamics of whole-brain neural activity. One can also characterize time-independent features of the network, like the probability landscape of occupying different neural states or the extent to which the brain is operating close to a critical point. Maximum entropy models have been used to explore these questions by obtaining effective coupling constants between neurons from same-time correlations in activity in worms [67,68 ] and mice [69]. Additionally, it has also been possible to compare the topology of the map of effective couplings with that of the anatomical connectome [68 ].
Given the diversity of models to choose from, what features might the experimentalist look for in a model to tackle interesting scientific questions about wholebrain neural dynamics? We discuss this in the next section.

Outlook and conclusion
Whole-brain recordings have provided new opportunities to both probe specific questions of neural coding, for example how locomotion is represented in the brain, and also to build and fit brain-wide models of neural activity.
Many of the unanswered questions in the worm involve concepts at higher levels of abstraction than just the activity of individual neurons or properties of their synapses. Questions of neural tuning, dimensionality, mappings between sensory neuron activity and motor output, and neural state space trajectories all involve higher-level representations of neural activity or connections. Examples of high level features include tuning curves, sensorimotor kernels from generalized linear models, correlation matrices, internal brain states and neural state space trajectories. Those features are more natural for answering questions about how brain functions or information flows. Ideally, we would like a single theoretical framework that provided not only the differential equation governing the temporal evolution of the (low-level) neural activities, but also equations to connect those activities to these high level features.
In principle, any model describing the activity of all the neurons can be used to run numerical experiments and thus obtain the high-level features like tuning curves or sensorimotor kernels listed above. For example to extract a tuning curve from a model, one would simulate the experiment of driving a sensory neuron and measuring a downstream neuron's response. But it would be much more powerful if the tuning curves were already explicitly represented in the model, or could be extracted from the model's parameters directly.
The ideal theory therefore would come with mathematical tools like equations that allow us to relate all these conceptually important features to the parameters of the model, one to another, and to quantities that can be measured in experiments, like for example relations between the connectivity of the network and the dimensionality of the neural activity [70].
In this context, it is hard to overestimate the importance of very small animals like C. elegans. The worm is unique because it not only allows whole-brain recordings, but its nervous system is small enough that theoretical calculations remain easily tractable and comparable with experiments in full detail. C. elegans therefore is well suited to testing out new methods for connecting low-level model parameters to high level features. And it can be used as a playground for comparing different modeling approaches to one another, before scaling these approaches to larger brains.
Finally, C. elegans has interesting questions in its own right about how the world is represented in the brain and how neural signals are processed to generate actions and decisions. Combination of large scale recordings and modeling in the worm will yield new insights into how this animal senses and acts.

Conflict of interest statement
Nothing declared.