Navigational strategies underlying temporal phototaxis in Drosophila larvae

Navigating across light gradients is essential for survival for many animals. However, we still have a poor understanding of the algorithms that underlie such behaviors. Here we develop a novel phototaxis assay for Drosophila larvae in which light intensity is always spatially uniform but updates depending on the location of the animal in the arena. Even though larvae can only rely on temporal cues in this closed-loop setup, we find that they are capable of finding preferred areas of low light intensity. Further detailed analysis of their behavior reveals that larvae turn more frequently and that heading angle changes increase when they experience brightness increments over extended periods of time. We suggest that temporal integration of brightness change during runs is an important – and so far largely unexplored – element of phototaxis. Summary statement Using a novel closed-loop behavioral assay, we show that Drosophila larvae can navigate light gradients exclusively using temporal cues. Analyzing and modeling their behavior in detail, we propose that larvae achieve this by integrating brightness change during runs.


27
Navigating across light gradients is essential for survival for many animals. However, we still 28 have a poor understanding of the algorithms that underlie such behaviors. Here we develop a 29 novel phototaxis assay for Drosophila larvae in which light intensity is always spatially uniform 30 but updates depending on the location of the animal in the arena. Even though larvae can only 31 rely on temporal cues in this closed-loop setup, we find that they are capable of finding 32 preferred areas of low light intensity. Further detailed analysis of their behavior reveals that 33 Introduction 39 Many animals have evolved behaviors to find favorable locations in complex natural 40 environments. Such behaviors include chemotaxis to approach or avoid chemical stimuli; 41 thermotaxis to find cooler or warmer regions; and phototaxis to approach or avoid light (Gepner 42 et al., 2015;Gomez-Marin and Louis, 2014;Gomez-Marin et al., 2011;Kane et al., 2013;Klein 43 et al., 2015;Luo et al., 2010). 44 Drosophila larvae are negatively phototactic, preferring darker regions (Sawin et al., 1994). 45 To navigate, larvae alternate between runs and turns. During runs, larvae move relatively 46 straight. During turns, they slow down and perform head-casts (Lahiri et al., 2011) to sample 47 Data analysis and statistics 131 All data analysis was performed using custom-written Python code on the 45 min period after 132 acclimatization. To avoid tracking problems and minimize boundary effects, data were excluded 133 where larvae were within 0.1 cm distance to the edge. 134 The circular arena was binned in three concentric regions depending on the radius ‫ݎ‬ . These regions were named the "Bright" center, the "Dark" 136 ring, and the "Bright" ring for the "Valley" stimulus ( Fig. 1B) and the "Dark" center, the "Gray" 137 ring, and the "Bright" ring for the "Ramp" stimulus ( Fig. S3A). Animal speed was computed by 138 interpolating the trajectory to 1 s bins and then by taking the average distance of consecutive 139 points (Fig. 1E). 140 For the turn event-based offline analysis (Fig. 2), a pose estimation toolbox, DeepPoseKit 141 (Graving et al., 2019), was used. To this end, 100 frames were manually annotated (head, 142 centroid, and tail) to train the neural network, which was then used to predict animal posture 143 across all frames from all animals. Body curvature was defined as the angle between the tail-to-144 centroid vector and the centroid-to-head vector ( Fig. 2A). The pose estimation algorithm 145 occasionally had difficulties distinguishing between the head and the tail. This problem was, 146 however, not relevant for the curvature measurement as the angle between these two body 147 parts does not change when they are flipped. In a few frames, the algorithm placed the head 148 and the tail at the same location, leading to the transient detection of large body curvatures. 149 These events were discarded by low-pass filtering traces with a Butterworth filter (cutoff 150 frequency: 3 Hz). Turn events were defined as a local curvature peak above 30° and needed to 151 be separated from the previous event by at least 2 s in time and 0.2 cm in space. The value for 152 the curvature threshold was chosen such that the identified curvature peaks clearly stood out 153 from the curvature fluctuations in between events ( Fig. 2A). 154 Turn angles were defined as the angle between the location in the arena 2 s before a turn 155 event and 2 s after. Run-length was defined as the time between consecutive turn events. Each 156 turn event was labeled as "Dark" or "Bright", based on the brightness equations and binning 157 described above (Dark: pixel brightness less than 29, Bright: otherwise), and as "Darkening" or 158 "Brightening" based on the sign in brightness change since the last turn event (Fig. 2E,F). As 159 turn events are short and spatially confined, by stimulus design, the whole-field brightness 160 change during such events is nearly zero (Fig. 2D). Notably, our curvature-based turn event 161 identification procedure does not allow for precise labeling of the beginning and the end of the 162 event. Therefore, the brightness change during turns was defined as the brightness difference 163 0.5 s before and 0.5 s after the event. This time range often includes brief periods of runs, 164 explaining the small residual width of the reported brightness distribution (Figs. 2D and 3E). 165 The brightness change during runs was defined as the difference in brightness between two 166 consecutive turn events (Figs. 2D and 3E). In correspondence with our experimental findings (Fig. 2E,F), the model was equipped with 189 four additional navigational rules (Fig. 3A). 190 "Rule 1": When the environment is "Dark" (brightness smaller than 29), turn angles 191 decrease. When it is "Bright" (brightness larger than 29), turn angles increase. 192 "Rule 2": When the environment is "Dark" (brightness smaller than 29), run-lengths increase. 193 When it is "Bright" (brightness larger than 29), run-lengths decrease. "Rule 3": When the environment is "Darkening" (change since previous turn smaller than 195 zero), turn angles decrease. When it is "Brightening'' (change since previous turn larger than 196 zero), turn angles increase. 197 "Rule 4": When the environment is "Darkening" (change since previous turn smaller than 198 zero), run-lengths increase. When it is "Brightening'' (change since previous turn larger than 199 zero), run-lengths decrease. 200 Changes in turn angle were accomplished by adjusting the standard deviation of the 201 Gaussian distribution by ±30%, the effect size observed in our experiments (Fig. 2E,F). We 202 modulated run-length (T) by scaling them by ±30%, thereby modulating the probability of turning 203 (p = dt / T). When combinations of those rules were tested (Fig. 3A), effects were concatenated. 204 A performance index (PI) (Fig. 3A) was used to characterize how well animals or models 205 performed temporal phototaxis. The metric was based on the difference between the 206 experimental and control group for the fraction of time spent in the "Dark" ring. To compute this 207 value, bootstrapping was used to average 1000 samples of randomly chosen differences 208 between experimental and control conditions. 209 For the parameter grid search (Fig. 3A), the absolute turn angle and the run-length were 210 varied systematically. To this end, respective baseline parameter values (taken from the 211 experiment, Fig. 2E,F), were changed by scaling them with two multipliers (run-length multiplier 212 and turn angle multiplier). 213 Data generated from model larvae were analyzed and displayed using the exact same 214 scripts that were used to analyze experimental data, allowing for easy comparison between 215 model and animal behavior. 216 217

