Main

Mammalian circadian feedback loops take place in many tissues. They include the suprachiasmatic nucleus (SCN), the ~10,000 neurons of the master pacemaker in the hypothalamus1,2. The equivalent circadian region of Drosophila brain contains about 75 pairs of neurons; they are arranged in several groups3 and have a major role in determining the characteristic locomotor activity program4,5,6. It is characterized by morning (M) and evening (E) activity peaks under 12:12 light:dark conditions. There is also a midday siesta between the two activity peaks as well as consolidated sleep at night7. M activity is largely determined by the four circadian M cells, the small ventrolateral neurons (sLNvs)7,8, whereas E activity is due to three CRY-positive dorsal lateral neurons and the 5th sLNv (E cells)9,10,11,12. Although fly sleep is regulated by the clock, there are no known circadian neurons that function predominantly to inhibit locomotor activity or promote sleep, that is, that make a major contribution to the midday siesta or night-time sleep.

In the course of applying different GAL4 lines, optogenetics and a new calcium assay to the study of fly behaviour and circadian neuronal activity, we discovered that a group of glutamatergic dorsal clock neurons (DN1s) are sleep-promoting. Previous work had shown that DN1s function as activity-promoting neurons5,13, but our results indicate an additional role: glutamatergic DN1s negatively feedback onto M and E cells and thereby promote sleep, especially during midday. Without these neurons and this feedback mechanism, the classical activity/sleep pattern of Drosophila is compromised. Our methods also show that these same clock neurons shape the sleep pattern in response to environmental change and should be widely applicable to other fly neurons and behaviours.

DN1 activity shapes the activity and sleep profiles

To monitor more precisely the movement and sleep of adult flies, we used an automated video recording assay instead of DAM (Drosophila activity monitor, Trikinetics)14,15. We also introduced the use of 96-well plates to allow other experimental manipulations (see Methods and Extended Data Fig. 1; also see ref. 16). In this format, the flies had normal bimodal locomotor activity and stable sleep–wake cycles over many light:dark days (Extended Data Fig. 1). To validate the system, we compared video recording between 96-well plates and Trikinetics tubes; the two methods produced identical patterns (for example, compare Fig. 1a right with centre).

Figure 1: Manipulation of DN1 activity affects the activity–sleep pattern.
figure 1

a, Activity and sleep data for experimental (R18H11-GAL4/UAS-TNT) and control (R18H11-GAL4/UAS-inactive TNT) male flies. The recording paradigm used (video of 96-well plates or DAM tubes) is indicated by the cartoon. Left, activity data for control (left) and experimental (right) male flies in LD. White bars indicate daytime (ZT 0–12); black bars indicate night-time (ZT 12–24). Right, sleep traces for control (blue) and experimental groups (red). The genotypes are indicated below the panel. Shading corresponds to s.e.m. n = 14 GAL4>inactive TNT and 16 GAL4>TNT. bd, Stimulation and inhibition of DN1 firing modulate the E activity peak and sleep. b, Activity record of experimental flies. The pink boxes denote the red light (637 nm) stimulation window. c, Sleep traces from the baseline day (blue) and the red LED light stimulation day (red) of experimental flies. The pink bar represents the red light illumination (stripe bar upper, 10 HZ light pulse; solid bar lower, constant light). Shading corresponds to s.e.m. d, Quantification of sleep gained and lost between the baseline day (white background) and LED stimulation day (pink background) during ZT 7–12 (LED on times) in each group. n = 19 UAS-CsChrimson/+ and UAS-eNPHR3.0/+, n = 20 R18H11>CsChrimson and 21 R18H11>eNPHR3.0. Results with shading are mean ± s.e.m. **P < 0.001 by paired t-test.

PowerPoint slide

To address the function of DN1s, we first expressed the synaptic neurotransmitter blocker tetanus toxin light chain (TNT) in male flies with the two most commonly used DN1 drivers (Clk4.1M-GAL4 and R18H11-GAL4)13,17,18,19,20. Comparing these two expression patterns confirmed that R18H11 promoter is expressed more strongly in a subgroup defined by expression of Clk4.1M (Extended Data Fig. 2; for simplicity we will refer to these cells as DN1s). Expression of the inactive toxin (Tet) did not alter wild-type behavioural profiles (data not shown).

