Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Mar 14;11(11):eadq8131.
doi: 10.1126/sciadv.adq8131. Epub 2025 Mar 12.

FlyVISTA, an integrated machine learning platform for deep phenotyping of sleep in Drosophila

Affiliations

FlyVISTA, an integrated machine learning platform for deep phenotyping of sleep in Drosophila

Mehmet F Keleş et al. Sci Adv. .

Abstract

There is great interest in using genetically tractable organisms such as Drosophila to gain insights into the regulation and function of sleep. However, sleep phenotyping in Drosophila has largely relied on simple measures of locomotor inactivity. Here, we present FlyVISTA, a machine learning platform to perform deep phenotyping of sleep in flies. This platform comprises a high-resolution closed-loop video imaging system, coupled with a deep learning network to annotate 35 body parts, and a computational pipeline to extract behaviors from high-dimensional data. FlyVISTA reveals the distinct spatiotemporal dynamics of sleep and wake-associated microbehaviors at baseline, following administration of the sleep-inducing drug gaboxadol, and with dorsal fan-shaped body drivers. We identify a microbehavior ("haltere switch") exclusively seen during quiescence that indicates a deeper sleep stage. These results enable the rigorous analysis of sleep in Drosophila and set the stage for computational analyses of microbehaviors in quiescent animals.

PubMed Disclaimer

Figures

