Canton-Special flies57 were used as wild-type. Transgenes were expressed with GAL4 lines from the InSITE collection58, the Janelia FlyLight collections44,59 or the Vienna Tile collection60: 0273-GAL416,58, R48B04-GAL423,24, R58E02-GAL415, R29C06-GAL459, MB042B-GAL4, MB056B-GAL4, MB109B-GAL4, MB312C-GAL4, MB316B-GAL4 and MB504B-GAL444, VT006202-GAL421,61. TH-GAL4 is from ref. 62. GAL80 transgenes co-expressed with 0273-GAL4 are as follows: Cha-GAL8063, GAD1-GAL8064, Vglut-GAL8065 and TH-GAL8066. The optogenetic effectors UAS-CsChrimson::mVenus (UAS-CsChr)67 and UAS-GtACR168 were expressed under the control of specific GAL4 drivers. The reporter UAS-mCD8::GFP69 was expressed with 0273-GAL4 together with various GAL80 transgenes: R15A04-GAL8024, R48B04-GAL8023 and R58E02-GAL8015. LexAop-rCD2::mRFP70 was expressed with 247-LexA::VP1671. The R15A04-GAL80; R48B04-GAL4 combination has been described24. tsh-GAL80 is from ref. 43. For two-photon imaging experiments 20XUAS-IVS::GCaMP6f72 and UAS-myr::tdTomato73 were expressed under the control of R48B04-GAL4.
All D. melanogaster strains were maintained at 25 °C and 60% humidity in a 12:12 h light:dark cycle with light provided between 8 AM and 8 PM. For all behavioural experiments, flies were reared on yellow cornmeal agar food containing deionized water, 7.2 g l−1 agar (Fisher Scientific), 25 g l−1 autolysed yeast extract (Brian Drewitt), 47.3 g l−1 cornmeal (Brian Drewitt), 100 g l−1 dextrose (d-glucose anhydrous, Fisher Scientific), 2.2 g l−1 tegosept (methyl 4-hydroxybenzoate) (Sigma-Aldrich), and 8.4 ml l−1 ethanol (Sigma-Aldrich). All cornmeal agar food was prepared by boiling, not autoclaving. Before deprivation for all optogenetic experiments, adult flies were reared in darkness for 3 days on yellow cornmeal agar food containing 1 mM all-trans-retinal (Sigma-Aldrich). For all physiological experiments, flies eclosed on brown cornmeal agar food containing deionized water, 6.75 g l−1 agar, 25 g l−1 yeast, 62.5 g l−1 cornmeal, 37.5 ml l−1 molasses (Brian Drewitt), 4.2 ml l−1 propionic acid (Fisher Scientific), 1.4 g l−1 tegosept and 7 ml l−1 ethanol; 0-to-2-day-old adult flies were then transferred to yellow cornmeal agar food.
Food and water deprivation
Flies were aliquoted into groups of ~100 before behavioural experiments or ~10 before physiological experiments. For starvation, flies were food-deprived for 20 to 26 h in a 25 ml vial containing a 2 cm × 3 cm piece of filter paper with 1% agar at the base. Vials were stored at 22 °C throughout the starvation period. For dehydration, flies were kept in a 25 ml vial without water for 4 h to 6 h. Throughout the dehydration period, flies had access to a sheet of dry sucrose-coated filter paper (2 cm × 3 cm) resting on top of a layer of cotton wool, which separated the flies from a thick layer of the desiccant Drierite (calcium sulfate, Sigma-Aldrich) at the base. Vials were stored at 22 °C throughout the dehydration period in a sealed polystyrene box containing a similar arrangement of Drierite and cotton wool. Satiated flies—that is, flies provided with ad libitum access to food and water—were transferred into a 25 ml vial containing a 2 cm × 3 cm piece of filter paper with 1% yellow cornmeal agar food at the base and then stored at 22 °C for 20–26 h before experiments.
T-maze olfactory behavioural experiments
Male flies from GAL4 lines were crossed to female flies from effector lines and their mixed-sex 4-to-12-day-old offspring were tested in groups of ~100 flies each for all T-maze behavioural experiments. The two odours used for testing in all olfactory experiments were MCH and OCT57 (Sigma-Aldrich). For Fig. 3c, the initial two odours used for optogenetic training were isoamyl acetate (IAA) and ethyl butyrate. Each odour was diluted ~1:103, specifically, 10 µl MCH or 7 µl OCT or 10 µl IAA or 7.5 µl ethyl butyrate in 8 ml mineral oil (Sigma-Aldrich). All experiments were performed at 23 °C and 55% to 65% relative humidity.
Olfactory conditioning with sucrose
For Figs. 1a,c and 4a, sucrose was prepared as a saturated solution (~400 g l−1), of which 3 ml was pipetted onto a 6 cm × 8 cm piece of filter paper. Excess solution was drained from the paper, which was then rolled into a tube and allowed to dry overnight. Appetitive training with sucrose was conducted as previously described74. Groups of flies were first transferred to a training tube of a T-maze lined with filter paper and then exposed to an odour (the CS−) for 2 min. Following 30 s of clean air in the same tube, flies were transferred to another tube lined with dried sucrose then immediately exposed to another odour (the CS+) for 2 min. Mock-trained flies in Figs. 1c and 4a experienced the same protocol as sucrose-trained flies, except that the second odour tube was also lined with filter paper instead of dried sucrose. Both mock-trained and sucrose-trained flies were transferred to the T-maze elevator after CS+ exposure and immediately given a choice between the CS− and CS+ odours.
Olfactory conditioning with optogenetic activation
For Figs. 1b,c, 2c,d and 4a,b, olfactory conditioning with optogenetic neural activation was conducted as previously described21. Groups of flies were transferred into a tube on which three red LEDs (700 mA, centred at 630 nm, 3 W maximum power; Multicomp) were mounted. Flies were exposed to the CS− odour for 2 min, followed by 30 s of clean air, then 2 min of exposure to the CS+ odour paired with 500 Hz red light (1 ms pulses driven at 1.25 V with 0.1 ms delay). Red light was pulsed under the control of a DG2A Train/Delay Generator (Digitimer) coupled with a DS2A Isolated Constant Voltage Stimulator (Digitimer). For the experiments in Figs. 1c and 4a, flies were transferred after the clean air to another tube (in which they were exposed to the CS+); whereas for Figs. 1b, 2c–e and 4b, flies were exposed to each odour in the same tube without any transfers. Red-light-trained flies were transferred to the T-maze elevator after CS+ exposure and immediately given a choice between the CS− and CS+ odours.
For the experiments in Extended Data Fig. 1c,e, flies were exposed to the CS+ odour simultaneously paired with 90 or 120 V pulsed electric shocks (of 1.5 s duration each at 0.2 Hz) and red light, whereas for the experiment in Extended Data Fig. 6e, flies were exposed to the CS+ odour simultaneously paired with both sucrose and red light. For the experiments in Extended Data Fig. 6f,g, flies were exposed to one odour paired with sucrose and another odour paired with red light.
Olfactory conditioning with optogenetic inhibition
For Fig. 3a,b, olfactory conditioning with optogenetic inhibition was conducted as for optogenetic activation described above, with the following differences. Groups of flies were initially transferred to a tube on which three green LEDs (700 mA, centred at 530 nm, Multicomp) were mounted. Flies were exposed to the CS− odour for 2 min, followed by 30 s of clean air, then transferred to another tube in which they were exposed for 2 min to the CS+ odour paired with continuous green light. Green-light-trained flies were transferred to the T-maze elevator after CS+ exposure and immediately given a choice between the CS− and CS+ odours.
Sequential optogenetic then aversive olfactory training
For Fig. 3c, flies were first trained with optogenetic activation (without transfers between tubes) and IAA and ethyl butyrate as described above. After being exposed to fresh air for another 30 s following the CS+ exposure, they were transferred to another tube for aversive olfactory training with electric shock and two different odours (MCH and OCT). Aversive olfactory training was performed as previously described75,76. Groups of flies were transferred to a tube lined with a conductive copper coil. Electric shocks were delivered under the control of an S48 square pulse stimulator (Grass Technologies). Flies were exposed for 1 min to the CS+ odour paired with 12 shocks (90 V pulses of 1.5 s duration at 0.2 Hz), then 45 s of fresh air, followed by 1 min exposure to the CS− odour without shock, all in the same tube. Flies were transferred to the T-maze elevator after CS− exposure then immediately given a choice between the CS− and CS+ odours used during the aversive training (not the odours used during the first round of red-light training). For the experiment in Extended Data Fig. 4e, flies were trained with only the odours MCH and OCT.
T-maze olfactory testing with simultaneous shock
For Figs. 1a–c and 2c–e, after appetitive olfactory training, flies were permitted to choose in darkness between two tubes (both lined with conductive copper coils) that contained either the CS+ odour electrified with 90 V shocks (of 1.5 s duration each at 0.2 Hz) or the non-electrified CS− odour. Testing duration for Figs. 1a,b and 2d, varied at increasing intervals (15 s, 30 s or 60 s), whereas for Figs. 1c and 2c,e, testing duration was fixed at 60 s. For the variable-test-duration experiments (Figs. 1a,b and 2d), the leftmost treatment group (per genotype) is a positive control in which flies experienced appetitive training but neither tube was electrified during testing, whereas the rightmost treatment group (per genotype) is a negative control in which flies experienced mock training and the CS+ odour was electrified during testing. For the experiment in Extended Data Fig. 4d, flies were separated after testing depending on their choice of entering either the electrified CS+ or non-electrified CS − T-maze arm during the first test and then retested 30 s later with the same choice.
Performance index (PI) was calculated as the number of flies in the CS+ tube minus those in the CS− tube, divided by the total number of flies. Flies that entered each tube were transferred into separate vials and immobilized by freezing to permit counting. To account for any odour bias, a single PI score was calculated from the mean scores of two independent experiments in which separate groups of flies of the same genotypes were trained with reciprocal combinations of MCH and OCT as the CS+ and CS− odours.
T-maze olfactory testing without simultaneous stimuli
For Fig. 3a–c, after olfactory training, flies were allowed to choose in darkness for 2 min (1 min for Fig. 3b) between two tubes (not lined with filter paper) that contained either the CS− or CS+ odours. Testing PI was calculated as described above.
T-maze olfactory testing with simultaneous sucrose
For Fig. 4a,b, after appetitive olfactory training, flies were allowed to choose in white light for 2 min between two tubes that contained either the CS− odour presented with a dried sucrose paper or the CS+ odour presented with a blank filter paper. Testing PI was calculated as described above. For the experiment described in Fig. 4b, the leftmost treatment group is a positive control in which flies experienced optogenetic training but both tubes were lined with blank filter paper during testing, whereas the rightmost treatment group is a negative control in which flies experienced mock training and the CS− odour was presented with dried sucrose paper during testing.
Shock avoidance experiments
For Fig. 3d, flies were transferred to an odourless tube (not lined with filter paper) on which three red LEDs were mounted. Flies were exposed to 500 Hz red light for 2 min, then transferred to the T-maze elevator and immediately allowed to choose in darkness for 1 min between two copper-lined tubes, one of which delivered 90 V electric shocks of 1.5 s duration at 0.2 Hz. Control groups were not exposed to red light before testing. For the naive shock avoidance experiment in Fig. 3e, flies were directly transferred to the T-maze elevator without training and immediately allowed to choose in darkness between two copper-lined tubes (each mounted with three green LEDs), one of which was coupled with 90 V shocks. Both tubes were illuminated with continuous green light throughout testing. For both experiments, the preference index (PI) was calculated as the number of flies in the shock tube minus those in the control tube, divided by the total number of flies. Each experiment contributed a single PI value (rather than the mean scores of two experiments), but the tube conducting electric shocks alternated between experiments.
Sucrose approach experiments
For Fig. 4d, flies were transferred to an odourless tube (not lined with filter paper) on which three red LEDs were mounted. Flies were exposed to 500 Hz red light for 2 min, then transferred to the T-maze elevator and immediately allowed to choose for 2 min in white light between two tubes, one laden with dried sucrose paper and the other with control filter paper. Control groups were not exposed to red light before testing. The preference index (PI) was calculated as the number of flies in the sucrose tube minus those in the control tube, divided by the total number of flies. Each experiment contributed a single PI value (rather than the mean scores of two experiments), but the tube containing sucrose changed sides between experiments.
T-maze olfactory testing for individual CS+ and CS− memories
For Extended Data Fig. 6d, to isolate the individual CS+ and CS− memories, a novel odour (16 µl IAA in 8 ml mineral oil) was used to replace either the CS+ or CS− odour during training. When testing for CS+ odour memory, MCH or OCT were used as the CS+ odour for half of the reciprocal training experiments each, whereas IAA was always used as the CS− odour. When testing for CS− odour memory, MCH or OCT were used as the CS− odour for half of the reciprocal training experiments each, whereas IAA was always used as the CS+ odour. The testing odours were always MCH and OCT for all treatment groups.
Single-cell RNA sequencing
Central brains were dissected from 32 UAS-CsChr; 0273-GAL4 flies and a cell suspension was generated as described77. Single cells were then encapsulated with oligonucleotide barcoded gel beads in nanolitre volumes using the Chromium Single Cell 3′ Reagent Kit v3 (10x Genomics)78, following the manufacturer’s instructions. Following in-droplet reverse transcription, droplets were lysed and cDNA libraries were amplified and sequenced on an Illumina HiSeq4000 platform. After filtering out low-quality barcodes and putative cell doublets, we retrieved a total of 11,502 cells with an average of 5,673 unique molecular identifiers (UMIs) detected per cell. Barcoded sequencing reads were aligned to the D. melanogaster reference genome (release 6.25 from https://flybase.org/) and to the UAS-CsChr transgene (GenBank KJ995863.2)67. We considered only genes that were present in at least 10 cells, resulting in 9,935 genes (including the UAS-CsChr transgene) being detected. UMAP reduction79 of the data and clustering was performed using the Seurat v3 R package80. CsChr-expressing cells were classified into neurotransmitter types based on their relative expression of Vmat and DAT for dopamine, vesicular acetylcholine transporter (VAChT) for acetylcholine, glutamic acid decarboxylase 1 (Gad1) for GABA, and vesicular glutamate transporter (VGlut) for glutamate.
0273–GAL4 expression (with or without GAL80 co-expression) was visualized using UAS-mCD8::GFP. For Fig. 2a, the mushroom body was co-labelled with 247-LexA::VP16-driven expression of LexAop-rCD2::mRFP. Brains from 2-to-4-day-old flies were dissected in phosphate buffered saline (PBS: 1.86 mM NaH2PO4, 8.41 mM Na2HPO4, and 175 mM NaCl) and fixed in 4% v/v paraformaldehyde (PFA) for 20 min at room temperature. Fixed brains were washed in PBS and mounted onto a glass slide in Vectashield Antifade mounting medium (Vector Labs), covered with a glass coverslip, and sealed with nail varnish.
Native GFP and mRFP fluorescence was imaged using a Leica TCS SP5 X confocal microscope with an HCX PL APO 40× 1.3 N.A. oil-immersion objective (Leica). GFP was imaged with 20% laser power, whereas mRFP (when required) was imaged with 7% laser power. Laser power and acquisition settings remained constant for the imaging of all samples. The resolution of each image stack acquired was ~2 pixels per µm and the voxel size was ~0.45 µm × ~0.45 µm × 0.1678 µm. Acquired images were processed using Fiji81. Maximum intensity projections of 0273-labelled neurons and mushroom bodies (when applicable) were created in Fiji for visualization. The number of 0273-labelled PAM neuron cell bodies per hemisphere was counted manually in Fiji; each hemisphere was counted as a separate sample.
Clustering of USNs by morphology
Synaptic connectivity data was obtained from the hemibrain nanoscale connectome electron microscopy dataset (v1.2.1, neuprint.janelia.org)51 via Python-based NAVis functionalities (v1.3.0)82. USNs with dendritic connectivity to β′2 (PAM02, PAM05 and PAM06), γ4 (PAM08), γ4<γ1γ2 (PAM07), γ5 (PAM01) and γ5β′2a (PAM15) DANs were defined as all input neurons. Kenyon cells, other PAM DANs, PPL DANs, anterior paired lateral neurons, dorsal paired medial neurons, and three mushroom body output neurons (MBONs) (MBON05 (γ4>γ1γ2), MBON11 (γ1pedc>α/β) and MBON09 (γ3β′1)) that provide axo-axonal input within the mushroom body neuropil were excluded. Generally, clustering of USNs was performed according to Neuprint type51. SEZ-associated neurons were clustered separately, as described13,21. In brief, MBDL1 and MBDL2 axon neurons of the left hemisphere were mirrored, and then clustered with right-hemisphere neurons by morphology (using Manhattan distance metrics and the average linkage criterion) to yield a fine cluster granularity using R-based natverse (https://natverse.org) functionalities83.
Calculation and ranking of percentage dendritic input
The percentage dendritic input from each USN to each individual β′2 (PAM02, PAM05 and PAM06), γ4 (PAM08), γ4<γ1γ2 (PAM07), γ5 (PAM01) and γ5β′2a (PAM15) DANs was calculated as the fraction of total dendritic input (not including the neurons previously excluded) provided to the DAN by that USN. The sum of the percentage dendritic inputs of all USNs in each USN cluster (comprising 1 to 34 USNs) was then calculated to determine the strength of each cluster’s combined percentage dendritic input to the DANs. USN clusters were then ranked by the strength of their percentage dendritic input to either all seven β′2, γ4, and γ5 DAN types (for the connectivity map and heat map) or the four β′2 and γ4 DAN types (for the volumetric reconstructions).
The top 200 clusters providing the strongest dendritic input were then selected for further analysis. For dendritic input to all seven β′2, γ4, and γ5 DAN types, the top 200 clusters comprised 450 neurons, whereas to only the four β′2 and γ4 DAN types, the top 200 clusters comprised 402 neurons. 163 clusters (and 339 USNs) are shared between the two sets of top 200 clusters. 37 clusters (111 USNs) are unique to the top 200 strongest inputs to all seven β′2, γ4, and γ5 DAN types, whereas another 37 clusters (63 USNs) are unique to the top 200 strongest inputs to only the four β′2 and γ4 DAN types. All connectivity data are available in Supplementary Tables 1 and 2.
For Fig. 5b, 3D meshes of neuronal volumetric reconstructions were obtained from the hemibrain electron microscopy dataset v1.2.1 via Python-based NAVis v.1.3.0 functionalities82. Composition and rendering of three-dimensional projections and Supplementary Video 1 were created using Blender v.3.2.2 (Blender Foundation), into which data were imported via NAVis-Blender interface functionalities. Brain meshes were obtained from the R-based natverse package nat.flybrains v.1.7.483. The top 200 USN clusters most strongly connected to β′2 and γ4 DANs were coloured manually in hues of colours according to neurite location.
Input network connectivity map
For Fig. 5c, to display the input network map, a threshold of 0.4% dendritic input was applied for USN-cluster-to-DAN connections. Nodes representing DANs were grouped by Neuprint DAN subtype and nodes representing USN clusters were grouped by DAN connectivity (see below). The 0.4% threshold was determined by iterative testing of thresholds ranging from 0.1% to 5% with a resolution of 0.1%. The silhouette method was employed to test (NBclust v.3.0.1), if the known DAN subtype groups were reproduced based on clustering of upstream connectivity. USN clusters were defined to be connected specifically and strongly to a DAN type when the cluster was connected to at least 20% of the neurons constituting that type. A DAN type is, for example, PAM08, which consists of the subtypes PAM08_a through PAM08_e. The connectivity map displaying the input network was generated using Cytoscape v3.9.1. Edge transparency was continuously mapped between the pixel values of 49 and 149 (minimum at 0.1%, maximum at 12.17%). Edge weight was passthrough mapped onto the percentage dendritic input range (0% to 12.17%). Edges were bundled with default Cytoscape parameters (n.o.h. = 3, s.c. = 0.0003, c.t. = 0.3, m.i. = 500).
Upstream neuron connectivity heat map
For representation on heat maps, the top 200 clusters (450 neurons) providing the strongest dendritic input to all β′2 (PAM02, PAM05 and PAM06), γ4 (PAM08), γ4<γ1γ2 (PAM07), γ5 (PAM01) and γ5β′2a (PAM15) DANs were analysed and clustered by their percentage dendritic input (using base R functions to calculate Manhattan distance metrics and Ward’s clustering criterion). No thresholds were applied. DANs were sorted by their type and percentage dendritic input was normalized by DAN total dendritic input within a row. The graphical representation was generated using the R package ComplexHeatmap v1.10.2.
Two-photon in vivo calcium imaging
Flies up to 10 days old were briefly anaesthetized for <10 s on ice then mounted with wax onto a custom-made imaging chamber. Each fly was tethered by immobilizing its thorax, legs, and then eyes with wax, whereas its proboscis, maxillary palps, and antennae were left unwaxed. The posterior head capsule was immersed in 1 ml sugar-free HL3-like saline solution84 (140 mM NaCl, 2 mM KCl, 4.5 mM MgCl2, 1.5 mM CaCl2, 5 mM HEPES-NaOH, pH 7.1, 275 mOsm kg−1) and opened at room temperature. After surgery, the brain was covered with a 15 μl droplet of sugar-free saline supplemented with 1% agarose and then re-immersed in 1 ml sugar-free saline.
A customized Scientifica Slicescope was equipped with a LUMPLFLN 40× 0.8 NA water-immersion objective (Olympus) and a dichroic beamsplitter (BrightLine, Semrock) with green (500/15 nm, Semrock) and red (578/21 nm, Semrock) filters each followed by GaAsP PMTs (Hamamatsu) to detect GCaMP6f and tdTomato signals respectively. A Ti:sapphire laser (Chameleon Ultra II, Coherent) excited fluorescence using 140 fs pulses centred on 910 nm with an 80 MHz repetition rate. Images of 256 × 256 pixels were acquired at 5.74 Hz under the control of ScanImage 3.8 software85 via MATLAB (MathWorks, release 2012a).
Two-photon imaging stimulus delivery
Odours were delivered on a clean air carrier stream using a custom-designed system86, which synchronized odour delivery timing with two-photon image acquisition via LabVIEW (National Instruments). The odours used were MCH and OCT. Each odour (Sigma-Aldrich) was diluted 100× in mineral oil (Sigma-Aldrich) then further blended 1:9 with the clean air stream before being delivered to the tethered fly.
A custom-built feeding stage24 delivered a 15 µl to 20 µl droplet towards the freely-moving proboscis of a tethered fly. Each droplet was prepared with 0.4% Brilliant Blue FCF dye (Wako Chemicals) or red amaranth dye (Sigma-Aldrich). Sucrose was delivered at a concentration of 1 M. For Fig. 6f, initial-trial water and post-water sucrose were delivered to each fly with a random order of alternating dye colours. A custom-written LabVIEW subroutine24 controlled the feeding stage position by specifying its horizontal and vertical coordinates. Since feeding was voluntary and proboscis position varied between tethered flies, the feeding stage was manually directed by remote control towards the appropriate coordinates at the desired times. Each fly was photographed before surgery and after imaging to confirm that feeding was successful. Flies without visible dye (or without both dyes for flies delivered two stimuli in Fig. 6f) in their digestive tract post-imaging were excluded from the analysis. A Stingray CCD camera (Allied Vision Technologies) recorded fly feeding at 15 Hz during two-photon imaging. These recordings were used to confirm the timing of feeding onset and offset.
Two-photon imaging analysis
Fiji81 was used to demarcate the anatomically distinct β′2, γ4 and γ5 ROIs manually for R48B04-driven expression of GCaMP6f and tdTomato. MATLAB (release 2021a) was used for all subsequent processing of the fluorescence signal. For each ROI, the mean intensity of each frame was extracted for each of the two channels (green/GCaMP6f and red/tdTomato) recorded. To control for motion-related artefacts, the mean intensity of each GCaMP6f frame for an ROI was divided by the mean intensity of its corresponding tdTomato frame, yielding R, the ratio of the GCaMP6f to tdTomato signal for an ROI.
The resulting ratiometric fluorescence trace R for the ROI in each hemisphere was then averaged to yield the mean trace for that ROI in an individual fly. The mean trace was normalized for each stimulus-evoked response by calculating ΔR/R0, where R0 is the arithmetic mean of R for the 5 s before the onset of each stimulus (10 s before for Fig. 6d) and ΔR = R – R0. For all response curves plotted in Fig. 6b,c,f, the central line is the arithmetic mean of each frame for all samples in a treatment group, and the s.e.m. is displayed as a shaded error bar above and below the central line. The peak of a response to a stimulus was defined to be the maximum value of ΔR/R0 from 0 s to 20 s after stimulus onset. For all mean difference curves plotted in Fig. 6g, the central line is the difference in the arithmetic means of two treatment groups for each frame, and the 95% confidence interval of the difference is displayed as a shaded error bar above and below the central line.
To compare the effects of physiological state manipulations on baseline calcium signals in Extended Data Fig. 10, only the initial-trial water and initial-trial sucrose samples from Fig. 6f were analysed. The baseline calcium signal was defined to be the arithmetic mean of the GCaMP6f fluorescence for the 60 s before stimulus onset. The mean signal for each ROI in each hemisphere was calculated over this time frame, as was that of an additional ‘background’ ROI in each hemisphere for a non-implicated region. The mean signal for each ROI was then divided by the mean signal of the background ROI in the corresponding hemisphere. The mean ROI signal (relative to its corresponding background ROI) was then averaged across both hemispheres to yield the mean baseline signal for that ROI in each fly.
Statistical analyses were performed in MATLAB (release 2021a) or GraphPad Prism 8.4.3. All behavioural and confocal data were analysed with a two-sided unpaired t-test, a one-way ANOVA followed by multiple comparisons (Tukey’s HSD), or a two-way ANOVA followed by multiple comparisons with Šidák’s correction or Tukey’s HSD. Homoscedasticity among genotypes was not assumed for the multiple two-sided unpaired t-tests performed in Extended Data Fig. 4a with Holm–Šidák’s correction. For two-photon imaging data, peak responses in Fig. 6d were analysed with a two-way repeated measures ANOVA for odours (in which both regions and odours were matched for individual flies) or a one-way repeated measures ANOVA for sucrose (in which regions were matched for individual flies), followed by Tukey’s HSD. For the mean differences in Fig. 6g, frames for which the 95% confidence interval of the difference did not include zero (that is, a two-sided unpaired t-test) were considered statistically significant without correcting for multiple comparisons and denoted with a plus symbol (+) for each corresponding frame. Baseline signals in Extended Data Fig. 10 were analysed with a two-way repeated measures ANOVA (in which regions were matched for individual flies) followed by Tukey’s HSD. Sphericity was assumed for all matching observations from imaging data analysed with repeated measures ANOVA. All analyses of variance, mean difference, and descriptive statistics are described in Supplementary Tables 3–5.
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.