Automated analysis of internally programmed grooming behavior in Drosophila using a k-nearest neighbors classifier

Despite being pervasive, the control of programmed grooming is poorly understood. We have addressed this gap in knowledge by developing a high-throughput platform that allows long-term detection of grooming in the fruit fly Drosophila melanogaster. Automatic classification of daily behavior shows flies spend 30% of their active time grooming. We show that a large proportion of this behavior is driven by two major internal programs. One of these programs is the circadian clock that modulates rhythms in daily grooming. The second program depends on cycle and clock and regulates the amount of time flies spend grooming. This emerging dual control model of programmed grooming in which one regulator controls the timing and another controls the duration, resembles the well-established two-process regulatory model of fly sleep. Together, our quantitative approach in Drosophila has revealed that grooming is an important internally driven behavior under the control of two regulatory programs.


Introduction
-8 -labeling fly behavior from 25000 frames and mapping them onto a three-dimensional feature 143 space where the axes correspond to PM, CM and CD ( Figure 2B, color symbols). We tested 144 values of the parameter k between 1 and 50 and settled on k=10 to achieve balance between 145 computing time and accuracy (see Methods). 146 Finally, we pruned output labels from the kNN classifier ( Figure 2C). The algorithm calculates 147 features from every two consecutive frames, resulting in some classifications being confounded 148 by short-term fly activity. For example, features extracted from only two frames often cannot 149 distinguish a fly stretching its body parts from one that is grooming. Based on our observations 150 during creation of the training set, a typical grooming bout lasts >3 seconds or for 15 frames at 151 our normal frame rate, longer than an average stretching event, which lasts for ~1 second. 152 Accordingly, we applied a 15-frame-long temporal filter that slides one frame at a time to eliminate 153 false grooming labels caused by short, grooming-like behavior. Grooming designations were 154 retained only if at least 12 grooming frames are found within the window. Otherwise, all grooming 155 frames were relabeled as locomotion once the left edge of the window reaches the fifteenth frame 156 ( Figure 2C). These pruned labels were the final output of our grooming classification algorithm. 157 The accuracy of our algorithm was evaluated by comparing the computer-identified grooming with 158 manually-labeled grooming identified by visual inspection. We tested a total of 8 hours of videos, 159 including 15 individual flies (see Methods), and found that of the grooming events picked out by 160 our algorithm, 92.1% were manually verified as true grooming events ( Figure 2D, top panel). 161 Furthermore, among all manually scored grooming events, 95.5% were successfully identified by 162 our computational method ( Figure 2D, bottom panel). These test results suggest that our method 163 identifies grooming with high fidelity. 164

