Abstract
Many behavioral tasks require the manipulation of mathematical vectors, but, outside of computational models1–8, it is not known how brains perform vector operations. Here we show how the Drosophila central complex, a region implicated in goal-directed navigation8–14, performs vector arithmetic. First, we describe neural signals in the fan-shaped body that explicitly track a fly’s allocentric traveling direction, that is, the traveling direction in reference to external cues. Past work has identified neurons in Drosophila12,15–17 and mammals18,19 that track allocentric heading (e.g., head-direction cells), but these new signals illuminate how the sense of space is properly updated when traveling and heading angles differ. We then characterize a neuronal circuit that rotates, scales, and adds four vectors related to the fly’s egocentric traveling direction–– the traveling angle referenced to the body axis––to compute the allocentric traveling direction. Each two-dimensional vector is explicitly represented by a sinusoidal activity pattern across a distinct neuronal population, with the sinusoid’s amplitude representing the vector’s length and its phase representing the vector’s angle. The principles of this circuit, which performs an egocentric-to-allocentric coordinate transformation, may generalize to other brains and to domains beyond navigation where vector operations or reference-frame transformations are required.
Introduction
Navigating animals often construct an internal sense of their position and orientation in an environment20. In mammals, cellular activity correlates of this internal sense include the responses of head direction cells18, place cells21, grid cells22, speed cells23, and others. Understanding how such neural signals are built and how they impact behavior is a central goal of cognitive neuroscience.
A fundamental open question in navigation is how an animal computes its direction of travel when that direction is not aligned with its head or body24–27. This issue is particularly acute when animals fly or swim because flow forces (e.g. wind) can induce significant sideward and even backward drift. Misalignment of the heading and traveling directions is also relevant for terrestrial locomotion when an animal walks sideways or backwards27. Head-direction cells signal the angle the head is facing relative to external landmarks, not the direction the body is moving referenced to those landmarks. Traveling-direction tuned neurons, should they exist, would provide a more generally useful signal for navigation.
Insects solve remarkable navigational tasks28–30 and, like mammals, they have head-direction-like cells called EPGs, compass neurons or heading neurons with activity tuned to the animal’s head (or body) angle in reference to external cues9,12,31,32. In Drosophila, sixteen sets of EPGs tile the circular ellipsoid body and generate, as a population, a bolus or bump of activity at a position around the ellipsoid body that reflects the fly’s orientation, akin to a compass needle12,33. Here we show that two populations of neurons that tile the fan-shaped body––another prominent central-complex structure––each express a bolus of activity at a position along this structure that indicates the fly’s traveling angle in reference to external cues, rather than its heading angle. We experimentally define and theoretically analyze a neural circuit that computes this external-cue-referenced, or allocentric, traveling-direction signal by rotating, scaling and summing four vectors related to the fly’s body-axis-referenced, or egocentric, traveling direction. Each vector is explicitly represented by a sinusoidal pattern of activity across a defined population of neurons. Characterizing a neuronal circuit for vector arithmetic and reference-frame transformation is a fundamental advance for cognitive neuroscience34–36.
Beyond heading signals in the central complex
In the Drosophila central complex (Fig. 1a), single EPG neurons receive synaptic input in one of sixteen wedges that form the ellipsoid body, and they send axonal outputs to one of eighteen glomeruli that form the protocerebral bridge (Fig. 1b, blue cells). In both walking12,15,16 and flying flies14,37, the full population of EPG cells expresses a single localized bolus of activity in the ellipsoid body, alongside one copy of this bolus in the left protocerebral bridge and another copy in the right protocerebral bridge, at positions along these structures that signal the fly’s angular heading referenced to external cues.
EPGs represent one of a few dozen sets of columnar neurons in the central complex. Each columnar cell class tiles the ellipsoid body, protocerebral bridge, and/or fan-shaped body, and members of each class can be assigned an angular label based on their projection patterns. Many columnar cell classes exhibit [Ca2+] boluses that are linked to the EPG bolus and the fly’s heading15–17. PFRs are one such columnar cell class. These cells receive anatomically weak synaptic input from EPGs in the bridge38, and they project to the columns of the fan-shaped body where they form extensive, mixed input/output synapses in layers 3, 4 and 533,38,39 (Fig. 1b, purple cells). Imaging [Ca2+] in PFRs of both walking (Extended Data Fig. 1) and flying (Fig. 1c, d) flies revealed a single bolus of activity that moves left/right along the fan-shaped body in coordination with the movements of the EPG bolus around the ellipsoid body, consistent with past measurements17. Critically, however, we noticed that the PFR and EPG bolus positions sometimes drift apart, especially when walking flies stand still (Extended Data Fig. 1a, b). This raised the possibility that the PFR bolus position might signal the fly’s traveling, rather than heading, angle.
PFRs and hΔBs signal the fly’s allocentric traveling angle
To test the hypothesis that the PFR bolus position signals the fly’s traveling direction, we focused most of our experiments on tethered, flying flies40. In flight, insects rely heavily on panoramic visual motion, or optic flow, to assess their direction of travel41. We could thus use optic-flow stimuli to systematically simulate the animal’s body translating forward, backward or sideways relative to the heading angle while assessing the effect on the EPG and PFR boluses, measured at the same time via two-photon excitation of GCaMP7f42 (Fig. 1c-d). We attached flies to a platform that allowed them to flap their wings in tethered flight and placed the platform in the center of a cylindrical LED arena40. A bright dot at the top of the arena rotated in closed-loop with the fly’s steering behavior40,43, simulating a static, distant cue that the fly (and the EPG bump) could use to infer heading14. A field of dimmer dots in the lower visual field was either stationary or moved coherently to generate open-loop optic-flow that simulated the fly translating along different directions relative to its body axis44,45 (Fig. 1c; Methods).
With a stationary dot field (Fig. 1e, left), the EPG phase generally tracked the angular position of the closed-loop dot, consistent with previous studies14,37 and with the interpretation that the EPG phase signals the fly’s heading in reference to external cues. The PFR phase, on the other hand, often drifted off the EPG phase, akin to our observations in standing flies. In contrast, when we presented optic flow that simulated the fly’s body moving forward, the EPG and PFR phases became tightly aligned (Fig. 1e, right). Consistent with the sample data in Figure 1e, the EPG phase tracked the closed-loop dot equally well with and without optic flow across ten flies (Fig. 1f), but the PFR phase aligned with the EPG phase much more tightly when optic flow simulated forward translation (Fig. 1g).
When we varied the expansion point of the optic-flow stimulus to simulate the fly translating along six different directions, we observed that the offset between the EPG and PFR phases matched the simulated egocentric (i.e., body-axis-referenced) angle of travel (Fig. 1h, i). If we make the standard assumption that the EPG phase signals the fly’s allocentric (i.e., external-cue-referenced) heading angle12,14,37, this implies that the PFR bolus position in the fan-shaped body tracks the fly’s allocentric traveling direction (Fig. 1j).
The anatomically dominant input to the PFRs in the fan-shaped body is provided by hDeltaB (hΔB) cells38, a columnar class in which each constituent cell has a dendritic-input arbor in layer 3 of one fan-shaped body column and a mixed, input/output, axonal arbor in layers 3, 4 and 5 of another column offset by 1/2 the width of the fan-shaped body (Fig. 1k). To image hΔB activity, we created a split-Gal4 driver line to selectively target transgene expression to hΔBs and a UAS-sytGCaMP7f responder line in which GCaMP7f is fused to the c-terminus of synaptotagmin to bias GCaMP to axonal compartments46. This bias allowed us to resolve the spatial overlap between the axons and dendrites of different hΔBs and focus on the axonal output of the hΔB population. Imaging sytGCaMP7f fluorescence in hΔBs revealed a bolus of activity at a position along the fan-shaped body that tracks the inferred traveling direction (Fig. 1l-o), much like the PFR bolus. Thus, the traveling direction signal seems to be built first in the hΔBs and then transmitted to the PFRs (as well as, potentially, the many other columnar cell types that hΔBs target38).
We also imaged the PFR bolus in tethered, walking flies induced, via optogenetic activation of specific visual-system neurons47, to take backward-left or backward-right trajectories on an air-cushioned ball. When flies walked backward, the PFR bolus deviated from the EPG bolus in a manner consistent with the PFR phase signaling the allocentric traveling direction during terrestrial locomotion (Extended Data Fig. 1c-f) as in flight. We also observed deviations of the hΔB phase from the fly’s heading during spontaneous tethered walking behavior in a manner consistent with this signal tracking the fly’s terrestrial traveling direction (data not shown). Thus, the PFR and hΔB boluses appear to track traveling direction in both walking and flying flies.
PFNds and PFNvs are poised to build the traveling signal
To compute their allocentric traveling direction, flies must combine information about their heading angle referenced to external cues (i.e., the EPG heading signal) with information about their egocentric translation direction (i.e., the direction in which they are moving referenced to their body axis). As we will show next, PFNd and PFNv cells are columnar neurons that receive heading input in the bridge and egocentric translation signals in the noduli33 and bridge, while also projecting axons to the fan-shaped body where they synapse onto hΔB neurons38 (Fig. 2a, b). PFNds and PFNvs thus seem well positioned to convey the EPG heading signal into the fan-shaped body and also to offset that signal when the animal drifts sideward or backward, thereby generating the traveling-direction signal.
Separate arrays of PFNds (Fig. 2a) and PFNvs (Fig. 2b) receive monosynaptic input from EPGs in the left and right bridge. Co-imaging EPGs and PFNs in the bridge revealed one activity peak in the left bridge and another in the right bridge for both PFNds and PFNvs, with the movement of these peaks closely tracking the movement of the EPG bumps (PFNv and EPG co-imaging: Fig. 2c, d; PFNd and EPG co-imaging: Fig. 2e). Thus, left- and right-bridge PFNds and PFNvs together express four copies of the EPG allocentric heading signal. Interestingly, the activity profiles of the four PFN populations across the bridge are sinusoidal (Fig. 2d, e), which is important because, as we will describe below, sinusoidal activity patterns can represent two-dimensional vectors. We hypothesize that the PFN boluses in the bridge are sinusoidally shaped, at least in part, because they receive extensive monosynaptic input from Delta7 (Δ7) neurons, in the bridge. Δ7s are glutamatergic bridge-interneurons with activity peaks yoked to, but ∼180° offset from, the EPG bumps48.
These cells are anatomically and physiologically poised to reshape the EPG bump into a sinusoidally shaped bolus via broad lateral inhibition, not only for PFNs but for a myriad of other columnar cell types within the bridge38,48 (Extended Data Fig. 2). Note that the EPGs themselves receive Δ7 feedback, which likely makes their own bridge bumps more sinusoidal than they would otherwise be as well (Fig. 2d-e).
In all our measurements, the PFN boluses were invariably locked to the EPG compass signal, which begs the question: how then does PFN activity also reflect the body’s egocentric translation direction, as would be needed for the PFN activity to build the allocentric traveling signal? We discovered that the amplitudes of the sinusoidal activity patterns of the PFNs across the bridge are strongly modulated by the direction of optic-flow presented to the fly (Fig. 2f-k). Specifically, when we presented optic flow that simulated the fly translating directly forward, the amplitude of the PFNv sinusoids bilaterally dropped, whereas the amplitude of the PFNd sinusoids bilaterally increased. Conversely, when optic-flow simulated backward travel, the amplitude of the PFNv sinusoids bilaterally increased and the amplitude of the PFNd sinusoids bilaterally dropped. With flow that simulated the fly traveling rightward relative to its heading, the amplitude of the right-bridge PFNd sinusoid increased and that of the left-bridge PFNd sinusoid decreased, with the opposite pattern in PFNvs. In contrast, the EPG bumps in the bridge show little amplitude modulation with optic-flow (Fig. 2l-n).
Optic-flow modulation of the PFNvs most likely arises from the extensive monosynaptic inputs they receive from LNO1s in the noduli8,38. When we imaged activity in the LNO1s, we observed optic-flow tuning that is precisely inverted from that of the PFNvs, suggestive of strong, sign-inverting synapses between these cell types (Extended Data Fig. 3). Similarly, PFNds receive extensive monosynaptic inputs from LNO2s in the noduli as well as from SpsPs in the bridge38. We unfortunately did not have a Gal4 driver line that allowed us to cleanly image LN02s, but when we imaged activity in the SpsPs in the left- and right-bridge, we observed optic-flow tuning that was inverted from the optic-flow tuning observed in PFNds in the bridge, again suggestive of sign-inverting synapses (Extended Data Fig. 3). Although this system is strongly responsive to optic flow in flying flies––where a visual assessment of body translation is critical––we also observed modulations in the activity of LNO1s, SpsPs, PFNvs and PFNds in flies walking in complete darkness, consistent with this system employing proprioceptive or efference-copy based estimates of the fly’s egocentric translation direction during terrestrial locomotion in the dark (Extended Data Fig. 3). Because our focus is on the calculation of the traveling direction signal in hΔBs and PFRs in the fan-shaped body, we do not further characterize the nature of the nodulus and bridge inputs to PFNs in this study.
Combining four sinusoids to build a traveling-direction signal
PFN activity is modulated both by the EPG bump position and the optic-flow drift angle, but how do these modulations drive the hΔB bolus to the appropriate traveling-direction location in the fan-shaped body? Corresponding PFNv and PFNd cells in the left- and right-bridge send projections to the fan-shaped body that are offset from each other by approximately ±1/8 of the extent of the fan-shaped body (Fig. 3a-h). A ±1/8 shift is approximately equivalent to a ±45° angular offset. This ‘push-pull’ anatomy allows the left- and right-bridge PFNds to shift the location of the hΔB activity bolus one way or the other across the fan-shaped body, depending on which has the larger amplitude of activity. PFNds synapse onto both the axonal and dendritic regions of the hΔBs, but, interestingly, the anatomically dominant input is to the axonal region38 (Fig. 3a, b). PFNvs, on the other hand, also project to the fan-shaped body with the same ±45° angular offset, but they target the hΔB dendrites nearly exclusively (Fig. 3c, d). As described earlier, the axon terminal region of each hΔB is offset from its dendrites by 1/2 the width of the fan-shaped body, equivalent to an angular displacement of ∼180° (Fig. 3a-d). The result of these two sets of shifts is that left- and right-bridge PFNvs promote hΔB axonal activity shifted by approximately ±135° relative to their common phase in the bridge. The additional 180° shift in the PFNv pathway compared to the PFNd pathway effectively flips the sign of the PFNv activity sinusoids in the fan-shaped body, thereby compensating for the reversed dependence of the PFNv bolus amplitude on the optic-flow-drift angle relative to the PFNds.
These considerations provide a conceptual framework for understanding how an allocentric traveling-direction signal is created in hΔBs. When the fly travels directly forward, both PFNd sinusoids have large amplitudes and both PFNv sinusoids have small amplitudes (Fig. 2f-k). The summed PFN input at the hΔB axon terminals during forward travel will thus peak at the midpoint between the two PFNd boluses, which is the fan-shaped body location that indicates alignment between the fly’s traveling and heading angles (Fig. 3i; the midline of the fan-shaped body for an EPG bump at the top of the ellipsoid body). When the fly travels directly backward, the PFNd and PFNv amplitude modulations switch (Fig. 2f-k), and the summed activity of the four sinusoids yields an activity pattern shifted by 180° (Fig. 3j; 180° offset from the fan-shaped body midline in this example). When the fly translates directly rightward relative to its heading, the left-bridge PFNv sinusoid and right-bridge PFNd sinusoids have larger amplitudes than their counterparts on the opposite side of the bridge (Fig. 2f-k), shifting the summed activity peak by 90° in the fan-shaped body (Fig. 3k; 90° to the left of the midline in this example). This same peak position can be achieved if the fly simply turns 90° to the right, causing all the EPG and PFN signals to rotate 90° in the brain, and then travels straight forward (Fig. 3l). A parallel study reports on a similar set of ideas from data in walking flies49.
A quantitative vector model
We can turn the descriptive framework of the previous paragraph into a quantitative model by noting that adding sinusoidal signals is formally equivalent to adding two-dimensional vectors, which is the basis of an engineering approach known as a phasor representation. The fan-shaped body appears to make use of this trick in reverse: to add vectors, it uses the amplitudes and phases of the sinusoidal activity patterns of the PFNd and PFNv populations across the columns of the fan-shaped body to represent the lengths and angles of 2D vectors, and it adds these vectors by summing these neuronal activity profiles. Theoretical models employing phasors have been proposed in studies of the mammalian hippocampus2,3 and in insect navigation6, including the fan-shaped body8, but here we provide the first comprehensive experimental demonstration of their operation.
As already mentioned, the PFNd and PFNv boluses in the bridge are sinusoidally shaped (Fig. 2d-e), consistent with the phasor idea. Moreover, the amplitudes of the four sinusoidal boluses are modulated by optic flow as a cosine function of the drift angle (Fig. 2 g, h, j, k). The maxima of these cosine tuning profiles define the angles of four axes (Figure 3m). According to the map between sinusoids and vectors, the PFN activity profiles represent four vectors with lengths proportional to the projections of the fly’s traveling direction onto these four axes (Methods). For the four vectors to be added properly, the phase differences between the PFN sinusoids in the fan-shaped body––where they are summed by hΔBs––must match the angular difference between the four, physiologically defined axes shown in Figure 3m. The PFN sinusoids in the bridge are (to first order) all aligned with the EPG heading signal, so their phase differences in the fan-shaped body, at the site of hΔB input, are determined by the anatomy of the PFN-to-hΔB projection (Fig. 3a-h). We therefore used the hemibrain connectome to estimate the angular differences of the PFN inputs to hΔBs38 (Extended Data Figs. 4, 5; Methods) and, importantly, these differences turned out to be near 90° (Fig. 3n), which is in close agreement with the angular separation across the four axes determined from the PFN response physiology (Fig. 3m). Furthermore, the fact that the phase of all four sinusoids jointly shift with rotations of the EPG compass signal means that the corresponding vectors are referenced to the external world, which implements the ego-to allocentric coordinate transformation. Thus, the four PFN activity sinusoids represent four vectors that, when added, yield a vector that points in the direction of the allocentric traveling direction.
Having established the correspondence between PFNd and PFNv population responses and a set of vectors, we can illustrate, in quantitative detail, how the traveling direction signal is computed (Fig 3i-l, right column). The hΔBs sum the left- and right-bridge PFNd and PFNv activity profiles, which is equivalent to saying that they add the vectors that these neuronal-activity patterns represent, and this vector sum yields the direction of travel. This model can be solved analytically to provide a complete account of the traveling direction computation (Methods). Predictions of the angles encoded by the hΔB bolus made from the model exclusively on the basis of the PFN data points (with no free parameters) are in excellent agreement with the experimental results (Fig. 3o; Methods; see Extended Data Fig. 6 for PFR modeling results).
Perturbational evidence for the model
To test the vector model, we manipulated PFNd and PFNv activity while measuring the impact on the traveling-direction bolus in PFRs. First, we inhibited EPGs by expressing in them shibirets, a reagent that abolishes synaptic vesicle recycling at high temperatures50. This markedly impairs or eliminates the bolus in EPGs13, consistent with the fact that EPGs rely on recurrent connectivity to function normally15,16,37. Without EPG input, the PFNd and PFNv sinusoids should be strongly impaired or non-existent. Because the width of the PFR bolus does not notably expand or contract when it is offset from the EPG bolus (analysis not shown), we believe that a recurrent circuit, independent of EPG recurrence, supports a self-sustaining PFR bolus, and thus we expected to observe a PFR bump even in the absence of synaptic input from EPGs and PFNs. However, without effective EPG input to the system, we predicted that the PFR bolus would be unable to tether itself to external cues, let alone track the allocentric traveling angle (Fig. 4a). To stringently test these predictions, we measured the PFR bolus in persistently walking flies, where unlike in flying flies, we rarely observed large deviations of the PFR phase from the angular position of a bright cue or the EPG phase (Extended Data Fig. 1b). With the EPGs silenced, we still observed a clear bolus in PFRs, but the phase of this bolus did not effectively track the angular position of a closed-loop cue (Fig. 4b-d). These data support our prediction that EPG input is necessary for the fan-shaped body traveling signals to be yoked to the external world.
Second, we silenced PFNvs by expressing in them a K+ channel, Kir2.151. This yielded an increase in the phase alignment between the EPG and PFR boluses in tethered, flying flies in the context of no optic flow (Fig. 4e-h). This observation supports our model because silencing PFNvs is equivalent to shortening the two, back-pointing, vectors in the model, which physiologically simulates forward motion and should make the PFR vector point in the direction of the EPG angle.
Third, we optogenetically excited PFNvs via two-photon activation of the optogenetic Cl- channel, GtACR152,53, in LNO1s54, which are the primary monosynaptic, apparently inhibitory (see above and Extended Data Fig. 3), inputs to PFNvs in the noduli38. Inhibiting LNO1s (and presumably exciting PFNvs) drove the PFR bolus to be ∼180° offset from the EPG bolus (Fig. 4i-l). This supports the model because activating PFNvs is equivalent to lengthening the two back-pointing vectors in the model, which physiologically simulates backward motion.
Finally, we silenced PFNds by perturbing one of their primary inputs, the SpsPs. There are two SpsP cells per side, each innervating all the ipsilateral PFNds, and the vast majority of SpsP synapses (>80%) in the bridge target PFNds38. [Ca2+] imaging of SpsPs revealed them to be sensitive to translational optic flow (Extended Data Fig. 3d-f) with tuning inverse to that of the PFNds. We therefore optogenetically activated SpsPs (with csChrimson55) to inhibit PFNds. This perturbation drove the PFR bump to be offset by 180°, on average, from the EPG bump (Fig. 4m-p), consistent with the expectation that this perturbation effectively shortens the two front-facing vectors. There appeared to be a tendency for the offset to reside at an angle slightly to the left or right of 180° (Fig. 4o arrows), rather than exactly at 180°, suggesting that the PFR bolus settles to a stable point aligned with one the two PFNv vectors, which remained intact in these experiments.
Tuning for speed
Thus far we have presented results and discussed the model for translation at a single speed, but we performed some of our experiments on PFNs, hΔBs and PFRs at four different speeds. The model we have presented can account for the PFN responses and the traveling direction angles signaled by the hΔB and PFR boluses at all tested speeds (Extended Data Figs. 7, 8). If the hΔB and PFR boluses were to accurately signal the fly’s traveling vector (angle + speed), rather than just the traveling direction, we would expect the amplitude of their sinusoidal activity profiles to scale with speed. We found that the PFN amplitudes do indeed increase monotonically with speed (Extended Data Fig. 8), but they saturate at high speed and do not vanish at zero speed. This latter feature makes sense if the PFN/hΔB/PFR system aims to ensure the existence of a traveling direction bolus in the fan-shaped body even when flies translate very slowly, but it complicates the representation of a full traveling vector. Overall, PFRs and hΔBs both showed a measurable, but weak, increase in signal strength with faster speeds, but this modulation seems focused to frontal-travel directions (Extended Data Fig. 8 f-g). Speed tuning that is not consistent across different traveling direction angles is incompatible with any simple notion of hΔBs and PFRs carrying a traveling-vector, rather than a traveling-direction, signal. Future work will be needed to relate these varied speed-tuning profiles to their functions in navigation. We suspect that other neurons in the fan-shaped body may show stronger and more consistent speed tuning, which could be useful for building spatial memories via path integration.
Discussion
Do mammalian brains have neurons whose activity is explicitly tuned to the animal’s allocentric traveling direction as in Drosophila? While a defined population of traveling-direction-tuned neurons has yet to be highlighted in mammals, one reason such cells could have been missed is because their activity would loosely resemble that of the head-direction cells outside of a task in which the animal is required to sidestep or walk backwards. Two recent experiments in which rats walked or were transported backwards noted that place cells updated appropriately under these conditions24,25. These experiments were conducted in well illuminated environments, but should these same results hold in darkness, where a wholly internal updating of the place cell network is required, angular signals beyond those of head-direction cells, potentially allocentric traveling-direction tuned neurons, would seem to be required to explain the results.
Neurons in area 7a of monkey parietal cortex respond maximally to a specific direction and length of visually driven saccadic eye movements, but the magnitude of this response scales with the starting position of the eye1. A classic computational model1 demonstrated that such eye-position modulated saccadic responses are expected from the middle layer of a neural network that aims to transform the position of a visual stimulus from the coordinate frame of the retina to that of the head. The Drosophila fan-shaped body likewise performs a coordinate transformation from an egocentric sense of body translation, carried by LNO1s and SpsPs (and probably, also, LNO2s), to an allocentric sense, carried by hΔBs and PFRs (Extended Data Fig. 9). In this framework, PFR and hΔB cells develop tuning to the fly’s allocentric traveling direction because neurons at an intermediate processing layer, the PFNs––which show allocentric heading responses that are multiplicatively scaled by the fly’s egocentric translation direction––perform a coordinate transform. Thus, our data provide a biologically validated example of how neurons with mixed selectivity, i.e., tuned responses to a primary stimulus axis that are further scaled by a second relevant dimension, function to implement a coordinate transformation, lending credence to the computational ideas from parietal cortex1,4,5 and similar proposals in animal navigation34–36.
In our model, the optic-flow tuning peaks of left and right PFNds and PFNvs (Fig. 3m) are separated from each other by ∼90°, based on measurements made in the noduli (Extended Data Fig. 3i). However, we observed broader separations, close to 120°, when we compared left-right optic-flow tuning in the bridge (Extended Data Fig. 3i). A notable feature of representing and adding vectors as sinusoids is that the system works equally well with non-orthogonal axes. However, if the offset angles in optic-flow tuning are greater than 90°, the anatomical angles describing the shifts in the PFN projections must be correspondingly less than 90° (Methods). An intriguing possibility is that during terrestrial locomotion––where backwards and sideways translation for extended periods is rare––flies may emphasize the egomotion inputs to PFNds found in the bridge and thus employ a non-orthogonal reference frame that may grant them higher spatial resolution in estimating frontal traveling directions. On the other hand, in flight––where backward and sideways translation for extended periods is a distinct possibility––they could rely more on egomotion inputs to PFNds and PFNvs in the noduli, employing orthogonal vectors that may allow for better estimating the full 360° of travel accurately. At first, it might seem impossible for the anatomical shifts in the PFN projections to accommodate both of these cases. However, there is an offset in the angular alignment of EPG and Δ7 input to the PFNs in the bridge (Extended Data Fig. 4b, d). Modulating the relative strength of these two inputs will slightly shift the positions of the left- and right-bridge PFN sinusoids, thus changing the angular offsets between sinusoidal inputs to hΔBs in the fan-shaped body and, in principle, allowing a non-orthogonal system to be used in some situations (e.g. walking) and an orthogonal system in others (e.g., flight).
The traveling direction signal we have studied could serve a number of behavioral functions in the fly. For example, it could be compared with a stored, goal direction to generate turning commands to direct the fly along a desired trajectory13,14. Also, augmented with an appropriate speed signal, it could provide a basis for path integration, and a model along these lines has been proposed8 (see Supplemental Discussion).
Specifically, if one imagines a [Ca2+] bolus whose position in the fan-shaped body indicates the traveling direction and whose intensity accurately signals the traveling speed, then a subcellular integration process with a [Ca2+]-dependent rate becomes a plausible and attractive mechanism by which instantaneous traveling vectors could be integrated over time to build a memory vector (rather than network-based integration8). It has recently been argued that sleep pressure is integrated by a subcellular process in the dorsal fan-shaped body56, and this logic might extend to the lower fan-shaped body for integration over shorter––minutes to hours–– timescales related to navigation.
The discovery of an allocentric traveling direction signal is a fundamental step forward for the field of animal navigation. Moreover, because many sensory, motor and cognitive processes can be formalized in the language of linear algebra and vector spaces, defining a neuronal circuit for vector computation could open the door to better understanding a number of previously enigmatic circuits and neuronal-activity patterns across varied nervous systems.
Author Contributions
C.L. and G.M. conceived of the project. C.L. performed the experiments and analyzed the data. C.L., G.M., and L.A. jointly interpreted the data and decided on new experiments. L.A. developed and implemented the formal models. C.L. wrote the initial draft of the paper, which was then edited by G.M. and L.A.
Author Information
The authors declare no competing financial interests.
Supplemental Discussion
Angular integration and vector addition in the fly central complex
PFNs project from the bridge to the fan-shaped body in an anatomically offset manner compared to how PFRs project from the bridge to the fan-shaped body; this pattern is very reminiscent of how PENs project from the bridge to the ellipsoid body in an offset manner to EPGs33 (Extended Data Fig.10). The PEN/EPG circuit implements angular integration15,16, which means that a persistent asymmetry in the activity of left-vs. right-bridge PENs––induced when the fly is turning––yields a persistent rotation of the EPG bolus. We argue here that the PFN circuit implements vector addition, which means that a persistent asymmetry in the activity of left-vs. right-bridge PFNs––induced when the fly is translating left or right––yields a persistent offset in the PFR bolus relative to the EPG bolus rather than a persistent rotation. The EPG phase continuously rotates when there is a constant asymmetric input because the EPG system contains functionally relevant projections both from the bridge to the ellipsoid body and from the ellipsoid body back to the bridge. This closed-loop anatomy allows the EPG bump to rotate indefinitely with proper input drive. In the PFN/hΔB/PFR system, there are only unidirectional projections from the bridge to the fan-shaped body, which means that a constant asymmetric input only nudges the system, in open loop, to an offset position, rather than inducing a continuous precession. Thus, our work highlights how very similar anatomical relationships between cells, in the PEN/EPG versus PFN/PFR systems, can yield quite different circuit-level computations.
Relating our results to a model of path integration in the bee fan-shaped body
A previously proposed computational model of path integration, based on anatomical and physiological experiments in bees8, bears some relation to our findings in Drosophila. For example, the basic observation that noduli inputs to PFNs have optic-flow tuning curves with peaks skewed to the left and right of the fly’s midline was noted by these authors, and it was presciently proposed that these inputs might allow bees to estimate their direction of travel relative to their body axis. However, the authors did not propose the existence of an explicit, traveling-direction bolus in the fan-shaped body; rather, the traveling velocity signal they extracted was carried by a difference between left- and right-projecting cell populations. These authors further hypothesized that PFNs, or “working-memory CPU4 cells”, integrate a speed-modulated traveling-direction signal over time in the PFN network itself (perhaps via recurrent PFN-to-PFN connections) to generate a persistent memory of the direction and distance from a start location. Our work does not reveal the PFNvs and PFNds to be integrating their bridge and noduli inputs over time. Rather, the PFNds and PFNvs appear to adjust the position of the hΔB and PFR [Ca2+] bumps in the fan-shaped body in real-time. That said, beyond PFNds and PFNvs, which innervate the third layer of the fan-shaped body, there exist three additional classes of PFNs in layers one and two33, and the activity of these PFNs may resemble the bee model more closely. Furthermore, it is possible, although we think it unlikely, that PFNvs and PFNds switch to performing a more memory-integration function in the context of flies performing a path-integration task, an idea that could be tested in future work.
Estimating the traveling direction with optic flow is robust to changes in the head angle
When a fly flies forward with its head aligned to its body axis, it experiences optic flow with a focus of expansion that is centered along the visual field’s midline. If the fly were to rotate its head to the right by, say, 20°, while still flying forward, this would shift the optic-flow’s focus of expansion, and the simulated egocentric traveling direction, by 20° to the left, which would seem to introduce an error in the traveling-direction calculation. Importantly, however, the same head movement would also rotate the perceived angle of distant visual cues (like the sun) by the exact same amount, and the EPG system would register this as a 20° rotation as well. (The same logic would hold for non-visual cues sensed in the head’s reference frame and relevant for the EPG heading signal, like the antennal sensing of wind direction.) The 20° leftward rotation of the egocentric traveling angle would cancel the 20° rightward rotation in the EPG’s allocentric heading estimate to yield, notably, the same allocentric traveling angle in hΔBs or PFRs (Extended Data Fig. 11). In this way, our circuit naturally compensates for varying yaw head angles during flight. This logic assumes and perhaps even intimates that the EPG’s bump position signals the fly’s head angle rather than the body angle. The same logic would not hold if the fly were relying on proprioceptive (or efference-copy) signals from the leg motor-system (rather than optic flow signals from the eyes) to estimate the egocentric traveling direction, which is likely to be the case in walking. In this situation a coordinate transformation would be needed to place egocentric, traveling-direction signals (from the body) in the same reference frame as allocentric, head-direction signals (from the eyes), before impacting the hΔB/PFR boluses in the fan-shaped body.
Methods
Fly husbandry
Flies were raised at 25°C with a 12-h light and 12-h dark cycle. In all experiments, we studied female Drosophila melanogaster that were 2-6 days old. Flies were randomly selected for all of experiments. We excluded flies that appeared unhealthy at the time of tethering as well as flies that did not fly longer than 20 s in flight experiments. This meant excluding fewer than 5% of flies for most genotypes. However, in the perturbational experiments shown in Figs. 4e-p many flies flew poorly––perhaps because these genotypes all expressed 5-6 transgenes which can affect overall health and flight vigor––and we had to exclude ∼70% of flies due to poor tethered flight behavior (i.e., would not maintain continuous flight for > 5 s bouts). The 30% of flies tested in these genotypes flew in bouts that ranged 20 s to many minutes, allowing us to make the necessary EPG/PFR signal comparisons (discussed below). Flies in optogenetic experiments were shielded from green and red lights during rearing by placing the fly vials in a box with blue gel filters (Tokyo Blue, Rosco) on the walls. After eclosion, two days or more prior to experiments, we transferred these flies to vials with food that contained 400µM all-trans-retinal.
Cell type acronym naming conventions
Fly genotypes
For simultaneous imaging of EPGs and PFRs:
In Fig. 1e-j and Extended Data Figs. 6, 7, we used + (Canton S, Heisenberg Laboratory); UAS-GCaMP7f (Bloomington Drosophila Stock Center, BDSC #80906)/+; 60D05-Gal4 (BDSC #39247)/37G12-Gal4 (BDSC #49967) flies.
In Fig. 4f-h, we used +; 60D05-LexA, LexAop-GCaMP6f (BDSC#44277)/37G12-LexA (BDSC #52765); UAS-Kir2.1 (Leslie Vosshall Laboratory)/VT063307-Gal4 (Vienna Drosophila Resource Center, CDRC) flies and +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; UAS-Kir2.1/67D09-Gal4 (BDSC #49618) flies for the experimental groups. For the control groups, we used +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; UAS-Kir2.1/empty-Gal4 (BDSC #68384) flies, +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; VT063307-Gal4/empty-Gal4 flies, and +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; 67D09-Gal4/empty-Gal4 flies.
In Fig. 4j-l, we used +; 60D05-LexA, LexAop-GCaMP6f /37G12-LexA; UAS-GtACR1-EYFP (Adam Claridge-Chang Laboratory)/VT064880-Gal4 (CDRC) flies and +; 60D05-LexA, LexAop-GCaMP6f /37G12-LexA; UAS-GtACR1-EYFP/48A09-Gal4 (BDSC #50342) flies for the experimental groups. For the control groups, we used +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; UAS-GtACR1-EYFP/empty-Gal4 flies, +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; VT064880-Gal4/empty-Gal4 flies, and +; 60D05-LexA, LexAop-GCaMP6f/37G12-LexA; 48A09-Gal4/empty-Gal4 flies.
In Fig. 4n-p, we used UAS-CsChrimson-mVenus (BDSC #55134)/+; 60D05-LexA, LexAop-GCaMP6f/ VT019012-AD; VT005534-LexA (Barry Dickson Laboratory)/72C10-DBD (Janelia FlyLight Split-Gal4 Driver Collection, FlyLight SS52267) flies for the experimental groups. For the control groups, we used UAS-CsChrimson-mVenus; 60D05-LexA, LexAop-GCaMP6f/empty-LexA (BDSC #77691); VT005534-LexA/empty-Gal4 flies, and + (Canton-S); 60D05-LexA, LexAop-GCaMP6f/ VT019012-AD; VT005534-LexA (Barry Dickson Laboratory)/72C10-DBD flies.
In Extended Data Fig. 1b, we used +; UAS-GCaMP6m (BDSC #42748)/+; 60D05-Gal4 /37G12-Gal4 flies.
In Extended Data Fig. 1d-f, we used UAS-CsChrimson-mVenus/+; 60D05-LexA, LexAop-GCaMP6f/ 26A03-AD; VT005534-LexA/54A05-DBD (FlyLight OL0046B) flies.
In Extended Data Fig. 2h (bottom row), we used +; 60D05-LexA/+; LexAop-GCaMP6m, UAS–jRGECO1a (BDSC #63794)/37G12-Gal4 flies.
For simultaneous imaging of EPGs and hΔBs:
In Figs. 1l-o and 3o, we used +; UAS-sytGCaMP7f /72B05-AD (BDSC # 70939); 60D05-Gal4/ VT055827-DBD (BDSC # 71851) flies. We created the sytGCaMP7f construct by linking the GCaMP7f and Drosophila synaptotagmin 1 coding sequences using a 33GS linker. We then used this construct to generate transgenic flies by PhiC31-based integration into attp40 site, performed by BestGene.
For simultaneous imaging of EPGs and PFNds:
In Fig. 2e and Extended Data Fig. 2h (top row), we used +; 60D05-LexA/+; LexAop-GCaMP6m, UAS– jRGECO1a /47E04-Gal4(BDSC #50311) flies.
For simultaneous imaging of EPGs and PFNvs:
In Fig. 2c, d and Extended Data Fig. 2e (left column), h (middle row), we used +; 60D05-LexA/+; LexAop-GCaMP6m, UAS–jRGECO1a/VT063307-Gal4 flies.
For imaging single cell types:
In Fig. 2f-h and Extended Data Figs. 3e-i, n, o, 4g, i, 8a-c, h, i, n, o, we used +; 15E01-AD (BDSC #70558)/+; UAS-GCaMP7f (BDSC #79031)/47E04-DBD (BDSC #70366) flies for PFNds.
In Fig. 2i-k and Extended Data Figs. 3b, c, i, j, k, 4h, i, 8d, e, j, k, p, q, we used +; +; UAS-GCaMP7f/VT066307-Gal4 flies for PFNvs.
In Fig. 2l-n and Extended Data Fig. 4e, f, we used +; +; UAS-GCaMP7f/60D05-Gal4 flies for EPGs.
In Fig. 4b-d, we used pJFRC99-20XUAS-IVS-Syn21-Shibire-ts1-p10 inserted at VK00005 (referred to here as UAS-shibirets) to drive shibirets (Rubin Laboratory). We used +; 37G12-LexA/LexAop-sytGCaMP6s (Vanessa Ruta Laboratory); 60D05-Gal4/UAS-shibirets flies for the experimental group. For the control groups, we used +; 37G12-LexA/LexAop-sytGCaMP6s; 60D05-Gal4/empty-Gal4 flies and +; 37G12-LexA/LexAop-sytGCaMP6s; UAS-shibirets/empty-Gal4 flies.
In Extended Data Fig. 3b, c, i, l, m, we used +; VT020742-AD /+; UAS-GCaMP7f/VT017270-DBD (FlyLight SS47398) flies for LNO1s.
In Extended Data Fig. 3e, f, i, p, q, we used +; VT019012-AD/+; UAS-GCaMP7f/72C10-DBD (FlyLight SS52267) flies for SpsPs.
In Extended Data Fig. 8f, l, r, we used +; UAS-sytGCaMP7f /72B05-AD; +/ VT055827-DBD flies for hΔBs. In Extended Data Fig. 8g, m, s, we used +; +; UAS-GCaMP7f/37G12-Gal4 flies for PFRs.
Distinguishing PFR subtypes in Gal4 lines
The hemibrain connectome38 defines two subtypes of PFR cells33: PFR_a cells and PFR_b cells, which differ in the details of their projections and connectivity in the fan-shaped body. Both PFR_as and PFR_bs are columnar cells that project from the protocerebral bridge to the fan-shaped body. Based on the connectome38, PFR_as and PFR_bs that innervate 4 of the bridge glomeruli project to the fan-shaped body in the same way and PFR_as and PFR_bs that innervate 12 other bridge glomeruli project to the fan-shaped body in a slightly different way. We used this fact to interrogate the MultiColor Flip-Out (MCFO) single-cell anatomical data set58 from the FlyLight Generation 1 MCFO Collection to quantify the ratio of each PFR subtype in the two Gal4 driver lines that we used for targeting transgenes to PFRs. For driver line 37G12, we found 10 out of 13 cells in the MCFO data had an innervation pattern that is consistent with PFR_a but not PFR_b and the innervation patterns of the other 3 cells were indistinguishable between the two subtypes. For driver line VT005534, we found 2 out of 3 cells in the MCFO data were consistent with them being PFR_as and not PFR_bs and the third cell had an anatomy that did not allow us to distinguish between subtypes. We observed no cell whose projection pattern matched PFR_b but not PFR_a. These results argue that the majority of the PFR cells targeted by the two Gal4 driver lines we used are PFR_a cells.
Fly preparation and behavioral setup
As described previously, we glued flies to a custom stage for imaging during flight40 and to a slightly different custom stage––which allows for more emission light to be collected by the objective––for imaging during walking15. Dissection and imaging protocols followed previous studies15. For tethered flight experiments, each fly was illuminated with 850 nm LEDs with two fiber optics from behind40. A Prosilica GE680 camera attached to a fixed-focus Infinistix lens (94-mm working distance, 1.0× magnification, Infinity) imaged the fly’s wing-stroke envelope at 80-100 Hz. The lens also held an OD4 875-nm shortpass filter (Edmund Optics) to block the two-photon excitation laser (925 nm). This camera was connected to a computer that tracked the fly’s left and right wing beat amplitude with custom software developed by Andrew Straw (https://github.com/motmot/strokelitude)40. Two analog voltages were output in real time by this software and the difference between the left and right wingbeat amplitude was used to control the angular position of the bright dot on the LED arena in closed-loop experiments (described below). For tethered walking experiments we followed protocols described previously15.
LED arena and visual stimuli
We used a cylindrical LED arena display system59 with blue (465 nm) LEDs (BM-10B88MD, Betlux Electronics). The arena was 81° high and wrapped around 270° of the azimuth, with each pixel subtending ∼1.875°. To minimize blue light from the LEDs inducing noise in the microscope’s photomultiplier tubes, we reduced the LED intensities, over most of the arena, by covering the LEDs with five sheets of blue gel (Tokyo Blue, Rosco). Over the top 16 pixels top of the arena, we only placed two gel sheets, so that the closed-loop dot at the top of the arena was brighter than the optic flow at the bottom, which may have helped to promote that the fly interpret the bright blue dot as a celestial cue (like the sun) and the optic-flow at the bottom as ground or side motion. During flight experiments, we held the arena in a ∼66° pitched-back position, so that the LED vertical and horizontal axes matched the major ommatidial axes of the eye45. During walking experiments, we typically presented a tall vertical bar––rather than a small dot––in closed loop and we tilted the arena by only ∼30° because the ball physically occludes the ventral visual field and a shallower arena tilt made it more likely that the fly could see the closed-loop stimulus over all 270° of the azimuthal positions that it could take.
We adapted past approaches for generating optic flow (starfield) stimuli44,45. In brief, we populated a virtual 3D world with forty-five, randomly positioned spheres (2.3-cm diameter) per cubic meter. The spheres were bright on a dark background. We only rendered spheres that were within two meters of the fly because spheres further away contributed only minimally to the observed motion and, if rendered, would have overpopulated the visual field with bright pixels. We then calculated the angular projection of each sphere onto the fly’s head and used this projection to determine the pattern to display on the LED arena on each frame. To prevent the size of each sphere from being infinitely large as it approached the fly, we limited each sphere’s diameter on the arena to be no larger than 7.5°. The starfield extended from 4 pixels (∼8°) above to 20 pixels (∼40°) below the arena’s midline. In all experiments that employed open-loop optic flow (Figs. 1, 2f-n, 3o and Extended Data Figs. 3b-i, 4, 6e, 7, 8), the optic-flow position was updated at a frame rate of 25 Hz. (Note that the LED refresh rate was at least 372 Hz59.) To simulate the optic flow that a fly would experience when it is translating through 3D space, we moved a virtual fly in the desired direction(s) through the virtual world and displayed the resultant optic flow pattern on the arena. We used a translation speed of 35 cm/s in all experiments, except those in Extended Data Figures 7 and 8 where we tested multiple speeds as indicated (ranging from 8.75 to 70 cm/s). Although we report on the translation speed of the virtual fly in metric units, the optic flow experienced by insects translating at 35 cm/s will vary dramatically depending on the clutter of the local environment. We believe that the optic flow stimuli we presented in our study are likely to be in an ethologically relevant range because (1) our virtual fly translated at speeds that bracket observed flight speeds in natural environments60– 62 and (2) optic-flow sensitive cells reported on here (and others not discussed in this study) responded with progressively increasing activity to the presented stimuli/speeds rather than immediately saturating or showing no detectable responses (e.g., Extended Data Fig. 8). That said, our stimuli simulated a dense visual environment and it will be important to test our results in the context of reduced visual clutter in future work.
In flight experiments with a closed-loop dot (Figs. 1, 2c-e, 3o and Extended Data Figs. 2, 3b-f, i, 6e, 7), the dot subtended 3.75° by 3.75° and was located ∼34° above the arena’s midline. We used the difference of the left and right wingbeat amplitudes (L–R WBA) to control the azimuthal velocity of the bright dot on the LED arena. That is, when the right wingbeat amplitude is smaller than the left wingbeat amplitude (indicating that the fly is attempting to turn to the right), the dot rotated to the left, and vice versa. The negative-feedback closed-loop gain was set to 7.3°/s per degree change in L–R WBA. In closed-loop walking experiments with a visual stimulus (Fig. 4b-d and Extended Data Fig. 1), the bright bar was 11.25° wide and spanned the entire height of the arena. We directly linked the azimuthal position of the bright bar on the LED arena to the azimuthal position of the ball under the fly using Fictrac15,63, as described previously. This closed-loop set up mimics the visual experience of a fly with a bright cue at visual infinity, like the sun. We did not provide translational stimuli in closed loop in this paper.
Calcium imaging
We used a two-photon microscope with a movable objective (Ultima IV, Bruker). The two-photon laser (Chameleon Ultra II Ti:Sapphire, Coherent) was tuned to 1000-1010 nm for simultaneous imaging of GCaMP6m and jRGECO1a (Fig. 2c-e and Extended Data Fig. 2), and was otherwise tuned to 925 nm in all of the other imaging experiments. We used a 40x/0.8 NA objective (Olympus) or 16x/0.8 NA objective (Nikon) for all imaging experiments. The laser intensity at the back aperture was 30-40mW for walking experiments and 40-80mW for flight experiments. Because of light loss through the objective and the fact that the platform to which the fly was attached blocks ∼half the light from reaching the fly, we estimate an illumination intensity, at the fly, of ∼16-32mW for flight experiments. In walking experiments, the platform to which we attach the fly blocks less light and we expect an illumination intensity, at the fly, of ∼24-32mW. A 575 nm dichroic split the emission light. A 490-560nm bandpass filter (Chroma) was used for the green channel PMT and a 590-650nm bandpass filter (Chroma) was used for the red channel PMT. We recorded all imaging data using three to five z-slices, with a Piezo objective mover (Bruker Ext. Range Piezo), at a volumetric rate of 4-10 Hz. We perfused the brain with extracellular saline composed of (in mM) 103 NaCl, 3 KCl, 5 N-Tris(hydroxymethyl) methyl-2-aminoethanesulfonic acid (TES), 10 trehalose, 10 glucose, 2 sucrose, 26 NaHCO3, 1 NaH2PO4, 1.5 CaCl2, 4 MgCl2, and bubbled with 95% O2/5% CO2. The saline had a pH of ∼7.3 and an osmolarity of ∼280 mOsm. We controlled the temperature of the bath by flowing the saline through a Peltier device and measured the temperature of the bath with a thermistor (Warner Instruments, CL-100).
Optogenetic stimulation
In the optogenetic experiments in Fig. 4j-l, we used the two-photon laser tuned to 925 nm to excite GtACR1, with the same scanning light being used to excite GCaMP. To excite CsChrimson in the optogenetic experiments in Fig. 4n-p and Extended Data Fig. 1), we focused 617nm laser (M617F2, Thorlabs) on to the front, middle of the fly’s head with a custom lens set (M15L01 and MAP10100100-A, Thorlabs). We placed two bandpass filters (et620/60m, Chroma) in the two-photon microscope’s emission path to minimize any of the optogenetic light being measured by the photomultiplier tubes. In flight experiments (Fig. 4n-p), we used pulse-width modulation at 490Hz (Arduino Mega board) with a duty cycle of 0.8 to change the 617 nm laser’s intensity. We measured the laser’s intensity at the fly’s head to be 20.8 µW. In the experiments where we triggered backward walking via activation of csChrimson (Extended Data Fig. 1) in lobula columnar neurons, the duty cycle of the red light was 0.7 and the effective light intensity was 18.2 µW.
In Fig. 4j-l, for two main reasons, rather than directly exciting PFNvs, we optogenetically inhibited the LNO1 inputs to PFNvs. First, [Ca2+] imaging revealed opposite responses to our optic flow stimuli in the two cell types (Extended Data Fig. 3a-c), as mentioned earlier, arguing for a sign-inverting synapse between them. Second, we tried optogenetically activating the PFNvs directly (data not shown), which yielded more variable movements of the PFR bolus. We believe that stimulating LNO1s yielded more consistent effects on the PFR bolus because there are only two LNO1s per side and they synapse uniformly on all PFNvs within a tiny neuropil (the second layer of the nodulus) on their side38. Stimulating GtACR1 in a small volume likely made homogeneous activation of the PFNv population more feasible.
Data analysis
Data acquisition and alignment
All data were digitized by a Digidata 1440 (Molecular Devices) at 10kHz, except for the two-photon images which were acquired using PrairieView (Bruker) at varying frequencies and saved as tiff files for later analysis. We used the frame triggers associated our imaging frames (from Prairie View), recorded on the Digidata 1440, to carefully align behavioral measurements with [Ca2+] imaging measurements.
Experimental Structure
For Fig. 1d-g, each fly performed tethered flight while in control of a bright dot in closed loop. Each recording was split into three segments, where we first presented a static starfield for 90 s, followed by progressive optic flow for 90 s, and ending with another static starfield for 90 s.
For Fig. 1h-j and Extended Data Fig. 6e, we presented each fly with a closed-loop dot throughout. We presented four blocks of eight optic-flow stimuli (six translational plus two rotational) per block, shown in a pseudorandom order. Each 4 s optic flow stimulus was preceded and followed by 4 s of optic flow that mimics forward travel, which ensured that the EPG and PFR bumps were aligned––for a stable “baseline”––before and after each tested optic flow stimulus. We presented 4 s of a static starfield between each repetition of the above three patterns. We employed the same protocol for Figs. 1l-o and 3o, but we just presented the six translational optic flow stimuli, without the two, rotational optic flow stimuli.
For Fig. 2c-e and Extended Data Fig. 2e, h, each fly was presented with a closed-loop dot and static starfield throughout the recording. Recording durations ranged from 1-4 min.
For Figs. 2f-n and Extended Data Figs. 3e-h (PFNd rows), i (PFNds in the noduli, PFNds and PFNvs in the bridge), 4, 8, we did not have a closed-loop dot. We presented four blocks of 24 stimuli (6 translational directions at 4 different speeds) per block, shown in a pseudorandom order. Each stimulus was preceded by 1.2-s of a static starfield, followed by 4 s of optic flow at different directions, and ending with a 1.2-s static starfield.
For Fig. 4b-d, each fly was presented with a tall bright bar in closed-loop throughout. EPG > Shibirets flies experienced both 25°C and 34°C trials in these experiments and we waited ∼5 min after the bath temperature reached 34°C before imaging in the EPG silenced condition so as to increase the likelihood of thorough vesicle depletion. Recording durations ranged from 6-8 min.
For Fig. 4f-h, j-l, flies performed tethered flight in the context of a dark (unlit) visual display. We recorded data for ∼1-4 min and if the fly was flying robustly, we collected a second data set from the same fly.
For Fig. 4n-p, flies performed tethered flight in the context of a dark (unlit) visual display. We recorded data for 2-6 min. and if the fly was flying robustly, we collected a second data set from the same fly. We presented 12 s red light pulses to activate csChrimson every ∼20 s.
For Extended Data Fig. 1b, each fly was presented with a tall bright bar in closed-loop throughout. We recorded data for 10 min., with up to three 10-min. data sets collected per fly.
For Extended Data Fig. 1c-f, each fly was presented with a tall bright bar in closed-loop throughout. We recorded data for 7-10 min., with up to 3 data sets collected per fly. We presented 4 s red light pulses to activate csChrimson every 1-3 min.
For Extended Data Fig. 3b, c, e-f (SpsP rows) and i (PFNvs in the noduli, SpsPs and LNO1s), we presented each fly with a closed-loop dot throughout. We presented four blocks of eight optic-flow stimuli (six translational plus two rotational) per block, shown in a pseudorandom order. Each optic flow stimulus was preceded by 4-s of a static starfield, followed by 4-s of optic flow at different directions, and ending with a 4-s of static starfield.
For Extended Data Fig. 3j-q, each fly was walking in the dark. We recorded data for 5 min., with up to three 10-min. data sets collected per fly.
For Extended Data Fig. 7, we presented each fly with a closed-loop dot throughout. We presented three blocks of 18 stimuli per block (6 translational directions at 3 different speeds), shown in a pseudorandom order. Each stimulus was preceded by 1.2-s of a static starfield and 4 s of translational optic flow simulating forward travel, followed by 4 s of optic flow at different directions, and ending with a 4 s of optic flow simulating forward travel.
Image registration
Before quantifying fluorescence intensities, imaging frames were registered in Python by translating each frame in the x and y plane to best match the time-averaged frame for each z-plane. Multiple recordings from the same fly were registered to the same time-averaged template if the positional shift between recordings was small.
Defining regions of interest
To analyze calcium imaging data, we defined regions of interest (ROIs) in Fiji and Python for each glomerulus (protocerebral bridge), wedge (ellipsoid body) or column (fan shaped body). For the bridge data, we defined ROIs by manually delineating each glomerulus from the registered time-averaged image of each z-plane (Fig. 2 and Extended Data Figs. 2, 3e-h PFNd row, i PFNds and PFNvs in the bridge, j-k, n-o, 4, 8a-e, h-k, n-q), as described previously15. Because single SpsP neurons innervate the entire left or right side of the protocerebral bridge (Extended Data Fig. 3e, f (SpsP row), p-q), when imaging them we treated the entire left bridge as one ROI and the entire right bridge as another. When imaging PFNs or LNO1s in the noduli (Extended Data Figs. 3b-c, i, l-m), we treated the entire left nodulus as one ROI and the entire right nodulus as another.
For ellipsoid body imaging (Figs. 1, 3o, 4 and Extended Data Figs. 1, 6, 7), we defined ROIs by first outlining the region of each z-slice that corresponded to the ellipsoid body. We then radially subdivided the ellipsoid body into 16 equal wedges radiating from a manually defined center, as describe previously12. For fan-shaped body imaging (Figs. 1, 3o, 4 and Extended Data Figs. 1, 6, 7, 8f-g, l-m, r-s), we defined ROIs by first outlining the region in each z-slice that corresponded to the fan-shaped body. We then defined two boundary lines delineating the left and right edges of the fan-shaped body. When these two edge lines were extended down, they met at an intersection point beneath the fan-shaped body. We subdivided the angle generated by thus intersecting the two fan-shaped body edges––which corresponds to the overall angular width of the fan-shaped body region––into 16, equally spaced, angular subdivisions radiating from the intersection point. We assigned pixels to one of the sixteen fan-shaped body columns based on the pixel needing to (1) reside in the overall fan-shaped region and (2) reside in the radiating angular region associated with the column of interest.
Calculating fluorescence intensities
We used ROIs, defined above, as the unit for calculating fluorescent intensities (see above). If pixels from multiple z-planes corresponded to the same ROI (e.g., the same column in the fan-shaped body), as defined above, then we grouped pixels from the multiple z-planes together for generating single fluorescence signal for that ROI. For each ROI, we calculated the mean pixel value at each time point and then used three different methods for normalization. We call the first method ΔF/F0 (Figs. 2d-n, 3m and Extended Data Figs. 2, 3i PFNds and PFNds in the bridge, j, l, n, p, 4, 8), where F0 was defined as the mean of the lowest 5% of raw fluorescence values in a given ROI over time and ΔF was defined as F – F0. We call the second method normalized ΔF/F0 (Figs. 1, 2c, 3o, 4, and Extended Data Figs. 1, 6, 7), which uses this equation: (F – Fmax)/(Fmax-F0), where F0 was still the mean of the lowest 5% of raw fluorescence values in a given ROI over time and Fmax was defined as the mean of the top 3% of raw values in a given ROI over time. This metric normalizes the fluorescence intensity of each glomerulus, wedge or column ROI to its own minimum and maximum and makes the assumption that each column, wedge or glomerulus has the same dynamic range as the others in the structure, with intensity differences arising from technical variation in the expression of indicator or from the number of cells expressing indicator within a column or wedge. We used this method to estimate the phase of heading/traveling signals where it seemed reasonable to make the above assumption for accurately estimating the phase of a bolus in a structure. We call the third method z-score normalized ΔF/F0 (Extended Data Figs. 3b-h, i signals in the noduli and SpsPs, k, m, o, q) where we show how many standard deviations each time point’s signal is away from the mean. We calculated the signal as ΔF/F0 and then we z-normalized the signal. We used this method to estimate the asymmetry of neural responses to optic flow in the bridge or noduli, where it seemed sensible to normalize the baseline asymmetry (when there are no visual stimuli) to zero. Importantly, none of the conclusions presented in this paper rely on the normalization method used for visualizing and analyzing the data.
Calculating the phase of boluses and aligning phase across structures
To calculate the phase of the joint movement of the calcium boluses in the left and right protocerebral bridge, we first converted the raw bridge signal into a 16-to-18-point vector, with each glomerulus’ signal normalized as described above. Then, for each time point, we took a Fourier transform of this vector and used the phase at a period of 8 glomeruli to define the phase of the boluses, as previously described15. To calculate phase of the EPG bump in the ellipsoid body, we computed the population vector average of the 16-point activity vector, as previously described12. To calculate the phase of the PFR bolus in the fan-shaped body, we computed the population vector average like in the ellipsoid body, using the following mapping of fan-shaped body columns to ellipsoid body wedges. The leftmost column in the fan-shaped body corresponded to the wedge at the very bottom of the ellipsoid body, just to the left of the vertical bisecting line; the rightmost column in fan-shaped body corresponded to the wedge at the very bottom of the ellipsoid body, just to the right of the vertical bisecting line. We then numbered the fan-shaped body columns 1 to 16, from left to right, just like we numbered the ellipsoid body wedges clockwise around that structure12. This mapping is meant to match the expected mapping of signals from anatomy, described previously33, and as further discussed immediately below.
To align the EPG phase in the ellipsoid body with the PFR phase or the hΔB phase in the fan-shaped body, we used the approach just described (Figs. 1, 3, 4, and Extended Data Figs. 1, 6, 7). To align the EPG and PFNd and PFNv phase signals in the protocerebral bridge (Fig. 2c-e), we used the fact that these neuron populations commonly innervate 14/18 glomeruli in the protocerebral bridge, which allows for an obvious alignment anchor, as done previously15. To calculate the offset between the phase of neural boluses and the angular position of a cue (bright bar or dot) rotating in angular closed loop on our visual display, we computed the circular mean of the difference between the neural phase and the cue angle during the time points when the cue was visible to the fly. We used this difference to provide a constant (non-time-varying) offset to the neural phase signal such that the difference between the phase and cue angles was minimized across the whole measurement window of relevance. This approach is needed because of the past finding that phase signals in the central complex have variable offset angles to the angular position of cues in the external world across flies (and sometimes across time within a fly)12,15. To calculate the phase offset between neural bolus position and visual cue angle, we did not analyze time points when the fly was not flying in all of our flight experiments (Figs. 1-4, and Extended Data Figs. 2, 3, 4, 6-8) nor did we analyze time points when the fly was standing in walking experiments (Fig. 4c, d). For a fly to be detected as standing, the forward speed needed to be less than 2 mm/s, the sideslip speed less than 2 mm/s, and the turning speed less than 30 °/s. We also excluded the first 10 s of each period in Figure 1f-g to minimize the impact of a changing visual stimulus on the offset estimate.
Comparing data acquired at different sampling rates or with a time lag
When comparing two-photon imaging data (collected at ∼5-10 Hz) and behavioral (flight turns or ball walking) data (collected at 50-100 Hz) for the same fly, we subsampled the behavioral data to the imaging frame rate by computing the mean of behavioral signals during the time window in which each imaging data point was collected (Figs. 1f, 4b-d and Extended Data Figs. 1f, 3j-q), as previously described15.
Although we collected both the EPG signal in the ellipsoid body and the PFR signal in the fan-shaped body at the same frame rate, the precise time points in which these two signals were sampled were slightly different because the piezo drive that moves the objective had to travel from the higher fan-shaped body z-levels to the lower ellipsoid body z-levels. Importantly, each z-slice in a such volumetric time series was associated with its own trigger time and we could use this fact to more accurately align the fan-shaped body and ellipsoid body phase signals to each other. Specifically, when comparing EPG and PFR bolus positions over time, we first created a common 10 Hz (100 ms interval) time base. We then assigned phase estimates from the two structures/cell-types to this common time base by linearly interpolating each time series (using its specific z-slice triggers) and we used these interpolated time points, on the common time base, for calculating the phase differences between EPGs and PFRs, or EPGs and hΔBs (Figs. 1h-o, 3o and Extended Data Figs. 1e, f, 6, 7). For the histograms and other analyses in Figures 1g, 4g, h, k, l, o, p, we simply subtracted the EPG phase and the PFR phase measured in each frame, without temporal interpolation. None of our conclusions are altered if we change the interpolation interval or do not interpolate.
Backward walking analysis
We expressed CsChrimson in a group of lobula columnar neurons, LC16, whose activation with red light has been shown to induce flies to walk backward (Extended Data Fig. 1c-f, more details in ‘Optogenetic stimulation’)47. Consistent with previous studies in free walking flies47, we also observed variable backward walking behaviors mixed with sideward walking and turning in our tethered preparation. To test whether the PFR phase separates from the EPG phase when a fly walks backward, we analyzed optogenetic activation trials based on the following three criteria being met. First, the backward walking speed needed to be larger than 6 mm/s. Second, the duration of continuous backward walking (defined by backward walking speed being above 0.5 mm/s) needed to be longer than 1 s. Third, during the backward walking period, the sideward walking velocity needed to be biased toward one direction; the fraction of optogenetic trials in which the sideward velocity was clearly either positive or negative exceeded 80%. We included this third criterion so that we could split optogenetic trials into those where the PFR phase should have moved to the right and those in which it should have moved to the left in the fan-shaped body (Extended Data Fig. 1c-f).
Phase nulling
To compute the time-averaged shape of the bolus in PFNs and EPGs, we followed previous methods15. In brief, we (1) computationally rotated each frame by the estimated phase of the bolus on that frame, such that the bolus peak was at the same location on all frames and then (2) averaged together the signal from all frames to get an averaged bolus, whose shape we could analyze via fits to sinusoids (Fig. 2 and Extended Data Figs. 2, 4, 8a). In this phase nulling process, we first interpolated the GCaMP signal from each frame to 1/10 of a glomerulus, column, or wedge with a cubic spline. We then shifted this interpolated signal by the phase angle calculated for that frame. In both the ellipsoid body and fan-shaped body, we performed a circular shift, such the signals wrapped around the edges of the fan-shaped body. In the protocerebral bridge, we performed this circular shift independently for the left and right bridge. For the protocerebral bridge data, we subsampled the spatially interpolated GCaMP signal back to a 16-glomerulus vector before plotting the data (Fig. 2 and Extended Data Figs. 2, 4, 8a) so as to more accurately reflect, in our averaged signals, what the actual signal in the brain looked like.
Modeling
We constructed and analyzed an analytical model of the synaptic input to hΔB neurons to understand how the traveling direction determines the angular location of the peak hΔB activity across the fan-shaped body. Neurons in the model are labeled by an angle θthat indicates the glomerulus in the protocerebral bridge innervated by a particular neuron or, in the case of hΔB, its position in the fan-shaped body. In reality, this angle label takes discrete values (Extended Data Fig. 4b, j, k) but, to simplify the notation, we use a continuous label here.
The fly’s allocentric heading angle is denoted by H, and its allocentric traveling direction angle by T. The egocentric traveling angle is then T-H. Another relevant angle is the angular location of the bolus of EPG activity in either the ellipsoid body or the protocerebral bridge. All these angles are measured relative to an arbitrary axis and, for simplicity, we choose this axis so that the bump angle is −H, the negative of the heading angle. The minus sign reflects the fact that when the fly turns clockwise the bump rotates counterclockwise.
To make things less confusing with regard to this minus sign, we flipped the orientation of the horizontal axis in some of our figures.
The activity of each PFN class forms a sinusoidal pattern across the protocerebral bridge (Fig. 2d, e) and fan-shaped body. We are interested in constructing the PFN input to the hΔBs, so we model these patterns in the fan-shaped body: where i = 1, 2, 3, 4 refers to right-bridge PFNd, left-bridge PFNd, right-bridge PFNv, and left-bridge PFNv, and aiand ciare free parameters. Ai(T − H)is the amplitude of the sinusoid for PFN i when the egocentric traveling angle is T − H (Fig. 2g, h, j, k). The angles ψare the shifts in the PFN-to-hΔB projections (Fig. 3n). The above equation implies that the mean PFN activity across θ values is
We fit the mean PFN activities by using the data points for Ai(T − H)and adjusting the parameters ai and ci(Extended Data Fig. 8n-q). The above equation also allows us to extract the amplitudes A from the means ⟨PEN(θ)⟩, a feature we took advantage of when using data obtained from the noduli. We fit the PFN amplitudes as shifted sinusoids, where αi, γi and ϕi are free parameters. The fits obtained from this formula are shown in Fig. 2g, h, j, k for one speed, and in Extended Data Fig. 8b-e for all four speeds tested.
The input to the hΔBs is given by the sum of PFN activities weighted by factors g that reflect the strength of their connections to the hΔB,
For reasons provided below, we choose the g so that giγiαi = C for all i, where C is a single constant that scales the hΔB response. The traveling direction angle encoded by the model (Fig. 3o) is the value of θthat maximizes the above expression for a given value of T − H. To generate the results in Fig. 3o, we used the data points for the amplitudes Ai(T − H). Note that the maximizing θvalue does not depend on the parameters ai, cior C, which means that the model results in Fig. 3o do not involve any additional parameters beyond what we extracted from the PFN and EM data.
We also modeled the input to the PFR neurons as the sum of the activities of their inputs from hΔB, PFNd and EPG neurons. The EPG inputs to the PFRs appear to be weak, and we consistently found that the best fits to the data were obtained with the strength of the EPG-to-PFR connection set to zero. Therefore, we leave the EPG input out of this discussion. Using the remaining inputs, we have where G0 is an overall scale factor, and G1 and G2 are relative input-strength factors. We used the data points for the responses of the hΔB and PFN inputs in the above equation to generate the fit in Extended Data Figure 6e. Because G0 does not affect this result and we imposed the constraint G1 = G2, this fit involves one free parameter.
We now provide a complete analysis of the model outlined above. To simplify the model, we note that the values of αi for all i are close to each other, so we replace all four with a single parameter . We assume that all four PFNs contribute equally to the hΔB activity (although this assumption is not essential) so, as above, we set giγiαi = C for all i but, in this case, the condition is . As a result giγi = D for all i, where is another constant. Under these assumptions where H0 denotes all the terms that do not depend on θ. We do not need to consider these terms in our analysis because we are interested in deriving the profile of the hΔB input across the fan-shaped body, that is the activity as a function of θ, not the mean level of this activity.
The angles ψ are spaced from each other by differences close to 90° (Fig. 3n), suggesting that the 4 PFNs are acting as an orthogonal system. In this case, for vectors to be represented faithfully, the angles ψ, reflecting the anatomy of the PFN projections, and the angles φ, that reflect the physiology of the PFN responses, should be equal to each other, that is, ψi = ϕi for all i. The data (Fig. 3n, m) suggest that these common angles are 45°, −45°, −135° and 135°. With these angular values, the middle term on the right side of the above equation is zero, and summing the third term gives
This means that the hΔB input is maximal at θmax = −T, indicating that the angle of the hΔB bolus is aligned with the traveling direction angle. The minus sign implies that the hΔBs encode minus the traveling-direction angle, −T, just as the EPGs encode minus the heading angle, −H.
An interesting feature of the sinusoidal representation of 2-D vectors is that it nicely accommodates non-orthogonal coordinate systems. Our estimate of the angles ψinvolves a number of assumptions and, as mentioned in the Discussion, it is possible that these angles can even change in different contexts (such as walking vs. flying). If these angles are not separated by 90°, this implies a non-orthogonal coordinate system. In this case, the two sets of angles, ψ and ϕ, are not equal, but there is still a definite relationship between them. Assuming a noise-robust solution, this relationship can be derived by performing a pseudo-inverse operation on a matrix of unit vectors oriented at the angles ψto derive ϕ, or at the angles ϕ to derive ψ. In addition, the coupling strengths g need to be adjusted to accommodate the lengths of the vectors arising from this computation.
Data and code availability
All data and analysis code are available upon request.
Acknowledgements
We thank the labs of V. Ruta, B. Dickson and L. Vosshall labs for fly stocks and members of the Maimon laboratory, especially P. Mussells-Pires, for helpful discussions. We thank J. Green and A. Adachi for recombinant stocks, which made this study progress faster than otherwise possible. We thank A. Rizvi for helpful comments on the abstract. We thank Rachel Wilson and Jenny Lu for sharing the hypothesis that the hΔBs may be the locus for the vector integration process rather than PFRs, given anatomical considerations. We thank V. Vijayan and J. Weisman for helping to optimize the csChrimson optogenetics approach during two-photon imaging. We thank A. Kim for sharing code for making optic-flow stimuli, developed off of code initially given to us by P. Weir in the laboratory of M. Dickinson. We thank I. Morantte from the lab of V. Ruta and P. Mussells-Pires for developing the genetic strategy and organizing the plasmids needed to generate the UAS-sytGCaMP7f fly line. Stocks obtained from the Bloomington Drosophila Stock Center (NIH P40OD018537) and the Vienna Drosophila Resource Center were used in this study. Research reported in this publication was supported by a Brain Initiative grant from the National Institute of Neurological Disorders and Stroke (R01NS104934) to G.M. and a Kavli Foundation seed grant to C.L. L.A was supported by NSF NeuroNex Award DBI-1707398 and the Simons Collaboration for the Global Brain. G.M. is a Howard Hughes Medical Institute Investigator.