Fig. 1.
Fig. 1.. High-resolution method to investigate quiescent behaviors in flies.
(A) Schematic of the behavioral setup shows a fly in a 7.1 mm–by–4.9 mm–by–2.8 mm 3D-printed chamber with a liquid food capillary, imaged at high resolution (~8 μm/pixel). (B) Illustration of tracked points on a fly using DeepLabCut, with 21 unique points (35 in total, including symmetric body parts). (C) Image of a fly in the chamber with tracked body parts. (D) Average activity per 1-min bins for male (n = 23, green) and female (n = 19, orange) flies from ZT10 to ZT2, based on frame-by-frame changes in tracked points. a.u., arbitrary units. (E) Illustrations of microbehaviors during sleep. (F) Images show the thorax lowering progressively (postural relaxation) during prolonged quiescence; dashed line connects identical pixel points across images. (G) Downward antenna movement during prolonged quiescence (blue arrow) and haltere position change (light green arrow). (H) PE in four consecutive images, with a red dashed line linking the proboscis tip and dorsal edge of the eye; the plot shows distance changes over time, with examples of PE bouts across the night. (I) Images depict haltere movement during quiescence; dashed lines show tracked thorax and haltere points. Bottom left: Plot showing the distance between the two 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) to (I). (J and K) Quiescence bouts show distinct spatiotemporal behaviors. Static images capture quiescence, feeding, PE, HS (J), grooming, quiescence, postural relaxation, and HS (K). Dashed lines connect identical pixel points, whereas green, orange, and blue lines show distances between thorax-haltere, origin-thorax, and origin-proboscis tip, respectively. Expanded traces highlight PE and HS spatiotemporal structures, with yellow, magenta, and red indicators for halteres, antenna, and thorax.
Fig. 2.
Fig. 2.. Closed-loop analyses reveal dynamic changes of arousal threshold across time.
(A) Schematic of the closed-loop setup for arousal threshold testing, where a fly in a chamber is positioned between an IR laser and a camera. The laser turns on after 30 s of quiescence, with voltage gradually increasing over the next 30 s (fig. S2A). The laser shuts off after the fly exhibits 3 s of continuous movement. (B) Plots of arousal thresholds (V-s) for individual female flies across four experiments. (C) Normalized arousal thresholds (Z scores) for each perturbation bout in 60-min bins from ZT10 to ZT23, showing dynamic changes across time for female flies (n = 16). Each fly’s arousal threshold was normalized to its own mean. Error bars represent SEM. (D) Normalized arousal thresholds for female flies during ZT12-18 and ZT18-24 windows, using data from the same flies in (C). Error bars show SEM; unpaired t test. ***P < 0.001. (E) Normalized arousal thresholds for QW (a 30-s inactivity period before “laser on” with awake microbehavior like feeding or grooming, n = 41), 30- to 60-s quiescence (n = 27), 1- to 3-min quiescence (n = 27), or >3-min quiescence (n = 137). Error bars denote SEM; one-way ANOVA with Tukey’s post hoc test. ***P < 0.001. (F) Thorax location plots for quiescence bouts under 1 min (blue), 1 to 3 min (orange), or over 3 min (teal). Flies spent longer quiescent periods near food (n = 22 flies). (G) Static images of sleep-associated microbehaviors as laser power increases, showing antennal movement during laser ramp-up. Time series displays the change in antenna-vibrissae distance. (G′) Representative images of an HS “up” event followed by an antennal “up” movement, with time series data of haltere-thorax and antenna tip-vibrissae distances; shaded areas indicate HS “up” and antenna “up” events as laser power increases. Color indicates the change in the laser power.
Fig. 3.
Fig. 3.. Gaboxadol promotes PE microbehaviors and sleep.
(A) Plots showing the duration or event number for “moving,” “grooming,” “feeding,” “regurgitation,” “micromovement,” “leg adjustment,” “sleep,” “haltere switch,” and “proboscis extension” microbehaviors in 5-min bins for the 1-hour period starting from ZT0 when starved male flies (see Materials and Methods) were introduced to the chamber and provided 2.5% yeast and 2.5% sucrose food with (“Gabox,” blue square) or without (control, gray circle) gaboxadol (0.2 mg/ml). Two-way ANOVA with repeated measures, post hoc Šídák. *P < 0.05; **P < 0.01. (B) Simplified box plots showing the duration or event number for the above microbehaviors for control (gray, n = 7) and gaboxadol-treated (blue, n = 8) male flies for the 1-hour period from ZT0 to ZT1. Simplified box plots denote 75th, median, and 25th percentiles. Mann-Whitney U tests with Holm-Bonferroni correction. n.s., not significant; *P < 0.05; **P < 0.01. Data in (A) and (B) are from the same flies. (C) Representative example of a motion heatmap of a fly exhibiting postural changes following gaboxadol exposure (left). Time course of these postural changes (right), where colors indicate segmented masks at 10-s intervals covering 140 s of data. (D) Heatmap of the average position of control and gaboxadol-fed flies over 1 hour for the flies in (A) and (B).
Fig. 4.
Fig. 4.. Optogenetic activation of dFB drivers promotes distinct behaviors, including sleep.
(A) Velocity (mm/s) plotted for the 5-min prestimulation, 5-min optogenetic stimulation (“opto”), and 10 min poststimulation periods for empty-split-Gal4 (gray) versus R23E10-Gal4 (left, red), SS54320-Gal4 (middle, blue), and SS558320-Gal4 (right, green) flies expressing CsChrimson. Shading denotes SEM. (B) Distributions of eight distinct behaviors (moving, blue; quiescent, defined by the absence of any observable movement, gold; micromovement, vertical thoracic movements with jerky leg movements, teal; PE, magenta; grooming, lime green; feeding, turquoise; HS, purple; and leg adjustment, orange) before, during, and after 5-min optogenetic stimulation (10 Hz, 50% duty cycle) for control empty-split-Gal4 (n = 15), R23E10-Gal4 (n = 10), SS54320-Gal4 (n = 17), and SS55832-Gal4 (n = 12) male and female flies expressing CsChrimson at ZT3-9. (C) Duration of time spent in or event number for moving, grooming, feeding, micromovement, sleep, HS, PE, or leg adjustment microbehaviors before (pre-stim), during (during), or after (post-stim) optogenetic stimulation for empty-Gal4>UAS-CsChrimson (gray), R23E10-Gal4>UAS-CsChrimson (red), SS54320-Gal4>UAS-CsChrimson (blue), and SS55832-Gal4>UAS-CsChrimson (green) flies. Kruskal-Wallis with post hoc Dunn’s and Bonferroni correction. n.s., not significant; *P < 0.05; **P < 0.01; ***P < 0.001.
Fig. 5.
Fig. 5.. Semisupervised computational pipeline to analyze sleep-associated microbehaviors in Drosophila.
(A) Illustration of the main stages of the pipeline. To perform behavioral analysis, our pipeline starts by extracting meaningful spatiotemporal features from the body part positions, followed by a wavelet transformation and L1 normalization. Then, microactivity detection is performed to distinguish quiescence and behaviors of interests using a random forest of decision trees. After that, semisupervised embeddings of the time points detected as microactivity are computed for each annotated and unannotated fly experiments separately. Last, 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 AUC scores of ROC for 16 experiments. Bottom: 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. Top: Bar plots aggregate AUC values as a macro average. Absent behavior categories are left blank for some experiments. (C) Empirical cumulative distribution function (ECDF) plots of aggregated behavioral scores of each behavioral category (PE, green; HS, red; leg adjustment, teal; feeding, blue; and grooming, orange) in all leave-one-out experiments combined. Each plot demonstrates the aggregated behavior score distributions of all the time points with the corresponding true annotation. These distributions reveal the predictive power of the scores, especially for PE, HS, and grooming.
Fig. 6.
Fig. 6.. Quantification of sleep behavior using FlyVISTA.
(A) Distribution of wake (yellow) and sleep (blue) bouts plotted for mated female and male flies for the ZTs shown. (B and C) % sleep in 5-min bins (B) and sleep bout duration in 60-min bins (C) from ZT10 to ZT0 for female (n = 10) flies. Shading and error denote SEM. (D and E) % sleep in 5-min bins (D) and sleep bout duration in 60-min bins (E) from ZT10 to ZT0 for male (n = 18) flies. Shading and error denote SEM. (F) Distribution of wake (yellow) and sleep (blue) daytime bouts plotted for mated female and male flies from ZT0 to ZT12. (G and H) % sleep in 5-min bins (G) and sleep bout duration in 60-min bins (H) from ZT0 to ZT12 for mated female (n = 10) flies. Shading and error denote SEM. (I and J) % sleep in 5-min bins (I) and sleep bout duration in 60-min bins (J) from ZT0 to ZT12 for male (n = 18) flies. Shading and error denote SEM. (K) % sleep from ZT0 to ZT2 in 5-min bins in the presence (SD) or absence (no SD) of 12-hour SD from ZT12 to ZT24 for mated female (top, n = 10 for no SD and 17 for SD) and male (bottom, n = 18 for no SD and 19 for SD) flies. Shading denotes SEM. (L and M) Simplified box plots showing % sleep amount (L) or sleep bout duration (M) from ZT0 to ZT2 in the presence (SD) or absence (no SD) of 12-hour SD from ZT12 to ZT24 for the female (left) and male (right) flies in (A). Simplified box plots denote 75th, median, and 25th percentiles. Mann-Whitney U tests. **P < 0.01; ***P < 0.001.
Fig. 7.
Fig. 7.. Characterization of PE behavior.
(A) Distribution of PE events across the night for female (top) and male (bottom) flies from ZT10 to ZT0, with individual PE events (red) plotted. Because of the long timescale, individual ticks may represent multiple PE events, as shown by dashed lines that reveal multiple PEs within a single tick. Data are from the same flies as in Fig. 6 (A to E). (B) PEs/hour from ZT10 to ZT0 for the female (left) and male (right) flies in (A). Error denotes SEM. (C) Histogram showing distribution of IPIs, with a peak near 3 s. (D) Stacked bar plot showing the proportion of PE events during wakefulness (gray) and sleep (red) for female (F) and male (M) flies. (E) Distribution of PE events from ZT0 to ZT2 with (SD) or without (no SD) 12-hour SD (ZT12 to ZT24). Individual PE events are plotted for each female (top) and male (bottom) fly, where ticks may represent multiple events. Data are from the same flies as in Fig. 6 (K to M). (F) Simplified box plots showing PE counts from ZT0 to ZT2 with (SD) or without (no SD) 12-hour SD for female (left) and male (right) flies in (E). Mann-Whitney U test. **P < 0.01. (G) Simplified box plots of PEs per bout with (SD) or without (no SD) 12-hour SD for female (n = 10, 17) and male (n = 18, 19) flies. Mann-Whitney U test. n.s., not significant; *P < 0.05. (H) Simplified box plot showing the frequency of PE per bout in the absence (gray, no SD, ZT10 to ZT2, n = 28) versus presence (red, SD, ZT0 to ZT6, n = 36) of 12-hour SD from ZT12 to 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.
Fig. 8.
Fig. 8.. HS behavior identifies a deeper sleep state in Drosophila.
(A) Distribution of HS events across the night for female (top, red) and male (bottom, blue) flies from ZT10 to ZT0, showing individual HS events (orange ticks for “haltere down/ventral” and blue ticks for “haltere up/dorsal”). Data are from the same flies as in Fig. 6 (A to E). (B) HS/hour from ZT10 to ZT0 for female (left) and male (right) flies in (A), showing only HS “down” events. Error bars indicate SEM. (C and D) HS behaviors occur bilaterally. (C) Front and back chamber views with right and left halteres before and after an HS event; two examples shown. (D) Time series for tracked right (red) and left (blue) halteres, showing ~5 s before and after HS. Expanded view shows time differences. (E) Distribution of HS events from ZT0 to ZT2 with (SD) or without (no SD) 12-hour SD for female and male flies. Data are from the same flies as in Fig. 6 (F to H). (F) Box plots of HS counts from ZT0 to ZT2 with (SD) or without (no SD) 12-hour SD for female (left) and male (right) flies. Mann-Whitney U test. (G) Stacked bar plot of HS “down” events during wakefulness (gray) or sleep (red) for female and male flies. (H) HS timing relative to sleep onset. (I) Box plot showing the latency of PE or HS events relative to sleep onset in female flies. Mann-Whitney U test. (J) Cumulative distribution plot for PE and HS probability within a sleep bout. Kolmogorov-Smirnov test. (K) Box plot of sleep bout length with or without HS for female and male flies. Mann-Whitney U test. (L) Normalized arousal threshold for female flies identified as sleeping (>3-min quiescence from “laser on”) with or without HS behavior. SEM; unpaired t test. (M) Time series of haltere oscillations across a sleep bout, showing amplitude differences. *P < 0.05; **P < 0.01; ***P < 0.001.

Update of

References

    1. Allada R., Siegel J. M., Unearthing the phylogenetic roots of sleep. Curr. Biol. 18, R670–R679 (2008). - PMC - PubMed
    1. Oikonomou G., Prober D. A., Attacking sleep from a new angle: Contributions from zebrafish. Curr. Opin. Neurobiol. 44, 80–88 (2017). - PMC - PubMed
    1. Anafi R. C., Kayser M. S., Raizen D. M., Exploring phylogeny to find the function of sleep. Nat. Rev. Neurosci. 20, 109–116 (2019). - PubMed
    1. Iglesias T. L., Boal J. G., Frank M. G., Zeil J., Hanlon R. T., Cyclic nature of the REM sleep-like state in the cuttlefish Sepia officinalis. J. Exp. Biol. 222, jeb4862 (2019). - PubMed
    1. Nath R. D., Bedbrook C. N., Abrams M. J., Basinger T., Bois J. S., Prober D. A., Sternberg P. W., Gradinaru V., Goentoro L., The jellyfish cassiopea exhibits a sleep-like state. Curr. Biol. 27, 2984–2990.e3 (2017). - PMC - PubMed