The DN1>TNT flies (TNT expressed in the DN1s) were more active than control flies at almost all times of day, which markedly reduced the bimodal activity pattern (Fig. 1a). Blocking DN1 neurotransmitter release also strongly decreased the siesta and night-time sleep levels (Fig. 1a and Extended Data Fig. 3a, b). Interestingly, the decrease in total sleep levels of DN1>TNT flies was due to a reduction of sleep-episode duration during both the day and night; there was also a slight decrease in locomotor activity during wake (Extended Data Fig. 3a–f). As these DN1-blocked flies were still rhythmic in DD (constant darkness) (Extended Data Fig. 3g), free-running rhythmicity does not require DN1 neurotransmitter output18. The data taken together suggest that a DN1 neurotransmitter shapes the standard Drosophila light–dark locomotor activity pattern and also enhances sleep levels, a surprising result given the previous role of DN1s in enhancing morning arousal5,13,21,22.

If blocking DN1 output suppresses sleep, DN1 activation by the red-shifted channelrhodopsin CsChrimson23,24 should promote sleep and inhibit locomotor activity. To address this possibility, we combined optogenetic stimulation25 with behavioural monitoring in the 96-well plate format. The light-emitting diode (LED) stimulation (0.08 mW mm−2) was turned on between zeitgeber time (ZT) 7–24 (ZT is time in LD 12:12), to examine the effect of DN1 activation on siesta, evening peak and night-time sleep.

Red-light-mediated DN1 activation strongly and rapidly affected fly behaviour (Fig. 1b): locomotor activity was suppressed (Fig. 1b, top), and the siesta was extended (Fig. 1c, top). In contrast, the locomotor activity and sleep levels of flies without CsChrimson expression were similar to the preceding baseline days (Fig. 1d, top left). Addition of CRY-GAL80 to the R18H11-GAL4 inhibits DN1 expression (Extended Data Fig. 4a), and expression of CsChrimson with this R18H11-GAL4;CRY-GAL80 driver did not promote sleep even under much longer 24 h LED stimulation (Extended Data Fig. 4b). In addition, co-expression of TNT and CsChrimson in DN1s reduces sleep and eliminates the sleep-promoting effect of activation, further indicating that DN1s are a source of a sleep-promoting neurotransmitter (Extended Data Fig. 4b).

Importantly, DN1-activated flies have an enhanced arousal threshold as expected from the increased sleep. We assayed arousal threshold by video recording the trajectory of flies in response to a mechanical stimulus (Extended Data Fig. 5). Without LED illumination, a low stimulus (1 tap) woke up ~50% of DN1>CsChrimson flies at ZT 6 and 100% of these flies at ZT10. This indicates that they have a higher arousal threshold during siesta than during evening activity (Extended Data Fig. 5b). Significantly, red-light-mediated DN1 activation strongly reduced the percentage of DN1>CsChrimson flies aroused by the stimulus at both time points (Extended Data Fig. 5b). The enhanced quiescence was not due to a loss of locomotor ability or a comatose-like state, as a stronger stimulus (10 taps) increased the percentage of aroused flies from ~20% to ~70% (Extended Data Fig. 5b). Furthermore, DN1>TNT flies not only had a reduced arousal threshold but were also more sensitive to the low stimulus (1 tap) during siesta time (Extended Data Fig. 5b).

We extended the optogenetic approach by activating the inhibitory halorhodopsin eNpHR3.0. Because eNpHR3.0 responds to constant 630 nm red light26, we exposed flies to constant high intensity 627 nm light (1 mW mm−2) between ZT 7–24. The activity of control flies is affected by the strong illumination, with a delayed E peak but without a net effect on total sleep; this is because the illumination increased daytime sleep but reduced night-time sleep (data not shown). In contrast, illuminating the DN1>eNpHR3.0 flies extended the E activity peak throughout the whole night (Fig. 1b, bottom left) and strongly reduced sleep (Fig. 1c–d, bottom right). When the LED was turned on only during the daytime, the siesta was enhanced in control flies as expected from the above results27, but the DN1>eNpHR3.0 flies had significantly reduced siesta (Extended Data Fig. 6b). The optogenetic strategies taken together show that the DN1s have a major role in shaping the standard Drosophila light–dark locomotor activity pattern and in determining proper sleep levels.

DN1s mediate negative feedback onto core pacemakers

Given the important role of the DN1s on the E peak and sleep, we considered that the DN1s might interact with the activity-promoting core pacemakers, that is, the M and E cells10. Because optogenetically activating E cells not only causes immediate activity but also inhibits sleep (data not shown), this opposite behavioural response from activating DN1s suggests an inhibitory interaction between DN1s and these circadian neurons. As the dendritic region of the E cells and the presynaptic region of DN1s are localized to the same brain region, the interaction between these two groups might be direct (Extended Data Fig. 7).