219
Fly larvae can navigate a virtual brightness gradient 220 We first asked whether fly larvae can perform temporal phototaxis, i.e. navigate a virtual light 221 landscape lacking spatial information. We placed individual animals in an agarose-filled arena, 222 allowed them to freely explore, and tracked their position in real-time (Fig. 1A). We presented 223 spatially uniform light from below, with brightness levels following a quadratic dependence of the 224 larva's distance from the center ("Valley" stimulus, Fig. 1B) or constant gray as a control 225 ("Constant" stimulus). For both groups, we analyzed how animals distribute across three 226 concentric regions: the "Bright" center, the "Dark" ring, and the "Bright" ring. Notably, throughout 227 this study control animals were always analyzed as if they navigated the experimental stimulus 228 even though they in fact perceived constant gray. This analysis is important to control for the 229 spatial arrangement of our stimulus and boundary effects. 230 Larvae that navigated the "Valley" stimulus spent a significantly higher fraction of time in the 231 "Dark" ring than those that navigated the "Constant" stimulus (Figs. 1C,D and S2B). This 232 behavior was most pronounced between minutes 10 and 40 of the experiment (Fig. S2C). To 233 verify that this behavior was not an artifact of our specific stimulus design, we also tested a 234 gradient where brightness monotonically "ramps" with radial distance (Fig. S3A) and observed 235 that larvae also here navigated to dark regions (Fig. S3B,C). 236 Because larvae lacked spatial brightness cues in our setup, it was unclear which behavioral 237 algorithms they employ. One basic, yet potentially sufficient, algorithm would be to reduce 238 movement in darker regions. However, speed was independent of brightness (Figs. 1E and 239 S3D), suggesting that larvae employ more complex navigational strategies. 240 We conclude that Drosophila larvae are capable of performing phototaxis in the absence of 241 spatial information and that this behavior cannot be explained by a simple brightness-dependent 242 modulation of crawling speed. 243 244 Larval temporal phototaxis depends on brightness change over time 245 In spatially differentiated light landscapes, fly larvae make navigational decisions by sampling 246 brightness differences during head-casts. In our setup, by design, larvae experience no 247 brightness fluctuations during head-casts. Hence, they have to use whole-field brightness or 248 brightness history information to modulate the magnitude and/or frequency of turns. To explore 249 this possibility, we segmented trajectories into runs and turns. We applied a deep learning-250 based package, DeepPoseKit (Graving et al., 2019) to extract the larvae's head, centroid, and 251 tail positions from the experimental video ( Fig. 2A and Video S2). From there, we calculated 252 the animal's body curvature to identify head-casting events and to quantify turn angles and run-253 lengths ( Fig. 2A-C). 254 As expected, brightness changes during the spatially confined turns were negligible 255 compared to ones measured during runs (Fig. 2D). To quantify the effect of brightness on 256 heading angles and run-lengths, we checked how these parameters varied with the larva's 257 position. During the "Valley" but not the "Constant" stimulus, turns in the "Dark" region led to 258 smaller heading angle changes than in the "Bright" regions (Fig. 2E). Similarly, runs before a 259 turn in the "Dark" region of the "Valley" stimulus were slightly longer compared to runs ending in 260 the "Bright" region. However, this also partly occurred with the "Constant" stimulus, suggesting 261 that the effect might not arise from a visuomotor transformation. 262 Next, we explored whether brightness history affects behavior. As run-lengths were highly 263 variable, ranging from ~3 s to ~40 s (Fig. 2C), we focused our analysis on the brightness 264 change between consecutive turns. We classified turns by whether larvae experienced a 265 decrease or increase in whole-field brightness during the preceding run. We found that heading 266 angle changes were smaller and that run-lengths were longer when larvae had experienced a 267 brightness decrease compared to an increase (Fig. 2F). We did not observe these effects in 268 control animals. 269 To further quantify the effects of brightness and brightness change on heading angle 270 change, we performed regression analysis directly on individual events (Fig. S4). While turn 271 angles scale with brightness, they do so more strongly with brightness change. 272 These observations led us to hypothesize that larvae might integrate information about the 273 change in brightness during runs and that this integration period might span several seconds. 274 To obtain an idea about time-scales, we computed a turn event-triggered brightness average 275 (Fig. 2G). We observed that, on average, turns performed in the "Valley" stimulus are preceded 276 by an extended period of >20 seconds of brightening, suggesting that long-term brightness 277 increases drive turns. 278 In summary, our analysis of turns and runs confirms that, first, brightness levels modulate 279 heading angle change and, second, changes in brightness prior to turns modulate heading 280 angle change as well as run-length. 281

