{'fraction_non_alphanumeric': 0.04714480557914511, 'fraction_numerical': 0.0330940065364523, 'mean_word_length': 4.555396711937098, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A genetically encoded sensor for measuring serotonin dynamics

Serotonin (5-HT) is a phylogenetically conserved monoamine neurotransmitter modulating important processes in the brain. To directly visualize the release of 5-HT, we developed a genetically encoded GPCR-Activation-Based 5-HT (GRAB5-HT) sensor with high sensitivity, selectivity, subsecond kinetics, and subcellular resolution. GRAB5-HT detects 5-HT release in multiple physiological and pathological conditions in both flies and mice, and provides new insights into the dynamics and mechanisms of 5-HT signaling.


Introduction
Serotonergic signaling in the brain plays a critical role in a wide range of physiological processes, including mood control, reward processing, and sleep-wake homeostatic regulation [1][2][3] . Indeed, drugs targeting central serotonergic activity have been used to treat virtually every psychiatric disorder, with the best example being the use of selective serotonin reuptake inhibitors (SSRIs) for depression 4 . Yet, despite the importance of 5-HT, our understanding of cell-specific 5-HT signaling during behaviors is very much lacking, in part due to our inability to measure 5-HT in vivo with high sensitivity and spatiotemporal resolution 5,6,7 . Here, using molecular engineering, we developed a genetically encoded fluorescent sensor for directly measuring extracellular 5-HT.

Development and characterization of the GRAB 5-HT1.0 in cultured cells
Previously, we and others have independently developed GPCR activation based (GRAB) sensors for detecting different neurotransmitters by converting the conformational change in the respective GPCR to a sensitive fluorescence change in the circular permutated GFP (cpGFP) 8,9,10,11 . Using a similar strategy, we initiated the engineering of 5-HT-specific sensors by inserting a cpGFP into the third intracellular loop (ICL3) of various 5-HT receptors. Based on the performance of membrane trafficking and affinity of receptor cpGFP chimeras, we selected the 5-HT2C receptor-based chimera for further optimization (Extended Data Fig. 1a,b). Our previous experience in optimizing GRAB sensors 8,10,11 shows that the N-and C-terminus linkers between GPCR and cpGFP are critical for the sensor's performance. Therefore, we randomly mutated 5-sites in both the N-term and C-term linkers between 5-HT2C receptor and cpGFP to improve the 5-HT sensor's response. Moreover, we introduced mutations into the cpGFP, focusing on sites that are potentially critical for fast GFP folding and high brightness 12,13 (Extended Data Fig. 2). Mutagenesis and screening in the linker regions and cpGFP moiety resulted in a sensor with a 250% fluorescence change (ΔF/F 0 ) in response to 5-HT in cultured HEK293T cells, which we named GRAB 5-HT1.0 (referred to hereafter as simplified 5-HT1.0; Fig. 1a and Extended Data Fig. 3). In addition, we generated a 5-HT-insensitive version of this sensor by introducing D134 3.32 Q mutation into the receptor 14,15 , GRAB 5-HTmut (referred to hereafter as 5-HTmut; Fig. 1 and Extended Data Fig. 4). This mutant sensor showed similar membrane trafficking as 5-HT1.0 (Extended Data Fig. 4a and Extended Data Fig. 4n), but <2% ΔF/F 0 even in the presence of 100 μM 5-HT ( Fig. 1a and Extended Data Fig. 4a-d).
In cultured rat cortical neurons, the 5-HT1.0 sensor produced a robust fluorescence increase (280% ΔF/F 0 ) in both the soma and neurites in response to 5-HT bath application, whereas the 5-HTmut sensor had no measurable change in fluorescence (Fig. 1b).
Next, we characterized the properties of the 5-HT1.0 sensor in detail. Specifically, we measured the brightness, photostability, the dose-response curve, response kinetics, signal specificity, and downstream coupling of this sensor. We found that the 5-HT1.0 had similar brightness and better photostability compared to EGFP in the presence of 5-HT (Extended Data Fig. 4e-g). Regarding the sensor's kinetics, the τ on and τ off values were around 0.2 s and 3.1 s, respectively, as measured by applying 5-HT (to measure the on-rate, τ on ) followed by the 5-HT receptor antagonist metergoline (Met, to measure the off-rate, τ off ) in cultured HEK293T cells (Fig. 1c). In addition, the 5-HT1.0 was highly sensitive to 5-HT, with a half-maximal effective concentration (EC 50 ) of 22 nM (Fig.  1e). None of the other neurotransmitters and neuromodulators tested elicited a detectable fluorescence change. Importantly, the 5-HT-induced signal was eliminated by the specific 5-HT2C receptor antagonist SB 242084 (SB) (Fig. 1d and Extended Data Fig. 4o,p), indicating a high specificity to 5-HT. Moreover, unlike the native 5-HT2C receptor, which couples to the intracellular G-protein and β-arrestin signaling pathways, the 5-HT1.0 sensor showed no detectable coupling to either of these two pathways, as measured by calcium imaging, cAMP imaging 16 , G-protein-dependent luciferase complementation assay 17 , TANGO assay 18 , and long-term measurements of membrane fluorescence in the presence of 5-HT (Fig. 1f,g and Extended Data Fig. 4h-l). Additionally, the expression of 5-HT1.0 did not alter the 5-HT2C receptor coupling with the G protein (Extended Data Fig. 4m), indicating the 5-HT1.0 has little effect on the activation of the wild-type 5-HT2C receptor.
Detecting 5-HT release in mouse brain slices and Drosophila with the GRAB 5-HT1.0 Having validated the sensor in cultured cells, to see whether 5-HT1.0 could function well in the mouse brain slices, we expressed 5-HT1.0 using adeno-associated virus (AAV) in the mouse hippocampus, which receives innervation from the serotonergic neurons. The 5-HT1.0 sensor showed more than 100% fluorescence increase to exogenously applied 5-HT in individual somata and neurites (Extended Data Fig. 5a-d). Besides, we also expressed either 5-HT1.0 or 5-HTmut in the mouse dorsal raphe nucleus (DRN) by AAVs (Fig. 2a). Dorsal raphe nucleus (DRN) is the largest serotonergic nucleus in the brain, and provides extensive projections to various brain regions 19 . In DRN slices expressing 5-HT1.0, a single electrical pulse evoked detectable fluorescence increases, and the response progressively enhanced with the increase in pulse number or frequency (Fig. 2b,c and Extended Data Fig. 5e). The stimulation evoked-response was repeatable for up to 25 min (Extended Data Fig. 5f) and blocked by the 5-HT receptor antagonist Met, but not the dopamine receptor antagonist haloperidol (Halo; Fig. 2d and Extended Data Fig. 5g,h). In contrast, the same electrical stimuli did not affect fluorescence in DRN expressing the 5-HTmut sensor (Fig. 2b,d). We also measured the kinetics of the fluorescence change in response to 100 ms electrical stimulation and found τ on and τ off values of approximately 0.15 s and 7.22 s (Fig. 2e). We further compared the 5-HT1.0 sensor with existing fast-scan cyclic voltammetry (FSCV) in recording 5-HT by simultaneously conducting fluorescence imaging and electrochemical recording in DRN slices (Fig. 2f). Both methods could sensitively detect the single pulse-evoked 5-HT signal and the increase of response following incremental frequencies ( Fig. 2g and Extended Data Fig. 5i,j). The 5-HT1.0 showed better signal-to-noise ratio (SNR) compared with FSCV (Fig. 2g). Taken together, these results showed that the 5-HT1.0 has the ability to measure the electrically induced endogenous 5-HT release ex vivo.
We next tested whether the 5-HT1.0 sensor could be used to measure sensory-relevant changes in 5-HT signaling in vivo. To this end, we first used the Drosophila model, as neurons that innervate Kenyon cells (KCs) in the mushroom body (MB) per hemisphere 20,21 and serotonergic signaling in the MB has been implicated in odor-related memory consolidation 22 . We expressed the 5-HT1.0 sensor in the KCs and found that the sensor reliably reported 5-HT release evoked by electrical stimulation of the horizontal lobe of MB with rapid on and off kinetics of ~0.07 s and ~4.08 s, respectively. Moreover, the signal was blocked by applying Met (Fig. 2h-j and Extended Data Fig. 6a-c). To see whether the sensor could report the physiological relevant 5-HT release from a single cell, we directly expressed the 5-HT1.0 sensor either in the single presynaptic serotonergic DPM neuron or the postsynaptic KCs. Consistent with the previous calcium imaging study in the DPM 23 , the 5-HT1.0 sensor in either DPM or KCs could report the 5-HT release in the MB β' lobe in response to odor application or body shock ( Fig. 2k-q, Extended Data Fig. 6d-i, and Supplementary Video 1). In contrast, no fluorescence change was detected in flies expressing the 5-HTmut sensor (Extended Data Fig. 6d-i, and Supplementary Video 1). Neither odor application nor body shock produced a saturated response of the 5-HT1.0 sensor, as the application of exogenous 100 μM 5-HT in the same flies elicited much larger responses (Extended Data Fig. 6d-i). When we co-expressed the 5-HT1.0 sensor together with a red fluorescent Calcium sensor jRCaMP1a in KCs, two-color imaging showed that the odorant application increased both the 5-HT1.0-mediated green 5-HT fluorescence and the jRCaMP1a-mediated red Calcium fluorescence responses ( Fig. 2r-t). Moreover, jRCaMP1a-expressing flies with or without co-expression of 5-HT1.0 had similar odorant-evoked Calcium signals, suggesting little effect of the 5-HT1.0 sensor expression on neuronal Calcium activities (Fig. 2r-t and Extended Data Fig. 6j,k).

Monitoring endogenous 5-HT dynamics in mice in vivo
Following this, we examined whether the 5-HT1.0 sensor could measure the dynamics of serotonergic activity under physiological conditions in mice, such as during the sleep-wake cycle. The basal forebrain (BF), orbital frontal cortex (OFC), and the bed nucleus of the stria terminalis (BNST) not only participate in the regulation of sleep and wake cycles but also receive extensive DRN serotonergic projections 24,25 . Hence, we expressed the 5-HT1.0 sensor in these several brain regions, and then performed simultaneous fiber-photometry and EEG/EMG recordings in freely behaving mice. The BF 5-HT1.0 sensor signal was generally higher during wake than that during sleep. Between rapid-eye-movement (REM) sleep and non-REM (NREM) sleep, the signal is lower during REM sleep, consistent with previous findings 26 (Fig. 3a-c). As expected, we found no substantial change in fluorescence in mice expressing the 5-HTmut sensor during the sleep-wake cycle. Interestingly, simultaneous recordings of 5-HT1.0 in OFC and BNST revealed a tight correlation in fluorescence during NREM sleep (Fig. 3d,e), suggesting global synchrony of the 5-HT signaling despite the region-specific innervation by different subpopulations of the serotonergic neurons in DRN 25,27 . Lastly, consistent with our previous findings, we found that treating mice with the 5-HT receptor antagonist Met largely blocked the fluorescence change of the 5-HT1.0 sensor (Fig. 3f, g), validating the specificity of measured signals in vivo.
Finally, to see whether the sensor can reveal the action of psychostimulant drugs, we used the Methylenedioxymethamphetamine (MDMA), which is a synthetically addictive compound that can alter mood and perception, and its effects have been partially attributed to an increase in extracellular 5-HT concentrations in the brain 28 . We examined MDMA's effect in vivo by two-photon imaging in mice expressing the sensor in the prefrontal cortex (PFC), a higher cognitive region that receives abundant serotonergic innervation 29 . Intraperitoneal (i.p.) injection of MDMA caused a gradual increase in 5-HT1.0 fluorescence, which peaked after 1 hour and then gradually decayed over the following 3 hours (Fig.  3h-k). The time course is comparable with that of the MDMA's psychostimulation effects in both human 30 and mouse 31 . Meanwhile, MDMA had no effect on the fluorescence of the 5-HTmut sensor (Fig. 3h-k). These results together suggest that the 5-HT1.0 sensor is suitable for stable and long-term imaging in vivo.

Discussion
In summary, we report the development and application of a novel genetically encoded fluorescent GRAB sensor for measuring extracellular 5-HT dynamics. The newly developed GRAB 5-HT1.0 sensor shows a high affinity to 5-HT (EC 50 ~22 nM), relatively fast on kinetics (τ on ~70 ms), high specificity and spatial resolution, and minimal impact on cellular physiology and thus is well suited for detecting physiologically relevant endogenous 5-HT release. Indeed, we demonstrated the utility of the GRAB 5-HT1.0 sensor in detecting endogenous 5-HT release in response to a variety of stimuli and under various behavioral conditions in different animal models. Our finding that 5-HT changes dynamically throughout the sleep-wake cycle in mice provides new insights into the functional contribution of 5-HT in sleep regulation.
Regarding the potential buffering by the 5-HT1.0 sensor, we measured the G-protein coupling by exogenously applied 5-HT with a broad range of concentrations in the 5-HT2C and 5-HT2C+5-HT1.0 group in cultured cells and did not observe a significant difference of the 5-HT2C receptor mediated G-protein signaling between these two groups. In addition, the Drosophila in vivo imaging data also showed that the expression of 5-HT1.0 has little effect on the odor-evoked neuronal calcium signals. Nevertheless, one still need to be mindful about the buffering effect of the 5-HT1.0 sensor, especially under the conditions where the local 5-HT concentration is very low or the expression level of 5-HT1.0 is very high. One way to ameliorate the buffering effect is to balance the expression level and the photon (signal) generated from the 5-HT1.0 sensor. Future efforts could be applied to tune the sensor's affinity while improving its brightness and ΔF/F 0 .
Of note, there is a tradeoff between a sensor's affinity and off kinetics. Given the high affinity of 5-HT1.0 sensor, it inevitably shows a slightly slow off kinetics. These kinetic features could be beneficial as the rapid on kinetics reports the initial timing of the endogenous 5-HT release precisely (e.g., in local synaptic transmission) while the slow off kinetics is helpful to accumulate more photons and contribute to the high SNR. Nevertheless, to fully capture the dynamics of the fast endogenous serotonergic signaling awaits future improvement of better sensors with both fast on and off kinetics.

Cell lines
HEK293T cells were purchased from ATCC and verified based on their morphology under microscopy and an analysis of their growth curve. Stable cell lines expressing either 5-HT2C receptor or 5-HT1.0 were generated by co-transfecting cells with the PiggyBac plasmid carrying the target genes together with Tn5 transposase into a stable HEK293T cell line. Cells expressing the target genes were selected using 2 μg/ml Puromycin (Sigma). A HEK293 cell line stably expressing a tTA-dependent luciferase reporter and the β-arrestin2 TEV fusion gene used in the TANGO assay was a generous gift from Bryan L. Roth 33 . All cell lines were cultured at 37°C in 5% CO 2 in DMEM (GIBCO) supplemented with 10% (v/v) fetal bovine serum (GIBCO) and 1% penicillin-streptomycin (GIBCO).

Mouse
Wild-type male and female C57BL/6 (P25-60) mice were used to prepare the acute brain slices and for the in vivo mouse experiments. All mice were group-housed in a temperature controlled room (21.5 degree centigrade) with a 12h/12h light/dark cycle, with a humidity controlled as 55%, provided with food and water ad libitum. All procedures for animal surgery and maintenance were performed using protocols that were approved by the Animal Care & Use Committees at Peking University, the Chinese Academy of Sciences, University of Virginia, and were performed following the guidelines established by the US National Institutes of Health.

Molecular biology
Plasmids were generated using the Gibson assembly method 36 , and DNA fragments were amplified by PCR using primers (Thermo Fisher Scientific) with 25-30 bp overlap. DNA fragments were assembled using T5-exonuclease (New England Biolabs), Phusion DNA polymerase (Thermo Fisher Scientific), and Taq ligase (iCloning). Sanger sequencing was performed at the Sequencing Platform in the School of Life Sciences of Peking University to verify plasmid sequences. cDNAs encoding various 5-HT receptors (HTR1E, HTR2C, HTR5A, and HTR6) were generated using PCR amplification of the full-length human GPCR cDNA library (hORFeome database 8.1). For optimizing the 5-HT sensor, cDNAs encoding the candidates in step 1 and step 2 were cloned into the pDisplay vector (Invitrogen) with an IgK leader sequence in the sensor upstream. In step 3, in addition to upstream IgK peptide, the IRES-mCherry-CAAX cascade was fused downstream of the sensor to calibrate the membrane signal. For optimizing the linker sequence and cpGFP, site-directed mutagenesis was performed using primers containing NNB codons (48 codons, encoding 20 possible amino acids). For characterization in cultured rat cortical neurons, GRAB 5-HT1.0 and GRAB 5-HTmut were cloned into the pAAV vector under the hSyn, TRE, or CAG promoter. In downstream coupling experiments, the GRAB 5-HT sensor and the 5-HT2C receptor were cloned into the pTango and pPiggyBac vectors, respectively. Two mutations were introduced into pCS7-PiggyBAC to generate hyperactive piggyBac transposase (ViewSolid Biotech) 37 . The GRAB 5-HT1.0 -SmBit and 5-HT2C-SmBit constructs were derived from β2AR-SmBit 17 using a BamHI site incorporated upstream of the GGSG linker. LgBit-mGq was a generous gift from Nevin A. Lambert.

Fluorescence imaging of HEK293T cells and cultured rat cortical neurons
An inverted Ti-E A1 confocal microscope (Nikon) and an Opera Phenix high-content screening system (PerkinElmer) were used for imaging. The confocal microscope was equipped with a 40x/1.35 NA oil-immersion objective, a 488-nm laser, and a 561-nm laser. The GFP signal was collected using a 525/50-nm emission filter, and the RFP signal was collected using a 595/50-nm emission filter. Cultured cells expressing GRAB 5-HT1.0 or GRAB 5-HTmut were either bathed or perfused with Tyrode's solution containing (in mM): 150 NaCl, 4 KCl, 2 MgCl 2 , 2 CaCl 2 , 10 HEPES, and 10 glucose (pH 7.4). Drugs were delivered via a custom-made perfusion system or bath application. The chamber was cleaned thoroughly between experiments using 75% ethanol. Photostability was measured using confocal microscopy (1-photon illumination) with the 488-nm laser at a laser power of 350 μW, and the Opera Phenix high-content screening system was equipped with a 40x/1.1 NA water-immersion objective, a 488-nm laser, and a 561-nm laser; the GFP signal was collected using a 525/50-nm emission filter, and the RFP signal was collected with a 600/30-nm emission filter. For imaging, the culture medium was replaced with 100 μl of Tyrode's solution, and drugs (at various concentrations) were applied in Tyrode's solution. The fluorescence signal of the GRAB 5-HT sensors was calibrated using the GFP/RFP ratio. In order to measure the response kinetics of the 5-HT1.0 sensor, the line scanning mode of confocal was used to record the rapid fluorescence changes. A glass pipette filled with 10 μM 5-HT or Met placed near the 5-HT1.0 sensor expressing HEK293T cells. 5-HT or Met was puffed by the pipette to measure the on and off response kinetics, respectively. For calculating the on and off kinetics, different F 0 was used. In detail, we used the basal fluorescent intensity before 5-HT applications as F 0 when calculating the "on" response; while, when calculating the "off" response, we used the fluorescence intensity of 5-HT1.0 under saturating 5-HT (10 μM) as F 0 .

TANGO assay
5-HT at various concentrations was applied to 5-HT2C-expressing or 5-HT1.0-expressing HTLA cells 33 . The cells were then cultured for 12 h to allow expression of firefly luciferase (Fluc). Bright-Glo reagent (Fluc Luciferase Assay System, Promega) was then added to a final concentration of 5 μM, and luminescence was measured using a Victor X5 multilabel plate reader (PerkinElmer).

Luciferase complementation assay
The luciferase complementation assay was performed as previously described 17 . In brief, 48 h after transfection, cells were washed with PBS, harvested by trituration, and transferred to opaque 96-well plates containing 5-HT at various concentrations. Furimazine (NanoLuc Luciferase Assay, Promega) was then added quickly to each well, followed by measurement with Nluc.

Fluorescence imaging of GRAB 5-HT in mouse brain slices
AAVs or Sindbis virus expressing GRAB 5-HT1.0 or GRAB 5-HTmut were injected into the mouse hippocampus or DRN as described above. Three weeks after AAV injection or 18 hours after Sindbis virus injection, mice were deeply anesthetized by an i.p. injection of Avertin or xylazine-ketamine and then transcardially perfused with 10 ml oxygenated slicing buffer consisting of (in mM): 110 choline-Cl, 2.5 KCl, 1 NaH 2 PO 4 , 25 NaHCO 3 , 7 MgCl 2 , 25 glucose, and 0.5 CaCl 2 . Mice were then decapitated, and brains were removed and placed in cold (0-4°C) oxygenated slicing buffer for an additional 1 min. Then, brains were rapidly mounted on the cutting stage of a VT1200 vibratome (Leica) for coronal sectioning at 300 μm thickness. Brain slices containing the hippocampus or DRN were initially allowed to recover for ≥40 min at 34°C in oxygen-saturated Ringer's buffer consisting of (in mM): 125 NaCl, 2.5 KCl, 1 NaH 2 PO 4 , 25 NaHCO 3 , 1.3 MgCl 2 , 25 glucose, and 2 CaCl 2 . For two-photon imaging, slices were transferred to a recording chamber that was continuously perfused with 34°C oxygen-saturated Ringer's buffer and placed in an FV1000MPE two photon microscope (Olympus) equipped with a 25x/1.05 NA water-immersion objective. 5-HT1.0 or 5-HTmut fluorescence was excited using a mode-locked Mai Tai Ti: Sapphire laser (Spectra-Physics) at a wavelength of 920-nm and collected via a 495-540-nm filter. For electrical stimulation, a bipolar electrode (cat. WE30031.0A3, MicroProbes) was positioned near the DRN in the slice, and imaging and stimulation were synchronized using an Arduino board with a custom-written program. The parameters of the frame scan were set to a size of 128 × 96 pixels with a speed of 0.1482 s/frame for electrical stimulation and a size of 512 × 512 pixels with a speed of 1.109 s/frame for drug perfusion experiments. For the kinetics measurements, line scans were performed with a rate of 800-850 Hz. The stimulation voltage was set at 4-6 V, and the duration of each stimulation was set at 1 ms. Drugs were bath-applied by perfusion into the recording chamber in pre-mixed Ringer's buffer. For the Sindbis virus-infected mouse brain slices, wide-field epifluorescence imaging was performed using Hamamatsu ORCA FLASH4.0 camera (Hamamatsu Photonics, Japan), and 5-HT1.0-expressing cells in acutely prepared brain slices are excited by a 460-nm ultrahigh power low-noise LED (Prizmatix, Givat-Shmuel, Israel). The frame rate of the FLASH4.0 camera was set to 10 Hz. To synchronize image capture with electrical stimulation, and fast-scan cyclic voltammetry, the camera was set to external trigger mode and triggered by a custom-written IGOR Pro 6 program (WaveMetrics, Lake Oswego, OR). For electrical stimulation, a home-made bipolar electrode was positioned near the DRN in the slice, and the stimulation current was set at 350 μA, and the duration of each stimulation was set at 1 ms.

Fast-scan cyclic voltammetry (FSCV)
Carbon-fiber microelectrodes (CFME) were fabricated as described previously 38 . Briefly, cylindrical CFMEs (7 μm in radius) were constructed with T-650 carbon fiber (Cytec Engineering Materials), which was aspirated into a glass capillary (1.2 mm O.D and 0.68 mm I.D, A-M system) and the capillary pulled using the PE-22 puller (Narishige Int.). The carbon fiber was trimmed to 50 to 70 μm in length from the pulled glass tip and sealed with Epon epoxy which was cured at 100 °C for 2 hours followed by 150 °C overnight. CFMEs were cleaned in isopropyl alcohol for 30 min before the Nafion electrodeposition. Nafion was electrochemically deposited by submerging CFME tip in Nafion® solution (5 wt% 1100 EW Nafion® in methanol, Ion Power), and a constant potential of 1.0 V vs Ag/AgCl was applied to the electrode for 30 seconds. Then, Nafion coated electrodes were air-dried for 10 seconds, and then at 70 °C for 10 minutes. For electrochemical detection of 5-HT, a Jackson waveform was applied to the electrode by scanning the potential from 0.

Fluorescence imaging of transgenic flies
Fluorescence imaging in flies was performed using an Olympus two-photon microscope FV1000 equipped with a Spectra-Physics Mai Tai Ti: Sapphire laser. A 930-nm excitation laser was used for one-color imaging of 5-HT1.0 or 5-HTmut, and a 950-nm excitation laser was used for two-color imaging with 5-HT1.0 and jRCaMP1a. For detection, 495-540-nm filter for green channel and 575-630-nm filter for red channel. Adults male flies within 2 weeks post eclosion were used for imaging. To prepare the fly for imaging, adhesive tape was affixed to the head and wings. The tape above the head was excised, and the chitin head-shell, air sacs, and fat bodies were carefully removed to expose the central brain. The brain was bathed continuously in an adult hemolymph-like solution (AHLS) composed of (in mM): 108 NaCl, 5 KCl, 5 HEPES, 5 trehalose, 5 sucrose, 26 NaHCO 3 , 1 NaH 2 PO 4 , 2 CaCl 2 , and 1-2 MgCl 2 . For electrical stimulation, a glass electrode (resistance: 0.2 MΩ) was placed in proximity to the MB medial lobe, and voltage for stimulation was set at 10-30 V. For odorant stimulation, the odorant isoamyl acetate (cat. 306967, Sigma-Aldrich) was first diluted 200-fold in mineral oil, then diluted 5-fold with air, and delivered to the antenna at a rate of 1000 ml/min. For body shock, two copper wires were attached to the fly's abdomen, and a 500-ms electrical stimulus was delivered at 50-80 V. For 5-HT application, the blood-brain barrier was carefully removed, and 5-HT was applied at a final concentration 100 μM. An Arduino board was used to synchronize the imaging and stimulation protocols. The sampling rate during electrical stimulation, odorant stimulation, body shock stimulation, and 5-HT perfusion was 12 Hz, 6.8 Hz, 6.8 Hz, and 1 Hz, respectively.

Immunostaining in transgenic flies
For immunofluorescence, adult flies within 5-12 days were dissected in PBS, then subject in 4% PFA and fixed on ice for 1-4 hours. The brains were washed with the Washing Buffer (3% NaCl, 1% Triton X-100 in PBS) for three times, with 10 min for each time. Samples were transferred to Penetration/Blocking Buffer (2% Triton-X100, 10% Normal Goat Serum in PBS) for 20 hours at 4 °C on the shaker. Samples were then transferred into solution with primary antibody diluted with Dilution Buffer (0.25% Triton-X100, 1% Normal Goat Serum in PBS) for 24 hours at 4 °C. After washing three times, samples were incubated with the secondary antibody for 14-20 hours at 4 °C on the shaker. At last, samples were washed three times and mounted with 50% glycerol. The primary and secondary antibodies were rabbit anti-mCherry (1:500; Abcam Cat#ab167453, RRID: AB_2571870) and AlexFlour647 goat anti-rabbit (1:500; AAT Bioquest, Cat#16710). An inverted Ti-E A1 confocal microscope (Nikon) was used for immunofluorescence imaging. The confocal microscope was equipped with a 20×/0.75 NA air objective. A 640nm laser and 663/738 nm emission filter were used for this experiment.

Two-photon imaging in mice
Fluorescence imaging in mice was performed using an Olympus two-photon microscope FV1000 equipped with a Spectra-Physics Mai Tai Ti: Sapphire laser. The excitation wavelength was 920-nm, and fluorescence was collected using a 495-540-nm filter. To perform the imaging in head-fixed mice, part of the mouse scalp was removed, and the underlying tissues and muscles were carefully removed to expose the skull. A metal recording chamber was affixed to the skull surface with glue followed by a thin layer of dental cement to strengthen the connection. One to two days later, the skull above the prefrontal cortex was carefully removed, taking care to avoid the major blood vessels. AAVs expressing GRAB 5-HT1.0 or GRAB 5-HTmut was injected as above described. A custom-made 4 mm x 4 mm square coverslip was placed over the exposed PFC and secured with glue. After surgery, mice were allowed to recover for at least three weeks. The mice were then fixed to the base and allowed to habituate for 2-3 days. During the experiment, drugs were administered by i.p. injection and the sampling rate was 0.1 Hz.

Fiber-photometry recording in mice
To monitor 5-HT release in various brain regions during the sleep-wake cycle, AAVs expressing GRAB 5-HT1.0 or GRAB 5-HTmut were injected via a glass pipette into the BF, OFC, and BNST using a Nanoject II (Drummond Scientific). An optical fiber (200 μm, 0.37 NA) with FC ferrule was carefully inserted at the same coordinates used for virus injection. The fiber was affixed to the skull surface using dental cement. After surgery, the mice were allowed to recover for at least one week. The photometry rig was constructed using parts obtained from Doric Lens, including a fluorescence optical mini cube (FMC4_AE(405)_E(460-490)_F(500-550)_S), a blue LED (CLED_465), an LED driver (LED_2), and a photoreceiver (NPM_2151_FOA_FC). To record GRAB 5-HT1.0 and GRAB 5-HTmut fluorescence signals, a beam of excitation light was emitted from an LED at 20 μW, and the optical signals from GRAB 5-HT1.0 and GRAB 5-HTmut were collected through optical fibers. For the fiber-photometry data, a software-controlled lock-in detection algorithm was implemented in the TDT RZ2 system using the fiber-photometry "Gizmo" in the Synapse software program (modulation frequency: 459 Hz; low-pass filter for demodulated signal: 20 Hz, 6 th order). The photometry data were collected with a sampling frequency of 1017 Hz. The recording fiber was bleached before recording to eliminate autofluorescence from the fiber, and the background fluorescence intensity was recorded and subtracted from the recorded signal during data analysis.

EEG and EMG recordings
Mice were anesthetized with isoflurane (5% induction; 1.5-2% maintenance) and placed on a stereotaxic frame with a heating pad. For EEG, two stainless steel miniature screws were inserted in the skull above the visual cortex, and two additional steel screws were inserted in the skull above the frontal cortex. For EMG, two insulated EMG electrodes were inserted in the neck musculature, and a reference electrode was attached to a screw inserted in the skull above the cerebellum. The screws in the skull were affixed using thick dental cement. All experiments were performed at least one week after surgery. TDT system-3 amplifiers (RZ2 and PZ5) were used to record the EEG and EMG signals; the signal was passed through a 0.5-Hz high-pass filter at and digitized at 1526 Hz.

Quantification and statistical analysis
Animals or cells were randomly assigned into control or experimental groups. Data collection and analysis were not performed blind to the conditions of the experiments and no data were excluded for the analysis. No statistical methods were used to pre-determine sample sizes but our sample sizes are similar to those reported in previous publications (ref [8][9][10][11]. Imaging data from cultured HEK293T cells, cultured rat cortical neurons, acute mouse brain slices, transgenic flies, and head-fixed mice were processed using ImageJ (1.52p) software (NIH) and analyzed using custom-written MATLAB (R2020a) programs. Traces were plotted using Origin 2020 (2020b). Exponential function fitting in Origin was used to correct for slight photobleaching of the traces in Fig. 2i,n,o,p,r,s and Extended Data Fig. 6c,f-h. In Fig. 2n-p and Extended Data Fig. 6b,e the background levels measured outside the ROI of the pseudocolor images were removed using ImageJ. Imaging data in head-fixed mice were corrected using motion correction algorism (EZcalcium) to correct the movement artifacts 39 .
For the fiber-photometry data analysis, the raw data were binned into 1-Hz bins (i.e., down-sampled by 1000), and background autofluorescence was subtracted. For calculating ΔF/F 0 , a baseline value was obtained by fitting the autofluorescence-subtracted data with a 2 nd order exponential function. Slow drift was removed from the z-scoretransformed ΔF/F 0 using the MATLAB script "BEADS" with a cut-off frequency of 0.00035 cycles/sample (https://www.mathworks.com/matlabcentral/fileexchange/49974 beads-baseline-estimation-and-denoising-with-sparsity). To quantify the change in 5-HT fluorescence across multiple animals, the z-score-transformed ΔF/F 0 was further normalized using the standard deviation of the signal measured during REM sleep (when there was no apparent fluctuation in the signal), yielding a normalized z-score. This normalized z-score was used for the analysis in Fig. 3a-g. For EEG and EMG data analysis, Fast Fourier transform (FFT) was used to perform spectral analysis with a frequency resolution of 0.18 Hz. Brain state was classified semi automatically in 5-s epochs using a MATLAB GUI and then validated manually by trained experimenters. Wakefulness was defined as desynchronized EEG activity combined with high EMG activity, and NREM sleep was defined as synchronized EEG activity combined high-amplitude delta activity (0.5-4 Hz) combined with low EMG activity; and REM sleep was defined as high power at theta frequencies (6-9 Hz) combined with low EMG activity.
Except where indicated otherwise, all summary data are reported as the mean ± s.e.m. The signal to noise ratio (SNR) was calculated as the peak response divided by the standard deviation of the baseline fluorescence. Data distribution was assumed to be normal, and equal variances were formally tested. Two-tailed Student's t-test, one-way ANOVA test were performed. *p<0.05, **p<0.01, ***p<0.001, n.s. p>0.05. The exact p-value is specified in the legends. Cartoons in Fig. 3a,d,f,h are created with BioRender.com.

Reporting Summary
Further information on research design is available in the Life Sciences Reporting Summary linked to this article.

Supplementary Material
Refer to Web version on PubMed Central for supplementary material. a, Left, schematic representation illustrating the principle behind the GRAB 5-HT sensor. The crystal structures are from the Protein Data Bank (PDB) archive (PDB ID: 6BQH and 6BQG for the inactive and active states of the 5-HT2C receptor, respectively 14 , and PDB ID: 3EVP for cpGFP 32 ). Middle, the 5-HT sensor was optimized over three main steps, including the cpGFP insertion site, the linker between cpGFP and 5-HT2C receptor, and critical amino acids in cpGFP. Right, optimization of cpGFP and the engineering of 5-HTmut. The fluorescence change in each candidate sensor is plotted against the brightness, with both axes normalized to 5-HT1.0. b, Representative images (left), fluorescence response traces (middle), and group data (right) of the fluorescence response in cultured rat cortical neurons expressing 5-HT1.0 (green) or 5-HTmut (gray); where indicated, 10 μM 5-HT was applied. The inset in the left a, Schematic illustration depicting the mouse brain slice experiments. Top, The AAV vector was used to express the 5-HT1.0 sensor. Bottom, AAV expressing either 5-HT1.0 or 5-HTmut was injected in the mouse DRN, after which acute brain slices were prepared and recorded. b, Representative fluorescence image of 5-HT1.0, pseudocolor images of the fluorescence change in 5-HT1.0, and 5-HTmut in response to the indicated electrical stimuli delivered at a, Schematic diagram illustrating the use of fiber-photometry for measuring 5-HT1.0 and 5-HTmut fluorescence in the basal forebrain (BF) of freely behaving mice during the sleep-wake cycle. EEG and EMG were also measured. b, Representative EEG, EMG, and 5-HT1.0 (top) and 5-HTmut (bottom) fluorescence measured during the sleep-wake cycle. The REM sleep state was shaded with pink color, and the waking state was shaded with a light blue color. Similar results were observed from 3 mice. c, Summary of 5-HT1.0 (top) and 5-HTmut (bottom) fluorescence measured in awake mice and during waking, NREM, and REM sleep; n = 3 mice in two sessions for each group. Two-tailed Student's t-test was performed. For 5-HT1.0, P = 0.00382 between wake and NREM; P = 0.00374 between wake and REM; P = 0.0334 between NREM and REM. For 5-HTmut, P = 0.474 between wake and NREM; P = 0.255 between wake and REM; P =0.107 between NREM and REM. d, e, Same as in (a), except the 5-HT1.0 sensor was expressed in both the orbital frontal cortex (OFC; light green) and the bed nucleus of the stria terminalis (BNST; dark green), and the fluorescence response in each nucleus was recorded and analyzed. Similar results were observed from 4 mice. The cross-correlation between the signals in the OFC and BNST is shown in (e); n = 4 mice in two sessions for each group. Two-tailed Student's t-test was performed. P = 8.72 ×10 −6 between raw and shuffled group. f, g, 5-HT1.0 fluorescence was measured in the BNST and BF as in (f), where indicated, the mice received an injection of saline (control) or Met. The normalized responses in the BNST (n = 3 mice) and BF (n = 1 mouse) were combined for the group summary. Two-tailed Student's t-test was performed. P = 0.533 and P = 0.0361 for control and drug group. h, Schematic diagram illustrating the use of two-photon imaging to measure 5-HT1.0 and 5-HTmut fluorescence in the prefrontal cortex (PFC) of head-fixed mice; MDMA or saline was injected intraperitoneally. i, Representative fluorescence images of 5-HT1.0 (top, left) and 5-HTmut (bottom, left) measured in the mouse PFC. The images on the right are the corresponding magnified views of the dashed box on the left. Similar results were observed for more than 3 mice. Scale bar, 50 μm. j, k, Representative pseudocolor images (j), averaged fluorescence traces (k, top), and group summary (k, bottom) showing 5-HT1.0 (top, green) and 5-HTmut (bottom, gray) fluorescence changes after an i.p. injection of saline (middle) or 10 mg/kg MDMA (right); n = 5 mice for 5-HT1.0 group, n = 3 mice for 5-HTmut group. Two-tailed Student's t-test was performed. P = 0.0106 between 5-HT1.0 with MDMA and saline; P = 0.00669 between 5-HT1.0 with MDMA and 5-HTmut with MDMA; P = 0.00477 between 5-HT1.0 with MDMA and 5-HTmut with saline. Scale bar, 50 μm. Data are shown as the mean ± s.e.m. in c, e, g, k, with the error bars or shaded regions indicating s.e.m., *p<0.05, ** p<0.01, ***p<0.001, and n.s., not significant.