Indeed, GRASP-labelling (GFP reconstitution across synaptic partners28) verifies that DN1s and E cells are in close proximity (Fig. 2a green, upper and middle panels). This contact occurs within the E-cell dendritic region as expected (Extended Data Fig. 7). The same GRASP strategy shows that DN1s also contact the dorsal axon region of PDF cells (Fig. 2a) as shown5,22. On the basis of previous indications that E cells promote total activity levels10, that the M cells promote morning activity18,19 and that the DN1s inhibit locomotor activity and promote sleep, these contacts may reflect inhibitory interactions between DN1s and both M and E cells

Figure 2: DN1s directly contact and reduce calcium levels in core pacemakers.
figure 2

a, GRASP assays indicate contact between E cells, M cells and DN1s in the dorsal brain. Red signal indicates the large fragment of GFP (GFP1–10) expressed in the projections of E cells. The green signal shows the contact area between E cells and DN1s. The overlay is shown in the rightmost panel. Scale bar, 50 μm. Magnified images of the boxed area are shown in the middle. Scale bar, 20 μm. The GRASP signal (green) between DN1s (magenta) and M cells is shown in the lower row. b, c, DN1s inhibit calcium levels in the core pacemakers. b, Pseudo-coloured images of GCaMP6f fluorescence intensity from representative brains before and after ATP application. c, Mean GCaMP6f response traces are plotted. The genotypes for each group are labelled below. Solid line, ATP application. n = 8 for negative control, 7 for PDF cells and 11 for dorsal lateral neurons. Results in c are mean ± s.e.m. **P < 0.001 by unpaired two-tailed Student’s t-test.

PowerPoint slide

To address this possibility, we expressed the adenosine triphosphate (ATP)-gated cation channel P2X2 in DN1s and used GCaMP6f to detect calcium changes in M and E cells after ATP addition to an in vitro brain preparations29,30. To examine more easily any inhibitory effect of DN1 activation, we performed these experiments at dawn and dusk, when M and E cells have higher neuronal activity and brighter endogenous GCaMP6f signal (unpublished data). ATP perfusion triggers a calcium increase in the DN1 region as expected from P2X2 channel expression (Fig. 2b top and Supplementary Video 1), and there was a simultaneous reduction of GCaMP6f signal in the cell bodies of M and E cells as well as in the dorsal terminal of M cells (Fig. 2b and Extended Data Fig. 8a, b). The results confirm that DN1s have an inhibitory effect on activity-promoting circadian neurons and suggest that this effect transitions flies from ‘wake’ to ‘sleep’ under circadian control.

Glutamate modulates the E peak

We next investigated how these DN1 inhibitory interactions modulate the locomotor activity and sleep profiles. Immunostaining indicates that the DN1 projections and especially those of the R18H11-GAL4-labelled subset are strongly stained by VGLUT (the vesicular glutamate transporter) antibodies31 (Supplementary Video 2). Co-staining of R18H11-LexA and VGlutMI04979-GAL4-labelled neurons confirmed that all of these DN1s are glutamatergic32 (Fig. 3a). Previous studies have shown that glutamate often functions as an inhibitory neurotransmitter in the fly central nervous system31,33 (Extended Data Fig. 8c, d). Moreover, RNA profiling of DN1s34 shows that they are enriched by more than two orders of magnitude in vglut mRNA compared to other circadian neuron subgroups (data not shown).

Figure 3: DN1s inhibit E cells via glutamate release to modulate the E peak and sleep.
figure 3

a, R18H11-driver labelled DN1s are glutamatergic. Anti-GFP (left) and anti-RFP (middle) staining was visualized in the dorsal brain of flies. Genotype is shown below. Scale bar, 20 μm. b, mGluRA mRNA levels cycle in E cells, peaking at midday. Two independent sets of 6 time points for mGluRA levels are plotted consecutively. c, Co-application of the mGluRA-specific antagonist LY 341495 with glutamate blocks the glutamate-induced inhibition. The 4 middle panels are representative GCaMP6f images of sLNvs during baseline, glutamate perfusion, wash out and glutamate plus LY 341495 perfusion (from left to right). The quantification of peak GCaMP6f changes is plotted in the two lower panels. n = 8 for left panel and n = 11 for right. **P < 0.001 by paired t-test. d, Perfusion of LY 341495 increases calcium levels within sLNvs. Mean GCaMP6f response traces are plotted. n = 11 for the experimental group and n = 7 for the negative control group. **P < 0.001 by unpaired two-tailed Student’s t-test. Results in panels are mean ± s.e.m. e, Reducing mGluRA within E cells impairs the DN1 activation effect on E peak and sleep. Left, the activity pattern of control and mGluRA RNAi flies at 21 °C and 27 °C. Right, quantification of daytime sleep changes from different groups. Box boundaries represent the first and third quartiles, and whiskers are 1.5 interquartile range. Genotypes are shown below. n = 31, 32, 32, 30 and 29 for genotypes in e, respectively. **P < 0.001 by one-way ANOVA with Tukey’s post-hoc test.