A simple algorithmic model can explain larval temporal phototaxis 283
We next wanted to test whether the identified behavioral features are sufficient to explain larval 284 temporal phototaxis. Based on our experimental findings (Fig. 2), we propose four rules as 285 navigational strategies (Fig. 3A). For rules 1 and 2, the instantaneous brightness modulates the 286 heading angle change and run-length, respectively. By contrast, for rules 3 and 4, the 287 brightness change since the last turn modulates the heading angle changes and run-lengths. 288 To test these navigational rules, we simulated larvae as particles that could either move 289 straight or make turns. To compare the performances of different models, we calculated a 290 phototaxis index (difference of time spent in the "Dark" ring between experimental and control 291 groups, Fig. 3A). For all permutations of our rules, we explored a set of multipliers for the 292 heading angle change and run-length, with a multiplier of 1 corresponding to the experimental 293 averages (Fig. 2E,F). This allowed us to assess the robustness of our model to parameter 294 choice. As expected, with no active rules, the larval distribution was comparable between the 295 "Valley" and "Constant" stimulus. Activating rules 1 or 2, performance did not improve, 296 suggesting that modulation of behavior based on instantaneous brightness is insufficient to 297 perform temporal phototaxis. Activating rules 3 or 4, phototaxis emerged for small run-lengths 298 and large turn angle multipliers. However, for multipliers set to 1, the resulting phototaxis index 299 was weaker than in experiments (= 14 %). Only when combining rules 3 and 4, phototaxis 300 performance matches the experimental values. Combining all four rules yielded minimal 301 improvements. Therefore, for further analysis, we focused on a combination of rules 3 and 4, 302 with both multipliers set to 1. 303 Like real larvae (Fig. 1C-E), simulated larvae navigating the "Valley" stimulus spent more 304 time in the "Dark" ring than larvae navigating the "Constant" stimulus ( Fig. 3B,C) without 305 modulating speed (Fig. 3D). Furthermore, distributions of turn angle changes, run-lengths, and 306 brightness changes were comparable to experimental data (compare Figs. 2C,D and 3E,F). 307 Residual differences in those distributions are likely due to additional mechanisms used by the 308 animal, such as a refractory period for turn initiation, which we did not incorporate in our model. 309 When we examined the effects of instantaneous brightness and brightness change on turn 310 angle amplitude and run-length (Fig. 3G,H), we observed similar patterns as in the experimental 311 data (Fig. 2E,F). As found in experiments (Fig. 2G), turns are preceded by long stretches of 312 increasing brightness (Fig. 3I), supporting our hypothesis that larvae integrate brightness 313 change over several seconds. Moreover, in the event-based regression analysis we found 314 results to be in agreement with experimental data as well (compare Figs. S4 and S5). Finally, to 315 verify that our model generalizes to other visual stimulus patterns, we simulated larvae exploring 316 the "Ramp" stimulus and observed phototaxis performance comparable to that of real larvae 317 (compare Figs. S3 and S6). 318 In summary, after implementing our experimentally observed navigational rules in a simple 319 computational model, we propose that the most critical element of larval temporal phototaxis is 320 the ability to integrate brightness change over extended time periods. Modulating turn angle 321 amplitude and run-length based on such measurement is sufficient to perform temporal 322 phototaxis. 323

