Summary
Sleep is an evolutionarily conserved behavior, whose function is unknown. Here, we present a method for deep phenotyping of sleep in Drosophila, consisting of a high-resolution video imaging system, coupled with closed-loop laser perturbation to measure arousal threshold. To quantify sleep-associated microbehaviors, we trained a deep-learning network to annotate body parts in freely moving flies and developed a semi-supervised computational pipeline to classify behaviors. Quiescent flies exhibit a rich repertoire of microbehaviors, including proboscis pumping (PP) and haltere switches, which vary dynamically across the night. Using this system, we characterized the effects of optogenetically activating two putative sleep circuits. These data reveal that activating dFB neurons produces micromovements, inconsistent with sleep, while activating R5 neurons triggers PP followed by behavioral quiescence. Our findings suggest that sleep in Drosophila is polyphasic with different stages and set the stage for a rigorous analysis of sleep and other behaviors in this species.
Introduction
Sleep is an essential behavior, conserved throughout the animal kingdom1–3. Although animals spend a substantial portion of their lives asleep, the function of this behavioral state remains enigmatic4–10. Sleep has been extensively studied in mammals, which share brain structures more closely related to humans and where electroencephalography (EEG) can be used to precisely characterize and quantify sleep11. However, our understanding of the function(s) of sleep would be greatly aided by deep analyses of sleep in simpler non-mammalian organisms; such studies could reveal aspects of sleep that are conserved across evolutionarily distant species and thus likely important for its function.
Indeed, sleep has been reported to occur in widely divergent animal species, ranging from jellyfish, worms, insects, octopuses, and fish12–16. How is sleep identified in these different species, given their profound differences in brain structure and activity? Sleep can be defined by behavioral criteria, as consolidated, reversible quiescence that a) preferentially occurs during a specific time of day, b) is associated with an elevated arousal threshold, and c) is under homeostatic control13,17,18. From these many non-mammalian species, the most commonly utilized model organism to study sleep is Drosophila melanogaster (with > 1,100 citations in Pubmed to date) 17,18. The fruit fly system combines a powerful genetic toolkit with a compact nervous system and a recently defined connectome19,20, making it an attractive system to investigate the function and regulation of sleep. However, over the past two decades, the vast majority of Drosophila sleep studies have utilized a simple operational definition, which claims that sleep is defined by a 5 min period of behavioral quescience, associated with an increase in arousal threshold17. The ease and simplicity of this approach has enabled large-scale genetic and circuit screens21–24. However, the uniform application of this 5 min definition has likely led to sleep in Drosophila not being robustly characterized, limiting the potential of the fly model to understand the nature and function of sleep.
Inspired by classical observational studies of sleep in bees and cockroaches13,25,26, we developed a high-resolution video method to quantify and characterize sleep in freely moving flies. Our algorithm leverages the recently developed deep-learning based pose estimation tool Deeplabcut to first estimate pose and use these data to extract meaningful behaviors associated with sleep. While video-based machine-learning algorithms are increasingly being used in neuroscience research to quantify animal behaviors27–30, the study of sleep using this approach poses a particularly difficult problem; sleep is a quiescent behavior and so annotation and classification has to be performed on “micromovements” (small subtle behaviors occurring during sleep). Moreover, unlike many “active” behaviors (e.g., locomotion, grooming, courtship, feeding, aggression) that are more discrete, sleep behaviors occur over a long timescale. To address these computational challenges, we developed a novel semi-supervised computational pipeline to characterize stereotyped behaviors that correlated with sleep. Here, using these combined approaches, we performed deep phenotyping of fly sleep behavior. Our findings reveal a rich repertoire of microbehaviors occurring during fly sleep and suggest that sleep in this species is polyphasic, consisting of different stages. Moreover, to demonstrate the utility of our system, we analyze the effects of activating two commonly studied sleep-promoting circuits in Drosophila, which reveal markedly different behavioral responses. This work should enable a more rigorous characterization of sleep, as well as other behaviors, in Drosophila.
Results
High-resolution video imaging and annotation of quiescent microbehaviors in freely moving Drosophila
Most studies in Drosophila have relied on the definition of sleep as behavioral inactivity lasting >5 min17, when flies are monitored in thin locomotor activity tubes, previously developed for fly circadian research. To minimize potential stress associated with confined spaces or tethered preparations and to facilitate observation of natural sleep behavior, it would be optimal to assess sleep in freely moving flies. In addition, a side-view imaging approach would be preferred, because prior work in cockroaches and bees revealed that sleep in these insects was associated with specific changes in posture and body part position (e.g., drooping antennae) best viewed from the side13,25. Thus, we developed a high-resolution imaging setup (Figure 1A) using a chamber where the fly is able to turn and walk freely and is imaged from the side-view (see Methods). In this setup, the fly image is at least ∼40x larger compared to images from previously described fly sleep video analyses (corresponding to ∼8 µm/pixel)31; this increased resolution enables the observation and annotation of relatively small body parts.
(A) Schematic of the behavioral setup in which a fly is placed in a 7.1 (W) x 4.9 (H) x 2.8 mm (D) 3D-printed chamber with access to a liquid food capillary and imaged at high-resolution (∼8 μm / pixel).
(B) Schematic of a fly displaying the target points tracked using DeepLabCut32 (left). 21 distinct points (35 in total when including symmetric body parts) are shown.
(C) An example image showing a fly in the behavioral chamber with tracked body parts (right).
(D) Average activity data per 1 min bin for male (n=23, green) and female (n=19, orange) flies from ZT10 to ZT2. Activity is based on the sum of the change in each frame for computed features derived from tracked body parts (see Methods).
(E) Schematic illustrating microbehaviors seen during sleep.
(F) Representative images showing the progressive lowering of the thorax position during prolonged quiescence. Dashed line connects the same pixel point across the two images.
(G) Representative images showing downward movement of the antenna during prolonged quiescence (blue arrow). Light green arrow shows an accompanying change in haltere position.
(H) Proboscis pumping (PP) behavior is shown in 4 consecutive images with 1.3 seconds between each image (above). Red dashed line connects two points tracked by DeepLabCut: the tip of the proboscis and the right dorsal edge of the eye. Bottom left: plot showing distance between the two tracked points across time; numbers/asterisks labeled on the plot correspond to the images shown. Bottom right: multiple examples of PP bouts are shown across the night. Plots show the distance between the two tracked points.
(I) Representative images showing movement of haltere in the ventral direction during prolonged quiescence. Vertical dashed line connects the tracked points on the thorax and haltere, and horizontal dashed line indicate the same pixel points across the four images. Bottom left: plot showing distance between the 2 tracked points across time; numbers/asterisks labeled on the plot correspond to the images shown. Bottom right: multiple examples of HS behavior, shown as plots of the distance between thorax and haltere points across time. Time relative to the first image (t) is shown for (F-I).
(J and K) Representative quiescence bouts exhibiting distinct behaviors with varying spatiotemporal structure. Static images of quiescence, feeding, PP, and HS (J) and grooming, quiescence, postural relaxation, and HS (K) are shown, with horizontal dashed lines connecting the same pixel points across images. Yellow, magenta, and red lines indicate the distance between thorax and haltere, origin (fixed point at 0, 0) and thorax, and origin and proboscis tip, respectively. Expanded traces for PP (J) and HS (K) are also shown to highlight spatiotemporal structure. In (K), yellow arrows point to halteres, magenta arrows point to antenna, and red circles indicate thorax.
We next trained the machine-learning based pose estimation software DeepLabCut32 to reliably label 35 points on the body of the fly corresponding to 21 distinct points (Figures 1B and 1C, see Methods). Then, we generated features from these individual body parts (e.g., distance of proboscis tip to head), which allowed us to quantify and plot how different body parts moved relative to each other over time. We performed video recordings of individual flies in this high-resolution setup from ZT10-ZT2 (Zeitgeber Time 10-Zeitgeber Time 2) and first examined total locomotor activity as assessed by movement of all body parts in 1 min bins. As expected, prominent peaks of locomotor activity are observed at ZT12 and ZT0, corresponding to evening and morning peaks of activity. Prominent behavioral inactivity was observed in the early night, with gradually increasing activity in the late night, which was particularly pronounced in males (Figure 1D).
Four distinct microbehaviors were observed during prolonged inactivity (Figures 1E-1I). After becoming stationary, a fly’s body posture (measured by thorax position) would sometimes gradually relax in a gravity-dependent manner (Figure 1F and 1K). Following this postural relaxation, the antennae of flies could be seen to droop, particularly arista, (although the antennae of fruit flies are small, making it difficult to consistently visualize them) (Figure 1G). After postural relaxation, and often in synchrony with the antennae drooping, a “switch-like” movement of the halteres (vestibular-like mechanosensory organs that are sensitive to inertial forces experienced during flight33,34) can be seen (Figures 1I-1K). This quiescence-associated haltere switch (HS) behavior involved a downward (i.e., towards the ventral aspect of the fly) movement that persisted for ∼2-20 mins (Supplemental Video 1).
A recent study using a tethered preparation described rhythmic proboscis extension (PE) occurring during sleep in Drosophila, which was associated with increased clearance of hemolymph35. We also observed these rhythmic PEs (which we here call “proboscis pumping” (PP) to clearly distinguish them from the Proboscis Extension Reflex36) during inactive periods in our freely moving flies (Supplemental Video 2). These PP episodes exhibit a stereotypical spatiotemporal structure (∼0.3 Hz with consistent amplitude), but with variable duration (Figure 1H). In addition, while PP occurs after postural relaxation, they can occur either before or after HS/antennal droop behaviors (Figures 1J and S1A). Finally, previous studies have noted that fruit flies tend to sleep near their food source37. We examined the location of flies in our assay during inactive bouts lasting <1 min, between 1-5 mins, and >5 mins. Our data show that bouts of inactivity lasting <1 min are randomly dispersed throughout the chamber. In contrast, flies that were immobile for periods >1 min tended to stay near the food (Figure S1B), suggesting that flies sleep in bouts closer to 1 min.
Closed-loop arousal threshold analyses of Drosophila sleep behavior
To demonstrate that the periods of prolonged inactivity observed in our imaging setup represent sleep, we next probed arousal threshold levels. To assess arousal threshold in a precise and gentle, but effective manner, we used an IR laser whose wavelength is not detected by fly photoreceptors38 to incrementally heat the fly in a closed-loop system. We modified our high-resolution video imaging setup to include a 1064 nm laser facing the fly chamber. Fly video images were analyzed by custom software that estimated motion by using background subtraction to identify behaviors as “inactive” (no active locomotion) or “moving/arousal.” When 30s of “inactive” behavior was detected, the laser was activated, and its power ramped up gradually until the fly exhibited >3s of “moving/arousal” behavior (Figure 2A and Figure S2A). Trials were performed from ZT10 to ZT24, with each trial separated by >30 mins (Figure 2B). Because the absolute level of laser power required to arouse inactive flies varied substantially between individual animals, we standardized arousal threshold for each individual fly and generated a Z-score, in order to compare arousal threshold levels between animals. To characterize microbehaviors (e.g., PP, HS) in this dataset, we performed manual annotation of each trial, starting from 1 sec continuous activity prior to the point of “laser-on.”
(A) Schematic of the closed-loop setup to test arousal threshold where a fly in chamber is placed between an IR laser and a camera. The laser is turned on after 30 sec of quiescence, and laser voltage is gradually increased over the subsequent 30 sec (Figures S2A). Once the fly exhibits 3 seconds of persistent movement, the laser is turned off.
(B) Representative static images of changes in sleep-associated microbehaviors as laser voltage is increased. Schematic showing increase in laser voltage from 0 to 5 volts over the course of 30 sec (top). Antennal position change (top and middle panels) and halter switch (lower panels) are shown with t= representing time after “laser on.” Antennae (top and middle panels) and halteres (lower panels) are highlighted by dashed lines.
(C) Representative plots of standardized arousal thresholds (volt-sec) for individual female flies from four different experiments.
(D) Correlation between standardized arousal thresholds (volt-sec) for individual perturbation bouts vs inactivity bout duration for female flies (n=12). Linear regression shows positive correlation between arousal threshold and increased quiescence bout duration. Thick line denotes best-fit line, and shading denotes SEM.
(E) Standardized arousal thresholds for individual perturbation bouts plotted in 60 min bins across ZT10-ZT23, showing dynamic changes of arousal threshold across time for female flies (n=18). Error represents SEM.
(F) Correlation between standardized arousal thresholds (volt-sec) for individual perturbation bouts vs ZT time for female flies shown in (D). Linear regression shows negative correlation between arousal threshold and ZT time. Thick line denotes best-fit line, and shading denotes SEM.
(G) Standardized arousal threshold plotted for female flies during ZT10-17 or ZT17-24 windows for quiet wakefulness (movement, feeding, grooming, defecation occurring 30-60 sec prior to “laser on”) (n=9 and 7 bouts), 30-60s quiescence prior to “laser on” (n=57 and 41 bouts), or >1 min quiescence prior to “laser on” (n=49 and 83). Data were collected from the flies in (D). Error denotes SEM; one-way ANOVA with post-hoc Tukey.
(H) Standardized arousal threshold for female flies identified as sleeping (>30 sec quiescence starting from 30 sec before “laser on”) from ZT10-17 in the absence (n=22) or presence (n=9) of HS behavior. Error denotes SEM, unpaired t-test. *, P < 0.05; **, P < 0.01; ***, P < 0.001; ns, not significant.
After the laser turned on and ramped up in intensity, we observed that reversal of specific microbehaviors could occur. For example, prior to the fly engaging in active locomotion, one can detect an upward movement of the antennae or halteres (Figure 2C). These data suggest that mildly increasing arousal can trigger reversal of these sleep-associated microbehaviors and hint that sleep associated with these microbehaviors might reflect a deeper sleep stage.
We first examined whether arousal thresholds correlated with how long the fly was inactive prior to the laser stimulation (Figure 2D). We found a significant positive correlation between standardized arousal threshold and inactivity bout duration. Next, we asked whether arousal threshold levels varied across the night. Standardized arousal thresholds exhibited a significant negative correlation with ZT time (Figure 2E). We then plotted arousal thresholds in 1 hr bins and found that arousal threshold during >30s inactive episodes was reduced at ZT12 and then peaked shortly thereafter at ZT14 (Figure 2F). Following this peak, there was a gradual reduction in arousal threshold during the night, reaching a nadir around ZT22 (Figure 2F). These data are consistent with multiple factors influencing arousal threshold: the light/dark transition (promoting arousal at ZT12), homeostatic sleep drive (gradually decreasing across the night), and the circadian clock (encouraging activity during the morning and evening peaks).
Prior work in Drosophila has largely used a static “>5 min inactivity” definition for sleep17,39. However, there have been suggestions that shorter time windows of inactivity (e.g., 1 min) may be associated with sleep in fruit flies40,41. Given our dynamic changes in arousal threshold throughout the night, we asked whether the duration of locomotor inactivity associated with sleep also varied during the evening/early night (ZT10-17) vs the late night (ZT17-ZT24). We first labeled inactive bouts as “quiet wakefulness” if the fly exhibited locomotion during the 30 sec-60 sec window prior to “laser on” (recall that 30s of behavioral inactivity was a prerequisite for the laser to be turned on). The arousal threshold for “quiet wakefulness” was low and similar between the early vs late night (Figure 2G). We then assessed the duration of behavioral “quiescence” by assessing if the fly exhibited grooming, feeding, or defecation; a “quiescent” bout meant that the fly did not engage in those behaviors or locomotion during the time window. Interestingly, we found that flies that were quiescent for 30-60s prior to “laser on” exhibited a marked increase in arousal threshold during the late evening/early night (ZT10-ZT17), but not the late night (ZT17-ZT24), compared to flies during quiet wakefulness. In contrast, quiescence bouts lasting >1 min were associated with an elevated arousal threshold, regardless of when the bout occurred. Similar findings were obtained, if we used 2 min or 5 min of behavioral quiescence as the threshold for defining sleep (Figures S2B and S2C). These data suggest that flies can sleep in bouts of quiescence substantially shorter than 5 min and argue that, beyond the duration of behavioral quiescence, the consideration of microbehaviors and the timing of these bouts may facilitate the identification of sleep in Drosophila.
Next, we asked whether sleep-associated microbehaviors (PP and HS) affected the depth of sleep (as defined by changes in arousal threshold). To do this, we identified sleep bouts during ZT10-ZT17 and then compared arousal threshold levels if HS or PP was present at “laser-on.” We found that when flies were asleep and their halteres were “down,” they demonstrated an elevated arousal threshold level, compared to sleep bouts where halteres were “up” (Figure 2H). Because PP events are typically brief (∼10s), we had only 2 bouts where the laser turned on while the fly was exhibiting PP. Although we were unable to perform reliable statistical analyses using these 2 bouts, their mean standardized arousal threshold was 1.1 ± 0.05, consistent with an elevated arousal threshold compared to sleeping flies without HS or PP. Taken together, these data suggest that sleep in Drosophila can occur with consolidated quiescence (the minimum duration of which varies depending on time) in the absence of any other obvious behavioral features, but that the presence of HS or PP behavior likely mark deeper stages of sleep.
Behavioral categorization performance of basty
There were several challenges associated with quantifying the micromovements associated with sleep. First, because we imaged the flies at high-resolution and over a long period of time, each dataset was large (∼10-20 GB for each 16 hr recording). Second, the micromovements associated with sleep were small, sometimes involving movements as small as 40-50 microns. Third, because the animals were freely moving, the appearance of these movements was variable. Fourth, these movements occurred across a range of timescales, ranging from secs to mins.
Thus, in addition to utilizing a deep-learning DeepLabCut algorithm, we developed a novel computational pipeline, named basty (for the spirit in Turkish folklore associated with nightmares and sleep paralysis). basty classifies behaviors in unannotated fly videos using a set of manually annotated fly videos (which serve as a “gold standard”); labels corresponding to one of five behavioral categories (PP, HS, postural adjustment, grooming, and feeding) are assigned to each micromovement-containing frame in the video. “Postural adjustment” refers to a collection of behaviors, where the fly briefly moves 1 or 2 legs or briefly changes the position of its thorax, without engaging in gross locomotor activity (see Methods). We were unable to analyze postural relaxation (Figure 1F) using this pipeline, because this movement is very subtle and occurs over a long duration. basty involves three steps: a) feature extraction, b) semi-supervised behavioral embedding, and c) committee classification of behavioral categories (Figure 3A). The pipeline takes 3D positional coordinates of the unannotated fly obtained from the DeepLabCut-generated pose estimations, and then computes various spatio-temporal features, such as distances between specific body-parts (Figure S3D). Wavelet transformations are applied on these raw features to extract spatio-temporal representations of each frame, resulting in a high-dimensional representation. To reduce the computational complexity and to increase predictive performance, we first classified frames into quiescent vs active (quiescent with micromovement) frames and filtered out the quiescent ones. In general, this classification was robust for most microbehaviors, but frames with HS movements were the most likely to be incorrectly classified as quiescent, given the chance for the halteres to be obscured by other body parts and the small movement involved (Figure S3B). Next, the high-dimensional representations were reduced to several lower-dimensional embeddings, where each unannotated fly video was paired with an annotated fly video. This pairwise strategy was adopted instead of a joint embedding strategy to prevent videos that are significantly dissimilar from distorting the embedding. Nearest neighbor classification was performed in this lower-dimensional space for each pair of annotated and unannotated videos, where each classifier presents a probability of categories for each frame. The final step involved combining the nearest neighbor classifications probabilistically within a committee of classifiers (Figure 3A). A committee approach was used, because of the substantial variability of the behavioral repertoire in an individual fly. For example, analysis of the behavioral repertoire of an unannotated fly with HS was markedly hampered if compared to a single annotated fly exhibiting few or no HS during the night (Figure S3A).
(A) Illustration of the main stages of the pipeline. To perform behavioral analysis, our pipeline starts by extracting meaningful spatio-temporal features from the body part positions, followed by a wavelet transformation and L1 normalization. Then, micro-activity detection is performed to distinguish quiescence and behaviors of interests using a random forest of decision trees. After that, semi-supervised embeddings of the time points detected as micro-activity are computed for each annotated and annotated fly experiments separately. Finally, a committee of annotated fly experiments predicts behavior scores by performing a joint nearest neighbor analysis on the embedding spaces. The output of the pipeline is a distribution of scores for behavioral categories, per video frame.
(B) Performance summary of behavior mapping with the area under curve (AUC) scores of receiver operating characteristic (ROC) for 16 experiments. (Below) Each column of the heatmap corresponds to a leave-one-out experiment, and each value measures the AUC of ROC curves for different behavior categories. (Above) bar-plots aggregate AUC values as a macro average. Absent behavior categories are left blank for some experiments.
(C) Distributions of behavior prediction scores of each behavioral category (PP, green; HS, red; postural adjustment, teal; feeding, blue; and grooming, orange) in all leave-one-out experiments combined. Each ridge-plot column demonstrates the behavior prediction score distributions of all the time points with the corresponding true annotation. These distributions reveal the predictive power of the scores, especially for PP, HS, and grooming.
To assess the predictive performance of behavior classification by basty, we performed a leave-one-out cross-validation on the 16 annotated fly videos (Figure 3B). Specifically, we used 15 manually annotated videos to predict the behavior of the held-out fly video. basty demonstrates strong performance in classifying PP, achieving AUC ≥ 0.95 for 11 splits out of 16 splits. Similarly, for postural adjustment, the AUC exceeds 0.9 for 9 splits and only drops below 0.85 in one split. The AUC score for grooming detection ranges from 0.70 to 0.91, performing slightly worse than for PP and postural adjustment. Behavioral scores for grooming are relatively high for feeding and also right-skewed for PP and postural adjustment, which results in false positives leading to the decrease in performance (Figure 3C). The AUC scores for feeding are above 0.7, except for one split out of 13 in which feeding was observed. The most challenging behavior for basty is HS, as it is the most nuanced behavior. The AUC score for HS never exceeds 0.85, but is above 0.7 in 8 splits out of 14 splits. Overall, the macro average score is above 0.8 for 15 splits. We also calculated precision-recall and receiver operating characteristic (ROC) curves for each split, as well as the interpolated weighted averages of the curves, using the generated behavioral scores (Figure S3C). As before, PP and postural adjustment were most robustly detected, achieving F1 scores >0.8 and 0.85, respectively for some splits. In contrast, the maximum F1 score for grooming was 0.6 and did not exceed 0.4 for HS. Overall, these findings argue that basty robustly classifies wake– and sleep-associated microbehaviors in Drosophila.
Quantification of Sleep-associated Behaviors
We plotted sleep amount and bout durations, using our time-dependent definitions to identify sleep (quiescence for >30s from ZT10-ZT17 and >1 min for ZT17-ZT24) (Figures 4A and 4B). Female flies sleep at a consistently high level throughout the night, while male flies exhibit a gradual reduction in sleep amount in the late night (Figure 4A). Interestingly, sleep bout duration appears to vary in a polyphasic manner during the night. Female flies appear to demonstrate longer sleep bout duration in the early night, as one would expect from increased homeostatic pressure. However, rather than steadily decline throughout the night, there appears to be another peak of longer sleep bout duration in the middle of the night (Figure 4B). In males, the initial increase in sleep bout duration is slightly delayed compared to females, but there is also a later peak of longer sleep bout durations near the middle of the night (Figure 4B).
(A) % sleep from ZT10 to ZT0 in 5 min bins for female (top, n=10) and male (bottom, n=18) flies. Shading denotes SEM.
(B) Simplified box plot showing sleep bout duration from ZT10 to ZT0 in 30 min bins for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median.
(C) Distribution of PP events across the night. Individual pumping events plotted for each individual female (upper panel, red) and male (lower panel, blue) fly from ZT10 to ZT0. Data are from the same flies as in (A).
(D) Simplified box plot showing PP/hr from ZT10 to ZT0 for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median.
(E) Distribution of HS events across the night. Individual HS plotted for each individual female (upper panel, red) and male (lower panel, blue) fly from ZT10 to ZT0. Data are from the same flies as in (A).
(F) Simplified box plot showing HS/hr from ZT10 to ZT0 for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median.
Next, we used basty to quantify microbehaviors seen under baseline conditions and after sleep deprivation (SD). Previous work using a tethered preparation suggested that flies exhibited frequent PP (up to ∼100 pumping events/hr). Moreover, there was a monotonic decrease in PP frequency across the night under baseline conditions, peaking at ZT12, decreasing throughout the night, showing a ∼5-fold decrease by the end of the night 35. However, PP has been shown to not only occur during sleep behavior, but can also be triggered metabolic stress (e.g., prolonged flight leads to elevated CO242). Because tethering a fly is likely stressful, it is possible that some of these PP events are not related to sleep per se. In freely moving male and female flies under baseline conditions, we found that PP frequency peaked at ∼20 events/hr and did not demonstrate a monotonic decrease across the night (Figures 4C and 4D). Instead, interestingly, there appeared to be 3 peaks of PP frequency, occurring in the early-, mid-, and late-night (Figure 4D). The early– and late-night peaks could potentially relate to increased locomotor activity from evening and morning anticipation, but the mid-night peak occurs during a period of low locomotor activity (Figure 1D), suggesting that it is not simply connected to metabolic activity. Another possibility is that these three peaks of PP reflect an underlying ultradian process.
We next examined spatio-temporal features of these PP events. Previous work showed that these PP events typically occur with ∼3s inter-pump interval (IPI) 35,42, and similar results were obtained using our system (Figures S4A and S4B). There is some variance in the IPI, which can occur within a single bout (Figures S4B and S4C), but also consistently between the first 2 pumps and the last 2 pumps, with the last IPI being significantly longer (Figure S4D). The number of pumps per bout was similar between males and females (Figure S4E).
HS behavior also appeared to have three peaks during the night in both males and females, although the distribution of the peaks appeared to be more concentrated towards the middle of the night (Figures 4E and 4F). In contrast, duration of grooming did not reveal a triphasic structure during the night in either males or females (Figures S4F and G). Instead, females, but not males, seemed to exhibit a peak of grooming behavior in the early night, potentially consistent with prior work suggesting that grooming may represent a pre-sleep behavior in Drosophila43. Taken together, these data reveal that sleep consolidation and sleep-associated microbehaviors exhibit variable dynamics across the night, which may suggest the presence of different sleep states.
One of the key defining features of sleep is its regulation by homeostatic forces44. To investigate how these microbehaviors were affected by sleep loss, we performed mechanical SD from ZT12-ZT24. First, we calculated sleep amount and bout duration from ZT0-ZT2 in the presence or absence of SD. As expected, a significant increase in both sleep amount and bout duration was observed in both males and females following SD (Figures 5A and 5B). We then characterized microbehaviors using our imaging system and basty. As has been previously described35, SD triggered a substantial increase in PP frequency in both female and male flies, which persisted for at least 2 hrs after cessation of the SD (Figures 5C and 5D). Interestingly, SD led to a significant shortening of the IPI (Figure S4A). However, SD did not markedly affect the difference between first and last inter-pump intervals and did not increase the number of pumps per bout (Figures S4D and S4E). The frequency of HS events was also increased following SD in male flies, but not significantly increased in female flies (for which the sample size is smaller) (Figures 5E and 5F). In contrast, SD did not affect the duration of grooming behavior in female flies, but did enhance grooming behavior in male flies (Figures S5A and S5B). Together, these data suggest that the PP and HS sleep-associated microbehaviors are under homeostatic control.
(A) % sleep from ZT0 to ZT2 in 5 min bins in the presence (SD) or absence (WT) of 12 hr SD from ZT12-ZT24 for female (top, n=10 for WT and 13 for SD) and male (bottom, n=18 for WT and 19 for SD) flies. Shading denotes SEM.
(B) Simplified box plot showing % sleep from ZT0 to ZT2 in the presence (SD) or absence (WT) of 12 hr SD for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median. Mann-Whitney U tests; **, P < 0.01 and ***, P < 0.001.
(C) Distribution of PP events from ZT0-ZT2 in the presence (SD) or absence of 12 hr SD. Individual pumping events plotted for each individual female (upper panel, red) and male (lower panel, blue). Data are from the same flies as in (A).
(D) Simplified box plot showing PP count from ZT0 to ZT2 in the presence (SD) or absence (WT) of 12 hr SD for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median. Mann Whitney U-test; *, P < 0.05 and **, P < 0.01.
(E) Distribution of HS events from ZT0-ZT2 in the presence (SD) or absence of 12 hr SD. Individual pumping events plotted for each individual female (upper panel, red) and male (lower panel, blue). Data are from the same flies as in (A).
(F) Simplified box plot showing HS count from ZT0 to ZT2 in the presence (SD) or absence (WT) of 12 hr SD for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median. Mann Whitney U-test; ***, P < 0.001.
Sleep-associated Behaviors following Activation of dFB and R5 neurons
To demonstrate the utility of our high-resolution video imaging approach, we used our system to characterize the behaviors observed following optogenetic activation of two proposed sleep-promoting circuits in Drosophila. Because our setup had to be modified to enable optogenetic manipulation (which altered the lighting in the video images), we could not use basty to automatically classify sleep-associated behaviors, as its training dataset was generated using the original high-resolution video setup. Instead, sleep-associated behaviors were manually classified, which was feasible due to the short duration of the experiments. In Drosophila, arguably the best-studied neural cluster suggested to promote sleep is a group of dorsal fan-shaped body (dFB) neurons, also called ExFl2 neurons 45–47. These neurons have been suggested to rapidly induce sleep-like behavior and improve memory performance in Drosophila. While a number of driver lines have been used to target these neurons to promote sleep, many groups have focused on R23E10-Gal4, as this line has relatively specific labeling of dFB/ExFl2 neurons in the central brain (although connectomics data indicate that this driver line include multiple distinct cell types20). Interestingly, recent papers have argued that the sleep-promoting effects of R23E10-Gal4 are not attributable to the ExFl2 neurons, but rather to neurons in the thoracic ganglion48,49. To address the behavioral consequences of activating dFB/ExFl2 (or the recently described subset of thoracic ganglion) neurons, we performed recordings consisting of 5 mins of baseline (“pre-stim”), 5 mins of 1 Hz optogenetic stimulation (“stim”), and 10 mins after stimulation (“post-stim”) for R23E10-Gal4>UAS-CsChrimson flies between ZT3-9. As a control, we also tested empty-Gal4>UAS-CsChrimson flies. Strikingly, although optogenetic activation of R23E10-Gal4>UAS-CsChrimson flies led to a rapid cessation of gross locomotor activity (“moving”), it induced frequent micromovements/postural adjustments and grooming, inconsistent with sleep behavior (Figures 6A, 6B and Supplemental Video 3). These observations are similar to a previous report, in which thermogenetic activation of dFB neurons lead to increased micromovements50.
(A) Distributions of 7 distinct behaviors (moving, teal; quiescent, orange; micromovement/postural adjustment, purple; PP, pink; grooming, green; feeding, crystal teal; HS, blue) before, during, and after 5 min optogenetic stimulation (1 Hz) for control (empty-Gal4, n=11), ExFl2 (R23E10-Gal4, n=7), and R5-splitGal4 (R58H05-AD, R46C03-DBD, n=12) male and female flies expressing CsChrimson at ZT3-9.
(B) Duration of time spent in moving, quiescent, micromovement, PP, or grooming states before (pre-stim), during (during), or after (post-stim) optogenetic stimulation for empty-Gal4>UAS-CsChrimson (empty, teal), R23E10-Gal4>UAS-CsChrimson (dFB, orange), and R58H05-AD, R46C03-DBD (R5, pink) flies. One way ANOVA with post-hoc Tukey; ***, P < 0.001.
In addition, our group previously identified a set of ellipsoid body neurons (R5) proposed to be important for homeostatic sleep drive in Drosophila24,51,52. Thus, we wished to use our high-resolution video system to investigate the behavioral consequences of activating R5 neurons. Because it was later found that some Gal4 drivers used to label R5 neurons were contaminated with arousal-promoting neurons, we used a split-Gal4 line (R58H05-AD, R46C03-DBD) that does not express in those additional cells 52,53. Our previous data suggested that thermogenetic activation of R5 neurons led to an increase in sleep during the heat treatment, followed by persistent sleep behavior after cessation of the heat treatment24,52. 1 Hz optogenetic activation of R58H05-AD, R46C03-DBD>UAS-CsChrimson flies produced a significant reduction in locomotor activity during activation. Interestingly, behavioral quiescence was not significantly increased during R5 activation, because these flies exhibited a robust increase in 0.3 Hz PP events during this time. In contrast, no PP events were observed with R23E10-Gal4 or empty-Gal4 activation. Following stimulation of R5 neurons, there was a substantial increase in persistent quiescence (Figures 6A and 6B). Taken together, these data suggest that optogenetic activation using the R23E10-Gal4 driver does not appear to promote sleep, while activation of R5 neurons leads to an interesting phenotype by inducing PP events, followed by persistent behavioral quiescence.
Discussion
Animal behavior encompasses a wide variety of actions, ranging from movements with large changes in position (e.g., running) to small movements of individual body parts (e.g., orienting an ear) or subtle adjustments of posture. These latter behaviors are challenging to study, but could provide important insights into animal internal states. With few exceptions, sleep is a behaviorally quiescent state and, in mammals and other animals species, comprises multiple sub-states54,55. To rigorously characterize sleep behavior in Drosophila and potentially gain insights into underlying sub-states, we performed high-resolution video imaging, followed by pose estimation and behavioral classification using a novel computational pipeline. We also used a closed-loop laser perturbation method to gently but effectively probe arousal thresholds during sleep.
Our approach to characterizing sleep considered both the absence of locomotion and other microbehaviors (i.e., feeding, grooming, defection) that we consider incompatible with sleep. However, we acknowledge the possibility that flies may sometimes sleep while engaging in one of those behaviors. We find that flies can sleep in very short bouts between 30-60s of quiescence early in the night, in line with other work that suggested the flies can sleep in bouts less than 5 min40,41. Our data confirmed sleep-associated PP occurs in freely moving flies and revealed the presence of a novel microbehavior—HS. Interestingly, sleeping flies can respond to a mild stimulus by solely changing the position of their halteres, without moving. Moreover, sleep associated with HS exhibits a greater arousal threshold than sleep without HS. This finding, coupled with prior work suggesting similar findings for tethered sleeping flies with PP, suggest the possibility that multiple sleep stages exist in Drosophila. Indeed, a classic study in humans > 150 yrs ago predicted the cycling of sleep stages by simply assessing arousal thresholds in response to varying sounds from a hammer striking a slab56. Other studies performing arousal perturbations and brain-wide Ca2+ imaging have also suggested the possibility that fly sleep has multiple stages40,41, but ultimately, to fully characterize different sleep stages in Drosophila will likely require neurophysiological imaging of both brain and muscle, preferably in freely moving animals.
Our deep phenotyping also reveals some of the complex dynamics underlying fly sleep. While the nighttime sleep profile determined using our system resembles data obtained from traditional beam-break or low-resolution video methods, we observe interesting dynamics of sleep bout consolidation, PP, and HS, which suggest that sleep in Drosophila is polyphasic in nature, and that there are underlying sub-states that occur 2-3 times during the night. In addition, the high-resolution and side view of our system enabled finer characterization of the effects of circuit manipulations on sleep in flies. Intriguingly, we find that optogenetic activation using the R23E10-Gal4 driver--one of the most commonly used drivers to promote fly sleep—reduces locomotion, but does not produce behavioral quiescence; instead, frequent micromovements and grooming behavior are observed which seem incompatible with sleep. It will be important to characterize the effects of activating other drivers labeling ExFl2/dFB neurons or recently implicated thoracic ganglion neurons to determine what microbehaviors are produced. In contrast, optogenetic activation of R5 neurons also reduces locomotion during activation and triggers PP (a sleep-associated microbehavior) followed by persistent behavioral quiescence. These data could be consistent with the notion that R5 activation induces sleep need (as PP has been suggested to facilitate waste clearance related to sleep35), with the subsequent sleep behavior acting to reduce sleep need. However, further work to characterize in vivo neurophysiological signals of R5 activity during sleep and after SD is needed to strengthen this claim.
Pose estimation algorithms (such as SLEAP57 and DeepLabCut32) together with our semi-supervised computational pipeline developed for this work should in principle be capable of quantifying not just sleep, but any fly behavior, in a side-view chamber where flies can freely move. Thus, there could be broad utility for this pipeline for Drosophila neuroscience researchers. In addition, while the use of deep-learning approaches for video analyses of freely moving animals is becoming increasingly used, we are unaware of any prior study using these methods to study behaviors that are largely quiescent, which poses multiple technical hurdles. Nonetheless, it is likely that important internal states can be revealed in the analysis of subtle changes in posture and position of body parts, and further development of applications capable of quantifying these changes should yield novel insights into how animals integrate internal states and external perception to generate behavior.
Methods
Fly strains
Flies were maintained on standard food containing molasses, cornmeal, and yeast at room temperature. iso31 58 was used as the background strain, and all strains used were backcrossed into the iso31 background at least 4 times. R23E10-Gal4, R58H05-AD, R46C03-DBD and empty-Gal4 were obtained from the Bloomington Drosophila stock center. UAS-CsChrimson-mChery (VK5) was a gift from Vivek Jayaraman.
basty for Behavioral Identification
Pose Estimation
We used DeepLabCut32 for pose estimation. Of the 1304 labeled images from 88 files, 5% were held out for testing and the remaining images were used for training. We trained a ResNet-50 based neural network using batch size 4 and 200000 iterations. The resulting network had a train error of 6.31 pixels and a test error of 9.96 pixels for image-size of 1100×800 pixels.
Feature Extraction
The first stage of the basty pipeline, like many others59–61, is feature extraction. This step comprises four consecutive steps: preprocessing, spatiotemporal feature computation, wavelet transformation, and normalization.
Preprocessing
The preprocessing step addresses two challenges: the occluded body-part problem and the noisy nature of pose estimation data. We utilize the confidence scores provided by body-part tracking software DeepLabCut32 to detect which one of the left & right counterparts of a body part is occluded at a specific time point.
To filter data, we first detect erroneous “jumps” in tracking by comparing the estimated pose values to the median pose value of the same body part within a 0.5 second window. If the pose estimation at a given time point exceeds the median value of the window centered at that time point by 15 microns, we consider it to be a jump, and remove the corresponding data point. The removed time points, i.e., jumps and occlusions, were imputed by interpolation. Following imputation, we applied a median filter (of size 0.2 seconds) followed by a boxcar filter (of size 0.2 seconds) to eliminate the rapidly changing signals without smoothing out short-duration low-amplitude behavioral signals, e.g., HS.
Spatiotemporal feature computation
In the subsequent step, we computed 13 meaningful and representative spatiotemporal features from the preprocessed tracking data. These features encompass measurements like the separation between the thorax and haltere, or the distance from the head to the proboscis (Figure S3D). To refine our behavioral representation, we applied wavelet transformation to capture postural dynamics over multiple timescales simultaneously, as also done by others 59–61. We applied continuous wavelet transformation with Morlet wavelet, that span 20 different frequency channels dyadically spaced between 1 Hz and 20 Hz. This procedure yielded a total of 260 feature values (13 features × 20 frequency channels). We normalized the power spectrum of different timescales as described before62 and finally, we applied L1 normalization to generate a vector wherein the values were summed to 1 for each time point.
Elimination of quiescence frames that lack micro-activity
We first eliminated frames of quiescence devoid of micro-activity. This elimination serves two purposes. First, given the high frame rate and long duration of video recordings, computational feasibility is a key concern. As more than 90% of the frames are either predominantly quiescent or contain macro-activities such as walking, filtering quiescence frames reduce computational demands significantly. Second, since quiescence frames mostly encompass noise (i.e., no relevant signal that relates to micro-activity), if they are included in normalization the amplified noise generates a uniform-like probability distribution for behavioral representation as was also observed previously61. This critically impacts the subsequent behavioral classification. Therefore, eliminating frames of pure quiescence devoid of micro-activity aims to circumvent this issue. To do so, we trained a random forest classifier63, with 10 estimators (i.e., trees) with a maximum depth of 5, with Gini index as the impurity criterion, and classified quiescence vs activity frames.
Behavioral classification
Following the identification of frames with micro-activities, we performed dimension reduction on the high dimensional feature space from the power spectra of multiple spatiotemporal features. This is motivated by the fact that since the correlation between different spatiotemporal features and different timescales are often strong, one may expect that the intrinsic topological configuration can be faithfully depicted within a reduced-dimensional space. We adopted a semi-supervised framework and leveraged the semi-supervised extension of the Uniform Manifold Approximation and Projection64 algorithm with Hellinger distance. Specifically, given data from an unannotated experiment (i.e., fly), we computed a 2-dimensional embedding by pairing the unannotated experiment with each annotated experiment one at a time. Here, each annotated experiment constitutes a different “view” on the data. When the behavioral repertoire of the annotated and the novel experiment are similar, the provided “view” yields an accurate, easy-to-interpret low-dimensional representation of the exhibited behaviors in the novel experiment. When the behavioral repertoire and/or feature distribution are dissimilar, the resulting embedding may not be informative; however, other paired-embeddings will not get distorted by uninformative or low-quality views.
Following the construction of pairwise embeddings, a nearest-neighbor analysis is deployed on each embedding, to generate a behavior category weight vector for each frame from the unannotated experiment. The entries within the behavioral weight vectors correspond to the similarities with different behavioral categories. Subsequently, an ensemble committee of classifiers is formed for each pairing. Within this committee, each behavioral weight contributes to the ultimate prediction. By aggregating these behavioral weight vectors through summation, followed by the application of L1 normalization, we arrive at final prediction scores that collectively sum up to 1. Subsequently, the final ensemble committee of classifiers aggregates the weights from each pairing for each behavioral category within a frame and performs L1 normalization across the categories. This results in a probabilistic assignment of each unannotated frame within an experiment to one of the five behavioral categories.
Analysis of basty results
We first filtered the behavioral predictions based on the confidence score for the body part of interest that is associated with the targeted behavior. For example, behavioral score for Haltere Switch is assigned to zero for frames where DeepLabCut has a threshold hold less than 0.8 for the location of the haltere facing the camera. We used the same threshold for the position of the proboscis and applied it to PP and feeding behaviors. For grooming, thorax position is used for filtering. We then assigned the behavior with the highest behavioral score to that frame as the designated behavior. The resulting arrays are then further processed to calculate the duration and bout number per behavior as appropriate.
To calculate sleep we used grooming, feeding and movement behavioral classes and calculated continuous chunks that exclude these categories. We then further filtered this data by applying our sleep criteria based on arousal threshold experiments. We defined 30 sec and longer quiescence as sleep in early night ZT10-ZT17 and 1 minute or longer quiescence as sleep in late night ZT17-ZT24. For sleep “rebound” during ZT0-ZT2 following SD, sleep was defined as periods of quiescence >30s.
Behavioral Chambers
Flies are raised at 23 C° in 12:12 LD cycles in an environmental incubator. For each experiment, the corresponding fly is placed in a custom designed 3D-printed (Ultimaker 3) chamber with a 2.8mm (D) x 4.9mm (H) x 7.1mm (W) at the front. The chamber tapered so that at the back width is 4.1mm and height is 6.6 mm. A laser cut square (7×7mm with a 2 mm thickness) is inserted at the front and the back of the chamber to keep the fly enclosed while allowing for recordings of behavioral videos. In some cases, these windows were coated with Sigmacote (SL2, Sigma Aldrich) to prevent flies from hanging onto the windows.
Individual 5-7 male and female old flies were loaded into individual chambers 1-3 hours prior to recording start time using either a mouth pipette or a small vacuum pump (FV-10, Furoro). A small capillary is inserted containing <5 ul of 2.5% yeast and 2.5% sugar liquid food through a food port located at the top of the chamber. This capillary is secured using a plastic pipette tip or UV curable glue (3972, Loctite) to the chamber. Chambers are then attached to a 3D printed platform secured on an aluminum breadboard using 1/4” x 1/8” x 1/16” magnets. A telecentric lens (#63-074, Edmund Optics) attached to a machine vision camera (BFS-U3-23S3M-C, FLIR) is used to record 16 hours (ZT10-ZT2) of behavior in each fly. A 850 nm ring light (LDR2-70IR2-850, CCS) is used to illuminate the fly. Camera settings, start/stop time and video encoding settings are controlled either through SpinView (FLIR) or custom-written MATLAB and Python scripts. All videos are recorded at 30 Hz.
Arousal Threshold
Experiments were performed on 5-7 day old flies, similar to the no perturbation experiments, with the exception of the chambers. Flies are inserted in a chamber 2.4mm (D) x 4.2mm (H) x 5.6mm (W) at the front and 3.5mm (H) x 5.2mm (W) at the back. Chambers are printed either using a Ultimaker 3 printer or professionally through Protolabs. A coverslip (CS8R, Warner Instruments) coated with Sigmacote is taped in the front and the back of the chamber. A 1064 nm laser diode (L1064H2, Thorlabs) is collimated using an aspheric lens (C240TMD-C, Thorlabs) and expanded using a beam expander (GBE15-C, Thorlabs). A ring light is placed above the fly and aluminum covered plastic is placed to direct the light towards the chamber. To block laser illumination in the video, a notch filter (NF1064-44, Thorlabs) is placed between the chamber and the camera lens.
Experiments started at ZT10 and lasted until ZT0. A custom-written Python script processed the incoming video feed and determined if the fly is moving or not based on a background subtraction algorithm (for details, see https://github.com/mfkeles/flysleepcl). When a fly becomes immobile for 30 seconds, the laser is triggered using a NI-DAQ and the power of the laser is linearly increased over 30 seconds (Figure S2A). During this perturbation, if a fly started moving, the script ensured that the fly moved at least 90% of the time within a 3-second window. This ensured that the fly was fully aroused, and the laser would then be turned off. Each perturbation was spaced, so that a perturbed fly would not be perturbed again within a 30 min period.
Arousal Threshold Data Analysis
For each epoch of perturbation, a wake-to-latency parameter is calculated. To achieve this, the cumulative sum of the calculated motion for each perturbation bout is calculated using the analyzed movement/quiescence data. Then, a breakpoint is calculated where the fly consistently moved using a linearly penalized segmentation algorithm (https://github.com/deepcharles/ruptures). This breakpoint is taken as the arousal point. Flies that spent less than 70% of the time quiescent between ZT13 and ZT23 were discarded. Remaining flies are then scored for the presence or absence of HS behavior during stimulation. This was determined by a change in haltere position in the dorsoventral axis that precedes laser induced movement. Videos corresponding to each arousal event were extracted starting from the closest movement bout defined by 1 sec of continuous movement. Each video is then annotated for HS using three classes: True, False and Inconclusive Videos are labeled inconclusive where haltere was not visible due to occlusion or the body orientation. These data points are excluded from the data analysis. In addition, feeding, grooming, PP and defecation behaviors that occur between the last significant movement and laser perturbation were manually annotated using BORIS65. The annotator was blind to determined threshold and other experimental parameters. To calculate the standardized arousal threshold values, the recorded analog voltage signal (copy of the signal sent to the laser driver) is integrated over the calculated point where the animal starts moving. For each animal, integrated (Volt-second) values are standardized by subtracting the mean of all the trials per animal and dividing by the standard deviation.
Optogenetic Activation
Flies with indicated genotypes were loaded into the chambers described above. Experiments were performed between ZT3-ZT9. Flies were acclimated into the chamber for 10 minutes. Stimulation protocol consisted of 5 minutes of baseline recordings, 5 minutes of LED stimulation at 1 Hz with a pulse width of 5 ms and finally 10 minutes of recording post stimulation. Camera and LEDs are triggered using an Arduino. Two LEDs (590 nm) wired serially were used for stimulation. Resulting videos were manually annotated using BORIS65and plotted using MATLAB.
Sleep Deprivation
Sleep deprivation experiments were conducted using two different methods:
A small piezo motor (312-101.001, Precision Microdrives) secured under a platform. This platform is then placed into a base holder with 0.7 mm clearance on the long axis and 0.8 mm on the short. These clearances allowed the platform to shake when the motor is turned on. A standard 3D-printed chamber was placed in the middle of this movable platform. The motor was turned on for 3–5 seconds every min starting at ZT12, lasting until ZT0. Each behavioral recording lasted 16 hours (ZT12-ZT0).
Flies were loaded into individual DAM (Drosophila Activity Monitor, Trikinetics Inc.) tubes using CO2 anesthesia 2 days prior to the video monitoring. Flies than mechanically sleep-deprived 3s every min from ZT12-ZT0 using a vortexer. Flies were then taken out of the individual tubes between ZT23 and ZT0 and placed into standard imaging chambers using a mouth pipette. Video recording started at ZT0 and lasted until ZT6. The ZT0 to ZT2 portion of the video was used for analysis.
Statistical analysis
For comparisons of 2 groups of normally distributed data, unpaired or paired t-tests were performed. For multiple comparisons, one-way ANOVAs followed by post-hoc Tukey were performed. For comparisons of 2 groups of non-normally distributed data, Mann-Whitney U-tests were performed.
Figure Legends
(A) Additional examples of quiescence associated behaviors, showing spatiotemporal structure of HS and PP. Orange, magenta, and green lines indicate the distance between origin (fixed point at 0, 0) and thorax, origin and proboscis tip, and thorax to haltere, respectively. Expanded trace of PP is shown in the left plot.
(B) Plots showing location of the thorax for quiescence bouts separated according to whether bouts were <1 min (blue), between 1-5 min (yellow), or >5 min (red). Flies spent extended quiescent bouts (>1 min) near food.
(A) Perturbation protocol for assessing arousal threshold. Plot illustrating voltage/time relationship, where the laser is turned on and its power is linearly increased over 30 sec.
(B) Standardized arousal threshold plotted for female flies during ZT10-17 or ZT17-24 windows for quiet wakefulness (movement, feeding, grooming, defecation occurring 30-60 sec prior to “laser on”) (n=9 and 7 bouts), 30-120s quiescence prior to “laser on” (n=63 and 49 bouts), or >2 min quiescence prior to “laser on” (n=43 and 75 bouts). Data were analyzed from the flies in Figure 2. Error denotes SEM; one-way ANOVA with post-hoc Tukey.
(C) Standardized arousal threshold plotted for female flies during ZT10-17 or ZT17-24 windows for quiet wakefulness (movement, feeding, grooming, defecation occurring 30-60 sec prior to “laser on”) (n=9 and 7 bouts), 30-300s quiescence prior to “laser on” (n=72 and 62 bouts), or >5 min quiescence prior to “laser on” (n=34 and 62). Data were analyzed from the flies in Figure 2. Error denotes SEM; one-way ANOVA with post-hoc Tukey.
(A) Box-plots of behavioral scores before normalization and histograms of corresponding entropy values are computed using one unannotated (Fly 2) and two annotated (Fly 1 and Fly 3) experiments with varying behavioral repertoires. Here, the behavioral repertoire of Fly03082020-F-WT is predicted separately with two different annotated experiments, namely Fly08172021-F-WT and Fly08112021-M-WT. Behavioral scores and entropy values are computed for the HS behavior. The difference between the two is that one does not exhibit any HS behavior (Fly08112021-M-WT), whereas the other frequently does (Fly08172021-F-WT). As a result, behavioral scores fail to indicate a confident behavioral category, and hence, tend to have higher entropy (right lower panel). In contrast, confident predictions and low entropy of behavioral score distributions for HS behavior are observed with Fly 1’s annotations (left sub-figure). Results demonstrate the ability of the proposed pipeline to detect and discover unseen unannotated behavioral categories using behavioral scores.
(B) Evaluation of the micro-activity detection stage of the pipeline. Each data point stands for a leave-one-out experiment, and the y-axis represents the percentage of time points correctly detected as micro-activity for each behavior category. Low percentage values are undesired, as only the time points detected as micro-activity are analyzed in the latter stages of the pipeline and directly affect the down-stream analysis. Extremely low percentages often indicate behaviors that are rarely exhibited, rather than poor detection performance.
(C) Performance summary of behavior mapping demonstrated using receiver operating characteristic curve and precision-recall curve. The weighted averages and standard deviations of ROC and precision-recall curves are computed from all sixteen leave-one-out by interpolation.
(D) Schematics illustrating the body parts or X-Y location (origin) used in the 13 features for the computational pipeline.
(A) Simplified box plot showing frequency of pumps / bout in the absence (red, ZT10-ZT2, n=28) vs presence (gray, ZT0-ZT6, n=32) of 12 hr SD from ZT12-ZT24. Data are pooled data from males and females. Top and bottom of the boxes represent 75th and 25th percentiles, and middle line represents median. Mann Whitney U test, ***, P < 0.001.
(B) Histogram showing distribution of inter-pump intervals, with a peak near 3s.
(C) Example trace (above, origin-proboscis distance) and PP frequency (below, in 3 sec bins) showing variability of the inter-pump interval within a single long bout from a male fly.
(D) 2 example traces (origin-proboscis distance) of individual PP bouts showing a longer inter-pump interval for the last 2 pumps compared to the first 2 pumps (left). Quantification of the first and last inter-pump intervals under baseline conditions and after SD for the animals described in (A) (right). Paired t-test; **, P < 0.01 and ***, P < 0.001.
(E) Simplified box plots showing the number of pumps per bout for the male and female flies described in (A).
(F) Distribution of grooming bouts across the night. Individual grooming bouts plotted for each individual female (upper panel, red) and male (lower panel, blue) fly from ZT10 to ZT0. Data are from the same flies as in Figure 4. Top and bottom of the box represent 75th and 25th percentiles, and the middle line indicates median.
(G) Simplified box plot showing grooming duration (sec) from ZT10 to ZT0 for the female (top) and male (bottom) flies in (F). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median.
(A) Distribution of grooming bouts from ZT0-ZT2 in the presence (SD) or absence (WT) of 12 hr SD from ZT12-ZT24. Individual pumping events plotted for each individual female (upper panel, red) and male (lower panel, blue). Data are from the same flies as in Figure 5.
(B) Simplified box plot showing grooming duration from ZT0 to ZT2 in the presence (SD) or absence (WT) of SD for the female (top) and male (bottom) flies in (A). Top and bottom of the box denote 75th and 25th percentiles, and circle indicates median. Mann Whitney U-test; **, P < 0.01.
Supplemental Figure Legends
Supplemental Video 1. Haltere switch behavior
Supplemental Video 2. Proboscis pumping behavior
Supplemental Video 3. Optogenetic activation using R23E10-Gal4 to target dFB neurons
Supplemental Video 4. Optogenetic activation using R58H05-AD, R46C03-DBD to target R5 neurons
Acknowledgments
We thank Dr. Vivek Jayaraman and the Bloomington Stock Center for flies. We thank Dr. Deniz Yavuz for assistance with the laser setup. This work was supported by NIH grants K99NS124976 (M.F.K), R01HG003747 (S.K.), R21HG012881 (S.K.), and R35NS122181 (M.N.W.).