PowerPoint slide

Consistent with these indications, GCaMP6- and Arclight-mediated imaging shows that direct perfusion of glutamate significantly decreased calcium levels and hyperpolarized the membrane potential of both M and E cells (Fig. 3c and Extended Data Fig. 8c, d; E cell data are not shown). Moreover, flies co-expressing dTrpA1 and VGlut RNA interference (RNAi) constructs within the DN1s maintain a higher E activity peak at high temperature than DN1>dTrpA1 flies (Extended Data Fig. 9), further indicating that glutamate is a DN1-derived inhibitory neurotransmitter (Fig. 2b).

RNA profiling of E cells indicates that they express the metabotropic glutamate receptor mGluRA, which decreases intracellular calcium31. Moreover, purification of E cells at different circadian times34 indicates that this mRNA undergoes strong circadian oscillations with a peak around ZT 7–14 and a trough during the night (Fig. 3b). Cycling of this mRNA can explain why activation of DN1s inhibits E-cell-derived locomotor activity predominantly in the late daytime to early night and is consistent with suggestions from previous studies31,35,36. Other DN1-derived neurotransmitters or neuropeptides may be dominant at other times of day, for example, to promote morning activity at dawn13 (see Discussion).

To test further the role of mGluRA, we directly applied the mGluRA-specific inhibitor LY 341495 (700 nM) to dissected fly brains expressing GCaMP6f in circadian neurons31,33. It significantly reduced the glutamate-induced calcium decrease in core pacemakers (Fig. 3c). Baseline calcium levels of sLNvs were also modestly but significantly increased (10%) by perfusing LY 341495 (Fig. 3d), suggesting that core pacemaker is inhibited by endogenous glutamate.

An RNAi strategy was used to address the importance of mGluRA expression within circadian cells. Expression of mGluRA RNAi in M and E cells with DvPdf-GAL4 not only decreased the inhibitory effect of glutamate (Extended Data Fig. 10a) but also significantly reduced baseline sleep levels, especially the siesta (Extended Data Fig. 10b). In addition, DN1 activation by dTrpA1 increased daytime sleep and inhibited the E peak, an effect that was blunted by reducing mGluRA levels in E cells (Fig. 3e). Although the RNAi results do not prove that the mRNA cycling is significant, they support a functional glutamate-mediated inhibitory connection between DN1s and E cells. These data further indicate that the DN1s have a major influence on the locomotor activity pattern, by promoting the siesta in a temporally gated manner.

Temperature and sex regulate DN1 activity and sleep

Females have a markedly different locomotor activity and sleep pattern than males: females manifest a much less robust siesta and a less pronounced evening peak. The siesta and evening peak phenotypes are a result of more uniform female daytime activity37 (Extended Data Fig. 1a). In addition, higher temperatures increase the magnitude of the siesta, which is most apparent in females because of their reduced siesta38,39. The robust temperature-dependent increase in the siesta may be an adaptation to seasonal changes, that is, more summer-like conditions40.

To address this issue in detail, we developed a real-time neuronal activity assay of live flies in the 96-well format. A recently generated calcium-dependent transcription activator UAS-CaLexA41 and LexAop-LUC (luciferase) were expressed in DN1s, and individual flies assayed in a standard Topcount plate-reader42. LUC activity in these animals should reflect neuronal activity (via calcium levels) in the cells expressing CaLexA (calcium-dependent nuclear import of LexA). We used optogenetics as an initial test of this approach, by co-expressing the CsChrimson with CaLexA–LUC in DN1s and exposing the flies to a 10-min red light pulse; it caused a rapid and marked increase in LUC activity (Fig. 4a). We also tested the inhibitory effect of eNpHR3.0 expression in DN1s, by measuring CaLexA–LUC levels under constant strong red light illumination. The intense light significantly reduced LUC activity for hours (Extended Data Fig. 6a).

Figure 4: DN1 neuronal activity is sexually dimorphic and can be activated by warm temperatures to enhance fly sleep.
figure 4