Grooming plays an important role in the daily life of Drosophila 165
To determine how grooming is coordinated within the 24-hr period, we examined fly behavior over the course of several days in 12 hour light: 12 hour dark (LD) conditions ( Figure 3). In LD cycles 167 (for constant darkness, see Figure  locomotion during mid-day or night decreases to < 5% of the M/E peak values, basal grooming 173 during the same duration was maintained at ~14% of the peak values ( Figure 3A, rectangles). 174 The smaller time-dependent variations in grooming resulted from 20-40 bouts per hour with the 175 longest pause between two bouts being ~83 minutes on average ( Figure 3B). In contrast, the 176 longest pause between two consecutive bouts of locomotion was ~116 minutes ( Figure 3B). 177 Because grooming bouts were on average shorter than locomotion ( Figure 3C), a typical fly under 178 LD conditions spent approximately 9% of its daily time grooming, compared to 20% of time in 179 locomotion ( Figure 3D). That is, the average fly spends ~30% of its active time grooming. The 180 frequency of grooming behavior suggests that maintenance of a low but steady rate of grooming 181 is important for the animal. 182 The reduced temporal modulations in individual grooming behavior was accompanied by similarly 183 reduced variability in grooming levels between individual flies ( Figure 3E). To compare variability 184 of grooming and locomotion across the population, we constructed normalized distributions for 185 the two behaviors by calculating daily grooming and locomotion times of individuals and dividing 186 these by the respective population means. These data revealed that, under LD conditions, the 187 standard deviations in grooming and locomotion were 0.14 and 0.34, respectively. Similarly, in 188 constant darkness, they were 0.16 and 0.25 ( Figure S2B). The relatively low individual variation 189 in grooming behavior suggests a consistent, internally programmed drive to groom. Together, the 190 considerable time spent and the low population-wide variability in grooming are consistent with -10 -an important role for this behavior in the daily routine of Drosophila melanogaster. 192 To quantitatively compare the temporal patterns of grooming and locomotion ( Figure 3F), we 193 applied a previously developed mathematical function that models fly activity in terms of 194 exponential functions (A. Lazopulo & Syed, 2016). The functions are defined by four rate 195 parameters , , and , where subscripts denote morning rise (MR), morning decay 196 (MD), evening rise (ER) and evening decay (ED), and two duration parameters that describe the 197 relative durations of morning (TM) and evening (TE) peaks ( Figure 3G). We previously proposed 198 that these parameters may reflect kinetics of biochemical substrates underlying the specific fly 199 behavior described by the model (A. Lazopulo & Syed, 2016). We fitted this model to grooming 200 and locomotion of individual wild-type flies for 3-4 days in LD conditions. Results showed that the 201 rate parameter of grooming was smaller than that of locomotion (8 out of 9 flies, Figure 3H), 202 indicating a slower increase in night-time grooming activity and consistent with a smaller change 203 in grooming between day and night ( Figure S3A). Additionally, the evening duration parameter 204 (TE) for grooming was greater than that for locomotion ( Figure 3I), indicating that the evening 205 peak in grooming lasted longer. In contrast, the other model parameters did not show significant 206 differences between locomotion and grooming ( Figure S3B-E), raising the possibility that, in 207 addition to their differences, the two behaviors may also share some common underlying 208 regulatory substrates. 209

Temporal pattern of grooming is under control of the circadian clock 210
The circadian clock modulates a wide range of fly behaviors (Allada & Chung, 2010), including 211 locomotor activity. To test whether basal grooming is also under circadian control, we monitored 212 grooming in wild-type (WT) and circadian mutants per S , per L , and per 0 for 4 days in LD followed 213 by 4 days in constant darkness (DD, Figure 4A). Mutations of the endogenous circadian clock 214 cause altered circadian period length or arrhythmia in the absence of light stimulation (DD). per S and per L mutants have short and long circadian periods, respectively while per 0 mutants are 216 arrhythmic. Population-averaged LD data showed that light was a strong zeitgeber of grooming 217 even for circadian mutants, while the DD data revealed that grooming is circadian-regulated, as 218 circadian mutants exhibited grooming behavior with the expected changes in periodicity ( Figure  219 4A, top three panels) or arrhythmia ( Figure 4A, bottom panel). Autocorrelation analysis of wild-220 type LD data over a few hours showed weaker correlation in grooming compared to locomotor 221 activity ( Figure 4B), while spectral analyses showed oscillation periods in constant darkness to 222 be 23.73 ± 1.10 hours, 18.70 ± 0.71 hours, and 28.48 ± 1.13 hours for WT, per S , and per L flies, 223 respectively ( Figure 4C). In per 0 flies, grooming activity does not show any significant periodicities 224 in spectral analysis (data not shown). These long time-scale oscillatory periods are in agreement 225 with those of locomotor rhythms ( Figure S2C, D). The observed shifts in the period of grooming 226 rhythms, consistent with well-characterized molecular perturbations of the clock, suggest that the 227 circadian clock temporally modulates grooming in Drosophila. Interestingly, per S , per L , and per 0 228 mutations cause major changes in temporal grooming rhythms while causing no significant 229 change in the total level of grooming ( Figure 4D). This result is consistent with at least two sets 230 of regulatory mechanisms for basal or internally-programmed grooming: circadian regulation to 231 regulate the timing of grooming, and an internal drive to regulate the amount of grooming. 232 Because Drosophila feeding activity is also regulated by the circadian clock (Chatterjee, Tanoue, suggests that periodic contact with food is unlikely to be the external stimulus that drives rhythms 242 in basal grooming. Locomotor rhythms are also unlikely to be the primary driver of grooming 243 rhythms since the onset of evening peak in grooming was ~ 2 hours earlier than the evening peak 244 in locomotion ( Figure 4E, top panel, red boxes and inset). This is consistent with the comparison 245 in Figure 3I, which shows that the grooming evening peak lasts longer than the locomotion 246 evening peak. These temporal offsets in grooming, feeding and locomotion were typically reduced 247 in constant darkness ( Figure 4F) and nearly absent in per 0 mutants ( Figure 4E, bottom panel; 248 Figure 4F), suggesting that they result from a combined effect of the external zeitgeber and the 249 internal pacemaker. Together, these results suggest that the circadian clock directly influences 250 temporal patterns in grooming, thus identifying endogenous timekeeping as a likely internal 251 program that influences the Drosophila grooming circuitry. 252

Grooming duration is controlled by cycle and clock 253
The circadian clock appears to affect mainly the temporal pattern of grooming without altering the 254 total time flies spend in the behavior ( Figure 4D). Based on grooming data from other animals 255 implicating the behavior in stress relief (Chen et al., 2010;Hart, 1988;Gabriele Schino et al., 256 1988), we hypothesized that flies with altered stress response may also exhibit altered levels of 257 daily grooming when exposed to a common external stimulus. conditions, we measured the behavior in cyc 01 (Rutila et al., 1998) and clk Jrk (Allada, White, So, Hall, & Rosbash, 1998) mutants. The data showed increased daily average grooming in both 266 mutants relative to genetic controls ( Figure 5A, B). The shared increase in grooming duration in 267 these flies is accompanied, however, by opposing changes in their locomotion. Relative to their 268 controls, cyc 01 flies spent less time, while clk Jrk flies spent almost twice as much time in locomotion 269 ( Figure S4A, B). These results reveal a differential reprioritization of behavioral outputs by the two were allowed to acclimate to standard food and LD cycle for one day, after which grooming was 277 recorded for the next three days with the second day either in normal food or 1% agarose. 278 Consistent with the hypothesis that grooming behavior is circadian-regulated, we found that 279 starvation disrupted circadian oscillations in grooming behavior, as well as locomotor activity, in 280 wild-type flies ( Figure S4C, D). Moreover, the starvation-induced disruption of circadian 281 regulation is thought to result from the reprioritization of behavior: flies upregulate locomotor 282 activity and downregulate sleep to engage in starvation-induced foraging behavior that overrides 283 and is independent of circadian regulation (Keene et al., 2010). Consistent with this, all mutants 284 and controls exhibited increased locomotor activity under starvation conditions ( Figure S4C). 285 To test whether this reprioritization of behavior extended to grooming, we examined total levels 286 of grooming under starvation conditions, as measured by total time spent grooming. We expected 287 that grooming behavior would either be deprioritized relative to locomotor activity and down-288 regulated, similar to sleep, or increased relative to normal nutrient conditions, similar to locomotor found that starvation induced no significant change in time spent grooming in both per 0 mutants 291 and control animals. This result supports the hypothesis that the daily time spent grooming is 292 regulated by an internal program independent of circadian regulation and suggests that this 293 internal program is resistant to starvation-induced stress. 294 This reprioritization of behavior is even more dramatic in two other circadian mutants cyc 01 and 295 clk Jrk , both lacking a functional clock. Relative to controls or per 0 mutants, both cyc 01 and clk Jrk 296 were previously shown to dramatically downregulate total sleep amount under starvation 297 conditions, presumably by upregulating locomotor activity because of increased metabolic stress 298 (Keene et al., 2010). Consistent with this, we found that cyc 01 and clk Jrk exhibited increased 299 locomotor activity under starvation conditions ( Figure S4C). We then tested whether this increase 300 in metabolic stress was sufficient to deprioritize grooming behavior under starvation conditions. 301 In support of this hypothesis, clk Jrk mutants under starvation conditions exhibited a modest 302 decrease in time spent grooming relative to normal nutrient conditions ( Figure 5C). Unexpectedly, 303 however, cyc 01 exhibited the opposite response: a significant and robust increase in time spent 304 grooming under starvation conditions. This increase in cyc 01 grooming mainly occurs during the 305 first ~10 hours of their introduction to the agarose-diet ( Figure 5D-F). There is at least another 306 previously reported case in which cyc 01 mutants have a distinct phenotype relative to other 307 circadian mutants: a disproportionately strong rebound in sleep after sleep deprivation, thought 308 to result from defects in heat-shock stress response (Shaw et al., 2002). This suggests that the 309 immediate, excessive grooming in response to starvation as exhibited by cyc 01 may also be due 310 to defects in heat-shock stress response in the mutant. Taken together, our data show that while 311 the internal drive to groom is not normally impacted by metabolic stress, the loss of the two partners outside of those they bind as a heterodimer (Hendricks et al., 2003), one consequence 316 of which may be aberrant expression of heat-shock genes in cyc 01 but not clk Jrk flies (Shaw et al., 317 2002). 318 To determine to what extent observed changes in grooming and locomotion affected the other 319 behavioral classes, we next broadened our analysis to include rest, feeding, and sleep. Feeding 320 was calculated in terms of extended period spent near food (as defined for Figure 4E) and sleep 321 was determined in terms of prolonged rest, ≥ 5 min episodes of no grooming or locomotion (Shaw 322 et al., 2002). The analysis revealed a general trend across all tested strains: lack of nutrients 323 diminished time spent feeding and sleeping but increased time dedicated to short rests and 324 locomotor activity ( Figure 5G and Figure S5). Increase in rest time is surprising since re-allocation 325 of time away from sleep (prolonged rest) time would predict a similar reduction in short rests. That 326 flies instead spend more time resting during starvation implicates a sophisticated energy-balance 327 mechanism that couples increase in locomotor activity, needed for foraging, with increase in short 328 rests, presumably needed to improve efficiency in foraging expeditions. 329 Despite substantial reduction in sleep under starvation conditions, grooming levels were held 330 approximately constant in all control and per 0 flies ( Figure S5). This result shows that grooming 331 behavior is prioritized above sleep during starvation, as time spent grooming could otherwise be 332 spent sleeping or foraging. Stability in time spent grooming in the absence of food further supports 333 the contention that much of the grooming detected in our experiments is not stimulated externally 334 by food contact but rather controlled by internal programs. As noted above, lesions in cyc and clk 335 affected this stability and resulted in elevated grooming ( Figure 5A, B). Through the ethograms 336 we found that in case of cyc 01 , the increase in grooming came from loss of locomotor activity while 337 in case of clk Jrk the increase came from loss of sleep ( Figure 5G). This result supports the 338 hypothesis, now with more detail, that the cyc 01 and clk Jrk mutations alter the insect's internal when placed under metabolic stress ( Figure 5C, G). 341 Accumulated data from our experiments suggest that grooming is an innate fly behavior controlled 342 by two major regulators. One of these regulators controls temporal patterns in grooming and 343 another controls amount of time spent in grooming. Circadian genes per, cyc and clk are involved 344 in controlling the timing of peaks/troughs in grooming rhythms while cyc and clk are also involved 345 in setting how much time is spent grooming. The apparent absence of per from the second 346 regulatory mechanism is consistent with the idea that the two control mechanisms are able to 347 operate independently.  .avi format with 1280 x 960 resolution at 10 Hz and down-sampled as needed. 375

Analytic hardware and runtime 376
Using a desktop computer with Intel Core i7-4770 3.4 GHz processer and 4 × 4 G DDR3 1600 377 MHz RAM, it takes ~7 hours to extract grooming, locomotion and rest data from an 8-hour video 378 of 20 flies recorded in 10 Hz (in total 288000 frames) at 1280 pixel × 960 pixel resolution. Videos 379 are analyzed every 2 frames (5 Hz), which is sufficient to capture grooming events. 380

Starvation media 381
Media for starvation experiments was made by dissolving 1% agarose in water. 382

Algorithm for automatic detection of grooming 383
All computational analyses were done with custom-written Matlab scripts that will be available at 384 http://syedlabmiami.weebly.com/software.html 385

Fly shape extraction 386
Fly shape was extracted by applying a background subtraction algorithm as described below. 387 Creating Background. The background or reference frame is constructed by randomly picking two 388 frames, a template and a contrast, and comparing their pixel grayscale values and erasing all 389 moving objects from the template frame. To remove the fly from the template frame, we replace 390 the pixels belonging to the fly with corresponding pixels from the contrast frame, relying on the 391 fact that a fly is always darker than the surrounding objects. The template frame with no fly present 392 then becomes the background frame. Additionally, because a fly's surroundings, including food 393 debris, change substantially during the course of an experiment ( Figure S1B), the background 394 frame is regenerated every 1000 seconds. Lastly, if a fly occupies the same area in the template 395 and contrast frames, the overlapping region cannot be erased on the template. To circumvent this 396 problem, every time a background frame is generated, we randomly choose 7, instead of 1, -19 -frames as contrast frames and compare all of them with the template. When a fly does not move 398 for more than 1000 seconds, the fly will not be removed from the background and cannot be 399 detected in other frames during this 1000 seconds. Thus when a fly is not detected, we consider 400 the fly to be stationary at the position where it was last detected. 401 To reduce effects of charge coupled device (CCD) image noise and fluctuations in the system, 402 we set a minimum change 0 as the threshold to accept grayscale changes from fly movements.

408
While increasing threshold 0 reduces noise, it can also lead to rejection of real movements of 409 the fly. To optimize 0 , we tested noise levels in our images by analyzing a three-hour video with 410 dead flies. In the test, 30 pairs of consecutive frames were randomly chosen from the video and 411 the differences between their corresponding grayscale pixel values were calculated. The 412 distribution of the differences, stemming from noise, is shown in Figure S1C. Based on this 413 distribution, we set 0 =10, which excludes 99.99% noise-related changes of grayscale values. 414 Extracting fly shape. To extract the shape of flies in a frame, the frame is compared with the 415 background. If a given pixel is darker on this frame than on the background frame, with the 416 difference of grayscale being greater than threshold 0 , then this pixel is temporarily assigned to 417 the fly. That is, for pixel at location (x, y) if -20 -then this pixel in the current frame belongs to a fly. Despite the use of 0 , some artifacts still 420 remain in the extracted image in the form of small objects that do not belong to the fly. We 421 eliminate these artefacts by erasing all closed objects with areas less than 1 = 20 pixels ( Figure  422 S1D), retaining only the fly silhouette ( Figure S1E). 423

Feature extraction 424
We use normalized periphery movement (PM), core movement (CM) and centroid displacement 425  To evaluate accuracy of the classifier, we first picked a total of 15 flies from three 8 hour videos, 473 and manually verified the accuracy of grooming events identified by our algorithm. From these 474 videos, we randomly selected ~30 minutes video of each fly (~450 minutes in total) and manually 475 scored all grooming events in these selected videos to identify grooming events missed by our 476 algorithm. 477

Description of locomotion and rest behavioral classes 478
Since the goal of this study was a general exploration of grooming rather than a detailed 479 classification of all fly behaviors, behaviors with body centroid movement are approximated as 480 locomotion. For instance, feeding as measured by the amount of time spent in contact with food 481 was classified as locomotion. Because the fly does not frequently move its body during feeding, 482 feeding only accounts for ~1-3% in locomotion. As a result, this approximation does not 483 significantly impact our estimation of locomotion and contributes to a considerable speed-up of 484

analysis. 485
Exceptions: In Figures 4E and 5G, we explore temporal correlation between grooming and contact 486 with food. In these figure panels only, we treated food contact separately and not as a form of -23 -for feeding behavior. 489 Except for Figures 5G and S5, rest is defined as a lack of grooming or locomotion behavior. In 490 Figure 5G and S5, sleep is isolated from rest and described as prolonged (> 5 minutes) rest bouts. 491 Rest other than sleep are denoted as short rest. to time-series that were binned into 3-minute periods. 500 501

Statistics 502
No sample size estimation was performed when the study was being designed. Unless otherwise 503 specified, quantitative experiments with statistical analysis have been repeated at least three 504 times independent. Exclusion of data applies to flies which are physically damaged (for example, 505 broken wings or legs), physically confined (for example, trapped by condensation inside tubes), 506 or dead during experiments. For testing statistical significance of differences between groups, we 507 first tested the normality of data by one-sample Kolmogorov-Smirnov test. Two-sample F-test is 508 applied for equal variances test. Samples with equal variances are compared with two-sample t-509 test. Satterthwaite's approximation for the effective degrees of freedom is applied for samples 510 with unequal variances. Results were expressed as mean ± s.d., unless otherwise specified.

513
Grooming continues to be one of the least understood Drosophila behaviors, possibly due to the 514 technical challenges of detecting grooming events in this small insect. Early work describing fly 515 grooming relied on manual scoring (Connolly, 1968;Szebenyi, 1969;Tinbergen, 1965), which 516 imposes significant limitations on the length of events that can be detected, fidelity and objectivity 517 of detection, and the level of detail that can be extracted from the data. Despite such limitations, 518 these initial studies made a number of noteworthy observations. Szebenyi delineated all the major 519 modes of fly grooming and suggested that repetitive grooming actions may closely follow a preset 520 sequence (Szebenyi, 1969). A subsequent study in the blowfly offered a more refined mechanistic 521 picture of insect grooming by proposing that the sequential actions form a hierarchical structure 522 (Richard & Dawkins, 1976). Combining modern computational and genetic tools, an elegant study 523 in Drosophila recently confirmed these previous hypotheses (Seeds et al., 2014). That fruit flies 524 may groom spontaneously in the absence of any apparent stimulus has also been previously 525 suggested (Connolly, 1968; Tinbergen, 1965). Consistent with this, our work provides evidence 526 that fruit flies groom as part of their daily repertoire of internally programmed behaviors and often 527 without any obvious external stimulus. Our analysis revealed that, while grooming over a period 528 of minutes appears to be spontaneous and unstructured, over a period of hours this behavior is 529 temporally structured by the fly circadian clock, with peaks in grooming activity around dawn and 530 dusk. The study also identifies transcription factors CLOCK and CYCLE as critical molecular 531 components that control the amplitude of programmed Drosophila grooming. 532 Machine-learning is increasingly gaining popularity due to its applicability to virtually any problem These properties make our platform amenable to addressing questions of biological relevance, 564 such as the importance of grooming behavior, its temporal regulation, dependence on the 565 circadian timekeeping system, and relationship to stress. First, we found that flies consistently 566 devote a significant fraction of time to grooming behavior during periods of locomotor activity 567 (30%), and surprisingly, that grooming behavior is observed even during periods of reduced 568 locomotor activity ( Figure 3A). This suggests that the benefits of grooming outweigh the caloric 569 resources expended and the resulting interruption of rest. Second, we show that daily grooming 570 behavior, as measured by length of time spent grooming, varies less between individual flies than 571 does locomotor activity ( Figure 3E). Both of these findings underscore the hypothesis that daily 572 grooming is a fundamental behavior of Drosophila. Data from this study suggest that a significant portion of daily fly grooming is driven by internal 580 programs. Flies in our experiments are active for ~34% of the time within a 24-hour period, during 581 which they mostly engage in grooming, locomotion and feeding. Behavioral analysis shows that, 582 like locomotion and feeding, grooming behavior is modulated by oscillations of the circadian clock 583 (Figure 4). This finding raised the possibility that the observed grooming was stimulated by 584 rhythms in contact with food or locomotor activity. However, closer examination revealed that 585 peak in feeding activity is separated by several hours from peaks in grooming (Figure 4) and, in 586 most cases (control and per 0 flies) amount of grooming remained relatively unchanged even when flies did not have access to food ( Figure 5). Similarly, grooming and locomotor peaks are 588 temporally well separated (Figure 4) and detailed examination also revealed differences in kinetic 589 parameters underlying bout lengths and temporal patterns of grooming and locomotion (Figure  590 3). Additionally, genetic modifications and altered nutrient conditions resulted in contrasting 591 changes in grooming, locomotion, and feeding ( Figure 5, Figure S4). Finally, comparison of 592 grooming in light vs. dark revealed no major differences in the fraction of daily time flies spent 593 grooming ( Figure 4D). These results together suggest that the majority of grooming events 594 detected in our experiments are not triggered by external stimuli such as light, food, and locomotor 595 movements. Rather, internal regulatory mechanisms, independent of external stimuli, likely drive 596 this programmed behavior. 597 Multi-day recordings of wild-type flies in constant darkness showed 24-hour rhythms in daily 598 grooming patterns. Furthermore, these rhythms were shifted appropriately in the canonical clock 599 mutants per L and per S and abolished in the arrhythmic per 0 flies (Figure 4). These data support a 600 regulatory model in which timing of programmed grooming behavior is orchestrated by the 601 circadian clock. Notably, since these genetic perturbations did not significantly affect the amount 602 of grooming ( Figure 4D), our results suggest that the primary role of the clock is to organize the 603 behavior in time without influencing the total time flies dedicate to grooming. 604 Intriguingly, two other circadian mutations, cyc 01 and clk Jrk , increased the proportion of daily time 605 flies spend grooming ( Figure 5A, B). cyc 01 flies also showed increased grooming under conditions 606 of nutrient shortage, while clk Jrk flies showed decreased grooming under the same conditions. 607 Importantly, neither change in grooming was observed in wild-type or per 0 flies ( Figure 5C), 608 implying that the changes in grooming level are not due to circadian defects. Instead, the data 609 imply that clock-independent but cyc-and clk-dependent pathways regulate the amount of 610 programmed grooming behavior under normal conditions, in response to starvation, and 611 potentially in response to other changes in the insect's internal homeostasis.
Since both locomotion and short rest increase under starvation conditions ( Figure 5G, Figure S5), 613 it is plausible that in such situations, obtaining food is more important for survival than grooming 614 and sleep. It may benefit the animal to have a mechanism that adjusts behavioral output to divert 615 energy towards foraging, with cyc and clk or their products playing important roles in this 616 regulation. This would be consistent with our observations of WT strains in starvation conditions, 617 wherein the amount of programmed grooming remains constant despite dramatic changes in 618 locomotion and sleep. It would also be consistent with our observations of cyc 01 and clk Jrk flies, 619 which show altered grooming when nutrients are unavailable, presumably due to defective 620 regulation of behavioral output. Differences in starvation-induced changes between cyc 01 and 621 clk Jrk flies suggest an additional mechanistic detail regarding the cyc-and clk-mediated pathways. 622 When subjected to sleep deprivation, cyc 01 but not clk Jrk flies, dramatically lower expression of 623 heat-shock genes, and show excessive homeostatic rebound (Shaw et al., 2002). In the present 624 context, these prior data raise the possibility that heat-shock genes might also be part of the cyc 01 625 and clk Jrk dependent grooming response pathways that are activated by starvation. and suggest that this innate behavior is driven by two distinct sets of regulatory systems. The 639 circadian system temporally segregates undulations in grooming from those of other essential 640 behavioral outputs like feeding and sleep. Circadian coordination of grooming underscores a 641 previously under-appreciated importance of this behavior in the daily routine of the fruit fly. The 642 second regulatory system adjusts the level of grooming relative to other behaviors. This set of 643 regulation likely confers adaptability on the animal by allowing it to up-or downregulate grooming 644 as necessitated by internal and external conditions. The dual control mechanism of grooming 645 proposed here is highly reminiscent of the two-process framework---circadian and homeostatic-646 --that is widely used in understanding sleep regulation (Borbély, 1982). Although this work has 647 not demonstrated grooming is under homeostatic control, future studies could be aimed at better 648 characterizing the nature of the non-circadian regulatory system of fly grooming. 649 In summary, we present here a new platform to detect innate grooming behavior simultaneously 650 and for days at a time in multiple individual fruit flies. The apparatus can be assembled easily, 651 and the accompanying analytics is available publicly. Utilizing this platform, we report several 652 mechanisms that are potentially responsible for driving the timing and level of programmed 653 grooming in Drosophila. We also suggest future experiments that through use of this platform can 654 lead to deeper understanding of the underlying biology of grooming and its relation to other 655 essential fly behaviors.