325
Using a closed-loop behavioral assay, we show that Drosophila larvae find the darker regions of 326 a virtual brightness gradient that lacks any spatial contrast cues. Temporal phototaxis 327 behavioral algorithms have already been dissected in open-loop configurations, where stimuli 328 are decoupled from an animal's actions. Following a global brightness increase, larvae are 329 known to modify both their heading angle magnitude and their run-length (Gepner et al., 2015;330 Kane et al., 2013), which is in agreement with our findings. We were able to demonstrate that 331 these navigational strategies are in fact sufficient for phototactic navigation. Given that 332 brightness fluctuations in our assay are slow and negligibly small during head-casts, we suggest 333 that animals integrate brightness change during runs to make decisions about the strength and 334 timing of turns. Previous work has shown that larvae can navigate olfactory or thermal gradients 335 using only temporal cues (Luo et al., 2010;Schulze et al., 2015). Together with our findings, this 336 should enable future exploration of the shared computational principles and neural pathways 337 across these sensory modalities. 338 Closed-loop systems are powerful tools to dissect an animal's sensorimotor transformation. 339 They have been employed in many models including adult Drosophila (Bahl et al., 2013), larval 340 zebrafish (Bahl and Engert, 2020;Chen and Engert, 2014), and C. elegans (Kocabas et al., 341 2012;Leifer et al., 2011). Recent work in Drosophila larvae used LED-based devices to study 342 closed-loop temporal chemotaxis in virtual optogenetic environments (Tadres and Louis, 2020). 343 Such systems are cheaper and have shorter stimulus refresh times but cannot easily be used to 344 present animals with spatially differentiated landscapes. By utilizing a projector, our setup 345 overcomes this limitation. With the drawback of slightly longer delays and higher component 346 costs, the ability to present any type of visual stimulus adds important flexibility and versatility. 347 Future studies could use our paradigm to study, for example, specific behavioral differences 348 between animals navigating a true luminance gradient compared to when they navigate the 349 exact same one virtually. Moreover, our system makes it possible to explicitly investigate 350 navigational strategies exclusively using spatial information. This has already been achieved in 351 zebrafish larvae (Chen et al., 2020;Huang et al., 2013)   Rule 1: Decrease turn angle when it is dark, increase it when it is bright.
Rule 2: Increase run length when it is dark, decrease it when it is bright.
Rule 3: Decrease turn angle when it was darkening during the run, increase it when it was brightening.
Rule 4: Increase run length when it was darkening during the run, decrease it when it was brightening.