a, Characterization of CaLexA–LUC in freely behaving animals. Left, LUC levels reflect neuronal activity in DN1s after CsChrimson stimulation (lower panel). The fold-change of luminescence was calculated as the ratio of the luminescence level after CsChrimson activation to the baseline luminescence level. The red-shaded box indicates the 10 min 627 nm light pulse. The genotypes of each line are shown below and n = 16 for each groups. Results with shading represents mean ± s.e.m. Right, CaLexA–LUC shows a marked male–female difference in DN1 activity. Averaged bioluminescence levels of 24 CLK4.1M-GAL4>CaLexA-LUC males (red) and females (grey) are plotted. Shaded background depicts dark periods. b, The real-time CaLexA–LUC assay reveals that warmer temperatures promote DN1 activity in the daytime. Black boxes indicate dark periods, white boxes indicate light periods. Flies were maintained at 21 °C and then transferred to 30 °C. Shading corresponds to s.e.m. Bioluminescence (arbitrary units); locomotor activity and daytime sleep profile are plotted (left) and quantified (right). n = 15 for each group; **P < 0.001 by paired t-test. c, Blocking DN1 output abolished warm-temperature-induced siesta in females. Sleep traces of control and experimental flies are shown on the left. Blue colour indicates data at 21 °C, and red colour indicates data at 30 °C. The box plot on right shows the sleep increase for the different groups. Box boundaries represent the first and third quartiles, whiskers are 1.5 interquartile range. n = 32 for each group and shading represent s.e.m. The genotype for each groups are labelled bellow. ** P < 0.001 by Kruskall–Wallis non-parametric one-way ANOVA with Dunn’s multiple comparisons test.

PowerPoint slide

Consistent with the difference in siesta between males and females, there is an equally notable difference in the pattern and amplitude of DN1 activity between males and females, as assayed with CaLexA–LUC (Fig. 4a). Male activity increases before light on, peaks during the morning and then declines to a trough in the evening. These patterns and their sexual dimorphism are DN1 specific: CaLexA–LUC male and female patterns from other neurons are completely different, for example, from neurons associated with the ellipsoid body or the ventral fan-shaped body (data not shown). The much higher morning and midday DN1 activity of males probably contributes to their more robust morning anticipation and siesta13,18,19.

To further probe the relationship of DN1 activity to the siesta, we assayed the response of female DN1 activity to temperature with CaLexA–LUC. There is a marked increase in luciferase activity in the middle of the day at 30 °C compared to 21 °C (Fig. 4b top), which coincides with a prominent temperature-mediated increase in the female siesta and decrease in daytime activity (Fig. 4b middle and bottom). CaLexA–LUC expression in other non-circadian neurons displayed reduced overall activity with the same temperature increase (data not shown), indicating that the DN1 temperature response is specific. To show that DN1 output is necessary for the temperature-dependent siesta increase, we expressed TNT in DN1s and observed little daily sleep increase at 30 °C (Fig. 4c). We therefore suggest that temperature enhances DN1 firing, which promotes the siesta. The data taken together indicate that the DN1s promote the siesta and sleep more generally in a clock-, temperature- and sex-dependent manner.

Conclusions

Although DN1s are activated by M cells5,22, our data indicate that there is inhibitory feedback by the DN1s onto M and E cells later in the day to promote the siesta and night-time sleep (Extended Data Fig. 10c). This feedback at the level of neuronal circuitry parallels and even exploits the transcriptional negative feedback loop that governs intracellular circadian rhythmicity, to time the siesta and maintain a robust sleep–activity pattern43,44.

Another group activated the same R18H11-GAL4-labelled DN1s and emphasized the wake-promoting effects of DN1 before dawn13. However, a positive effect on the midday siesta as well as inhibition of the subsequent E peak as reported here is also evident in their data (not commented on, but in figure 4 of ref. 13). As there is strong evidence that the DN1 firing rate is maximal around the morning in light:dark13,21, the strong and unanticipated sleep effects of TNT expression (Fig. 1a) and of channelrhodopsin activation (Fig. 1b) are discordant with the morning peak of these DN1 firing rates. (There is no evidence of heterogeneity in the male DN1 electrophysiological data21, and the CaLexA–LUC activity patterns are weaker but qualitatively similar with the R18H11-GAL4 driver (data not shown).) This discrepancy implicates cycling signalling molecules (for example, Fig. 3b) in this expansion of the DN1 behavioural repertoire. Moreover, we speculate that the cycling of these same signalling molecules contributes to the delay required for an effective negative feedback circuit (Extended Data Fig. 10c).

The CaLexA assay indicated that DN1 neuronal activity is sexually dimorphic (see below) as well as temperature sensitive. This second feature parallels the known positive effect of temperature on daytime sleep and may reflect a temperature sensor within DN1s or elsewhere within the brain; the adjacent DN2s are good candidates45. The siesta increase with temperature may also be related to temperature-sensitive splicing of the period (per) gene38,39. per splicing may even occur within DN1s and cause enhanced neuronal activity.

Video monitoring of behaviour in a 96-well format is standard in the zebrafish community46, and its value for fly-sleep monitoring has been noted elsewhere14,15. Although our video results are generally very similar to the activity and sleep profiles from DAM boards, small movements away from the DAM board infrared beam are only detected by video recording and affect the night-time sleep results in the TNT experiments (Fig. 1a).

The CaLexA–LUC assay may be superior for many purposes to recording neuronal activity using other methods, for example electrophysiology or calcium imaging. Indeed, our results indicate substantial differences from dissected brains as well as from calcium imaging of tethered flies21,47, suggesting that the wake-behaving format is relevant to circadian neuron firing patterns.

This assay also indicates a marked difference between male and female DN1s. To our knowledge, this is the first indication of sexual dimorphism in the fly circadian system. Although we do not know how the CaLexA–LUC signal translates into precise calcium levels or firing rates, the low daytime activity of female DN1s is probably relevant to their relatively weak siesta and morning activity; their high night-time activity suggests a contribution to female-specific night-time tasks. We suggest that this CaLexA–LUC assay and our methods more generally will be amenable to the study of other neuronal circuits and behaviours in freely behaving flies and in other organisms.

Methods

Data reporting

No statistical methods were used to determine sample size. The experiments were not randomized and the investigators were not blinded during experiments and outcome assessment.

Fly strains

DvPdf-GAL4 was provided by J. H. Park; Clk4.1M-GAL4 was from P. Hardin; UAS-dTrpA1 (2nd) was from P. Garrity; UAS-CaLexA was from J. Wang41; UAS-TNT and UAS-Tet were from H. Amrein; Pdf-GAL80 and CRY-GAL80 are described by Stoleru et al.12; LexA-P2X2 and Clk856-GAL4 were from O. Shafer11,29. UAS-CD4::spGFP1-10 and LexAop-CD4::spGFP11 were from K. Scott; Clk4.1M-lexA was from A. Sehgal5, LexAop-LUC was generated by X. Gao and L. Luo48. LexAop-dTrpA1 was from G. M. Rubin. UAS-VGLUT RNAi 1 (VDRC 104324), UAS-mGluRA RNAi 1 (VDRC 103736), UAS-mGluRA RNAi 2 (VDRC 1793) were from the Vienna Drosophila Resource Center (VDRC). The following lines were ordered from the Bloomington Stock Center: Pdfr (R18H11)-GAL4 (48832), Pdfr (R18H11)-LexA (52535),UAS-CsChrimson (55136), UAS-eNPHR3.0 (36350), UAS-Denmark (33064), UAS-ArcLight (51056), UAS-GCaMP6f (42747),UAS-syt-GFP (33064), UAS-VGLUT RNAi 2 (40845, 40927), VGlutMI04979-GAL4 (60312). Flies were reared on standard cornmeal/agar medium supplemented with yeast. The adult flies were entrained in 12:12 light-dark cycles at 25 °C. The flies carrying GAL4 and UAS-dTrpA1 were maintained at 21 °C to inhibit dTrpA1 activity.

Locomotor activity

Locomotor activity of individual male flies (aged 3–7 days) was measured with Trikinetics Drosophila Activity Monitors or video recording system under 12:12 light:dark conditions. The activity and sleep analysis was performed with a signal-processing toolbox implemented in MATLAB (MathWorks). Group activity was also generated and analysed with MATLAB. For dTrpA1-induced neuronal firing experiments (Fig. 3 and Extended Data Fig. 9), flies were entrained in light:dark for 3–4 days at 21 °C, transferred to 27 °C for two days, followed by 2 subsequent days at 21 °C. The evening activity index (Extended Data Fig. 9) was calculated by dividing the average activity from ZT8–12 by the average activity from ZT 0–12. The behaviour experiments involving RNAi expression (Extended Data Fig. 10b) were done at 27 °C to enhance knockdown efficiency.

Statistical analyses

All statistical analyses were conducted using IBM SPSS software. The sample size was chosen based on the pilot studies to ensure >80% statistical power to detect significant difference between different groups. Animals within the same genotype were randomly allocated to experimental groups and then processed. We were not blind to the group allocation as the experimental design required specific genotypes for experimental and control groups. However, the data analyser was blinded when assessing the outcome. The Wilks–Shapiro test was used to determine normality of data. Normally distributed data were analysed with two-tailed, unpaired Student’s t-tests, one-way analysis of variance (ANOVA) followed by a Tukey–Kramer HSD test as the post-hoc test or two-way analysis of variance (ANOVA) with post-hoc Bonferroni multiple comparisons. Nonparametrically distributed data were assessed using the Kruskal–Wallis test. Data were presented as mean behavioural responses, and error bars represent the standard error of the mean (s.e.m.). Differences between groups were considered significant if the probability of error was less than 0.05 (P < 0.05). Experiments were repeated at least three times and representative data was shown in figures.

Arousal thresholds assay

For mechanical stimulation, individual flies from different groups were loaded into 96-well plates and placed close to a small push–pull solenoid. The tap frequency of the solenoid was directly driven by an Arduino UNO board (Smart Projects). One tap was used as a modest stimulus and ten taps (1 Hz) was used as a strong stimulus. Arousal threshold was measured during the middle of the day (ZT6) and evening (ZT10) with different intensities. The movement of flies before and after the stimulus was monitored by the web camera and the recording videos (1fps) were processed by the MTrack2 plugin in Fiji ImageJ software to convert the videos into binary images and to calculate the trajectory and moving area as well as the percentage of aroused flies.

Feeding of retinal

All trans-retinal (ATR) powder (Sigma) was dissolved in alcohol to prepare a 100 mM stock solution for CsChrimson experiments23. 100 μl of this stock solution was diluted in 25 ml of 5% sucrose and 1% agar medium to prepare 400 μM of ATR food. Newly eclosed flies were transferred to ATR food for at least 2 days before optogenetic experiments.

Optogenetics and video recording system

The behavioural setup for the optogenetics and video recording system is schematized in Supplementary Fig. 1. Briefly, flies were loaded into white 96-well Microfluor 2 plates (Fisher) containing 5% sucrose and 1% agar food with or without 400 μM ATR. Back lighting for night vision was supplied by an 850 nm LED board (LUXEON) located under the plate. Two sets of high power LEDs (627 nm) mounted on heat sinks (four LEDs per heat sink) were symmetrically placed above the plate to provide light stimulation. The angle and height of the LEDs were adjusted to ensure uniform illumination. The voltage and frequency of red light pulses were controlled by an Arduino UNO board (Smart Projects). The whole circuit is described in ref. 25. The flat surface and compact wells of the 96-well plate allow uniform illumination, which was difficult to achieve in Trikinetics tubes. We used 627 nm red light pulses at 10 Hz (0.08 mW mm−2) to irradiate flies expressing the red-shifted channelrhodopsin CsChrimson within the DN1s23. (The CsChrimson illumination protocol had no effect on halorhodopsin eNpHR3.0). Fly behaviour was recorded by a web camera (Logistic C910) without an infrared filter. We used time-lapse software to capture snapshots at 10 s intervals. The light:dark cycle and temperature was controlled by the incubator, and the light intensity was maintained in a region that allowed entrainment of flies without activating CsChrimson. Fly movement was calculated by Pysolo software and transformed into a MATLAB readable file14. 5 pixels per second (50% of the Full Body Length) was defined as a minimum movement threshold15,16. The activity and sleep analyses were performed with a signal-processing toolbox implemented in MATLAB (MathWorks) as described above. The design of the invention has been filed for patent.

In vivo luciferase assays

To monitor bioluminescence activity in living flies, we used previously described protocols49. White 96-well Microfluor 2 plates (Fisher) were loaded with 5% sucrose and 1% agar food containing 20 mM d-luciferin potassium salt (GOLDBIO). 250 μl of food was added to each well. Individual male or female flies expressing CaLexA–LUC were first anaesthetized with CO2 and then transferred to the wells. We used an adhesive transparent seal (TopSeal-A PLUS, Perkin Elmer) to cover the plate and poked 2–3 holes in the seal over each well for air exchange. Plates were loaded into the stacker of a TopCount NXT luminescence counter (Perkin Elmer). Assays were carried out in an incubator under light:dark conditions. Luminescence counts were collected for 5–7 days. For temperature shift experiments (Fig. 4b), the incubator temperature was set to 21 °C for 3 days and then increased to 30 °C at ZT 0 of the 4th day. Other experiments were performed at 25 °C. Three different modes were used in our experiments: (1) To record CaLexA–LUC activity only, 9 plates were placed in a stacker, and each plate was sequentially transferred to the TopCount machine for luminescence reading. Every cycle took about 1 h, and the recording was continued for several days. (2) To combine optogenetic stimulation with the luciferase assays (Fig. 4a and Extended Data Fig. 6a), we replaced the stacker with a chamber of our own design (Fig. 4a). 627 nm LEDs mounted to a pair of heat sinks were symmetrically positioned in the chamber to ensure uniform illumination of the 96-well plate (0.08 mW mm−2 for CsChrimson stimulation and 1 mW mm−2 for eNPHR3.0 stimulation). Flies pre-fed with ATR were loaded into a plate. Single plates stayed in the LED chamber for 8 min and then automatically transferred to the TopCount for luminescence reading for 2 min. (3) To assay fly movement in 96-well plates and CaLexA–LUC activity at the same time, single plates were recorded using a web camera attached to the top of chamber (Fig. 4a). During each hour, the plate sat in the video chamber for 58 min and then was automatically transferred to the TopCount machine for a 2 min luminescence reading. The raw data were analysed in MATLAB and in Microsoft Excel. All experiments were repeated at least three times.

Fly brain immunocytochemistry

Immunostaining was performed as described50. Fly heads were removed and fixed in PBS with 4% paraformaldehyde and 0.008% Triton X-100 for 45–50 min at 4 °C. Fixed heads were washed in PBS with 0.5% Triton X-100 and dissected in PBS. The brains were blocked in 10% goat serum (Jackson Immunoresearch) and subsequently incubated with primary antibodies at 4 °C overnight or longer. For VGLUT and GFP co-staining, a rabbit anti-DVGlut (1:10,000) and a mouse anti-GFP antibody (Invitrogen; 1:1,000) antibody were used as primary antibodies. For GRASP staining, a mouse anti-GFP monoclonal antibody (Invitrogen; 1:1,000) and a rabbit anti-GFP antibody (Roche; 1:200) were used. After washing with 0.5% PBST three times, the brains were incubated with Alexa Fluor 633 conjugated anti-rabbit and Alexa Fluor 488 conjugated anti-mouse (Molecular Probes) at 1:500 dilution. The brains were washed three more times before being mounted in Vectashield Mounting Medium (Vector Laboratories) and viewed sequentially in 1.1 μm sections on a Leica SP5 confocal microscope. To compare the fluorescence signals from different conditions, the laser intensity and other settings were set at the same level during each experiment. Fluorescence signals were quantified by ImageJ as described.

mRNA profiling from E cells and DN1s

mRNA profiling from E cells and DN1s was performed as previously described34. DN1s and E cells were purified from Clk4.1M-GAL4, UAS-EGFP flies (DN1s) and Dv-Pdf-GAL4, UAS-EGFP, PDF-RFP flies, (E cells; GFP+RFP cells), respectively. Flies were entrained for 3 days and then collected every 4 h for a total of six time points. Two replicates of six time points were performed for each cell type. Sequencing data were aligned to the Drosophila genome using TopHat51. Gene expression was quantified using the End Sequencing Analysis Toolkit (ESAT; publicly available at http://garberlab.umassmed.edu/software/esat/). ESAT quantifies gene expression only using information from the 3′-end of the genes.

Functional fluorescence imaging

Imaging experiments were performed as previous described52. Adult male fly brains were dissected in ice-cold haemolymph-like saline (AHL) (108 mM NaCl, 5 mM KCl, 2 mM CaCl2, 8.2 mM MgCl2, 4 mM NaHCO3, 1 mM NaH2PO4-H2O, 5 mM trehalose, 10 mM sucrose, 5 mM HEPES; pH 7.5). Brains were then pinned to a layer of Sylgard (Dow Corning) silicone under a small bath of AHL contained within a recording/perfusion chamber (Warner Instruments) and bathed with room temperature AHL. Brains expressing GCaMP6f and Arclight were exposed to fluorescent light for approximately 30 s before imaging to allow for baseline fluorescence stabilization. Perfusion flow was established over the brain with a gravity-fed ValveLink perfusion system (Automate Scientific). ATP or glutamate was delivered by switching the perfusion flow from the main AHL line to another channel containing diluted compound after 30 s of baseline recording for the desired durations followed by a return to AHL flow. For the mGluRA antagonist imaging experiments, 700 nM LY341495 (Tocris Bioscience) was used to block the glutamate-induced inhibition. Imaging was performed using an Olympus BX51WI fluorescence microscope (Olympus) under an Olympus ×40 (0.80 W, LUMPlanFl) or ×60 (0.90W, LUMPlanFI) water-immersion objective, and all recordings were captured using a charge-coupled device camera (Hamamatsu ORCA C472-80-12AG). For GCaMP6f and Arclight imaging, the following filter sets were used (Chroma Technology): excitation, HQ470/×40; dichroic, Q495LP; emission, HQ525/50 m. Frames were captured at 2 Hz with 4 × binning for either 2 min or 4 min using μManager acquisition software52. Neutral density filters (Chroma Technology) were used for all experiments to reduce light intensity and to limit photobleaching.

For recordings using GCaMP6f and Arclight, ROIs were analysed using custom software developed in ImageJ52 and National Institute of Health. The fluorescence change was calculated by using the formula: ΔF/F = (Fn – F0)/F0 × 100%, where Fn is the fluorescence at time point n, and F0 is the fluorescence at time 0. The fluorescence was calibrated by subtracting the background fluorescence value. To compare the fluorescence change between neurons in the same brain, fluorescence activities from different neurons were normalized to the highest fluorescence level during the recording time window.