# Synaptic gradients transform object location to action – Nature

Jan 4, 2023

### Experimental model details

Table of Contents

Flies were reared under standard conditions at 25 °C and 50% humidity with a 16-h light/8-h dark cycle on a standard cornmeal fly food. Male and female flies 3–5 days after eclosion were used for all experiments except if specified otherwise. Flies used for optogenetic activation experiments were raised on 0.2 mM retinal (Sigma R2500) food, and maintained on 0.4 mM retinal food as adults. These flies were kept in the dark in foil-covered vials until they were prepared for experiments. Supplementary Table 2 provides detailed descriptions of fly genotypes used in each experiment and origins of transgenic stocks.

### Behavioural experiments

#### High-throughput takeoff assay

We tested escape responses of unrestrained flies using our previously developed FlyPEZ33 system to automate fly behaviour experiments and collect large sample sizes necessary to quantitatively characterize differences in escape behaviour. In FlyPEZ, individual flies were released one at a time onto a 5 mm by 5 mm glass platform through an automated gate without undue perturbation, where they were targeted for visual or optogenetic stimulation. The fly position on the platform was tracked using a real-time tracking algorithm, which coordinated the triggering of a high-speed video camera and either looming stimulus or light stimulus. For visual stimulation, we used digital micromirror device projectors running at a refresh rate of 360 Hz, controlled by MATLAB using the Psychophysics Toolbox. Dark looming discs expanding from 10° to 180° at an elevation of 45° and azimuth of 0°, 90° or 180° ± 22.5° relative to the fly head position were presented on a 7-inch-diameter back-projection coated dome centred over the fly platform, which covers 360° in azimuth and 120° in elevation of the fly’s visual field. To simulate an object approaching with constant velocity, the projected looming disc centre remained constant while the disc radius increased nonlinearly over time on the basis of the following equation

$$\theta \left(t\right)=2{{\rm{\tan }}}^{-1}\frac{l}{{vt}}$$

in which $$\theta$$ is the angular size of the stimulus (in radians), l is the radius of the virtual object, and v is its simulated approach velocity. $$t$$ = 0 is the theoretical time of contact, when the object would reach 180°, so that t < 0 during object expansion. For optogenetic stimulation, CsChrimson was activated in flies raised on retinal food with four 624-nm wavelength light-emitting diodes (total irradiance of 500 W m−2, as measured from the location of the fly on the platform). Escape responses were captured using a macro lens on a high-speed camera, and two perspectives of the fly (side and bottom views) were filmed at 6,000 frames per second under 850-nm infrared illumination. Only one stimulus was presented per fly, and the platform was cleared before release of the subsequent fly. All looming experiments were carried out during the 4-h activity peak in the afternoon light cycle, and all optogenetic experiments were carried out in the dark.

#### Behavioural data analysis

Escape sequence durations in the CsChrimson activation and Kir2.1-silencing experiments were manually annotated by labelling the first frame of wing raising and the last frame of tarsal contact from the FlyPEZ video data. For the analysis of postural shifts and takeoff angles following either optogenetic activation or looming stimulus presentation, we used a machine learning software package, Animal Part Tracker (APT, a software package developed by the Branson Lab at Janelia) v0.3.4, which allowed us to automatically track locations of body parts in the input videos. For automated tracking, the videos were subsampled at 600 Hz (1.67-ms interval), which was sufficient to observe smooth changes in leg and body movements. Missing tracking data due to occlusions (body part out of frame) were interpolated for gaps less than five frames (8.33 ms), and a moving-average filter was applied to smooth the raw tracking data. For optogenetic activation experiments, videos in which visibility of T2 legs was lost over the 100 ms of annotation were excluded, except for cases in which the fly performed a takeoff. For silencing experiments, videos in which visibility of T2 legs was lost between the stimulus start and the start of jumping leg extension were excluded from the COM movement, COM flow field and T2 leg angle analyses. Individual takeoff vectors were obtained from two locations of the COM, one at takeoff, when the last of the middle tarsi loses contact with the ground (tend), and one either at a manually annotated frame of the start of jumping leg extension, or at 5 ms before the takeoff (tstart; Fig. 1i). The population mean resultant length, $$\bar{R}$$, is calculated by the following equation

$$\bar{R}=\frac{1}{n}\left|\mathop{\sum }\limits_{j=0}^{n}{{\rm{e}}}^{i\theta j}\right|$$

in which $$n$$ is the total number of the takeoff vectors, and $${{\rm{e}}}^{i\theta }$$ is Euler’s formula as a simplified representation of a vector. $$\bar{R}$$ is a statistic between 0 and 1 for the spread of a circular variable in the population, such that 1 means all of the takeoff directions are concentrated at a single angle, and 0 means the spread is more uniform. The COM referenced to fly body-centric coordinates was obtained by translating and rotating the COM as described in Extended Data Fig. 1c. Δ[T2 leg angle] at a given time frame of the FlyPEZ video was obtained using the APT-tracked tarsal tips of the middle legs and the COM as described in Fig. 1d. A Butterworth filter was applied to the T2 leg angle time series results. Individual COM movement vectors were calculated as the vector from COM0 to COMpre (Extended Data Fig. 1d).

### Electrophysiological experiments

#### Electrophysiological recordings and data analysis

Female flies of 2–4 days in age were anaesthetized on a Peltier-driven cold plate and positioned ventral side up to be tethered on a custom polyether-ether-ketone recording plate by applying ultraviolet-cure glue to the head and thorax. We used only female flies because: female flies are larger and hence less prone to desiccation than male flies, and so have the potential to provide longer-lasting electrophysiological recordings; and both the hemibrain and full brain (FAFB) EM datasets were collected from female flies, so our direct measurements of the gradients are both in female flies. For recording stability, the proboscis was glued in a retracted position and the front pair of legs were clipped and glued at the femur. To access the DN soma for whole-cell recording, a window was cut in the cuticle on the posterior side of the head, and the overlying fat and trachea were removed. The brain was continuously perfused during electrophysiology with the external solution containing (in mM): 103 NaCl, 3 KCl, 5 N-Tris (hydroxymethyl)methyl-2-aminoethane-sulfonic acid, 8 trehalose, 10 glucose, 26 NaHCO3, 1 NaH2PO4, 1.5 CaCl2 and 4 MgCl2, bubbled with 95% O2 and 5% CO2, and adjusted to pH 7.3 and 273–276 mOsm. To disrupt the perineural sheath around the soma of interest, collagenase (0.25 mg ml−1 in external solution) was applied locally with a large-bore pipette to the surface of the brain. A small amount of tissue was then removed by using suction from a pipette filled with external solution to gain unrestricted patch pipette access. Patch pipettes were made from borosilicate glass using a Sutter p-1000 puller and fire-polished after pulling using a Narishige MF-900 microforge to achieve a final resistance of 4–8 MΩ. The internal solution contained (in mM): 140 potassium aspartate, 10 4-(2-hydroxyethyl)-1-piperazineethanesulfonic acid, 1 ethylene glycol tetraacetic acid, 4 MgATP, 0.5 Na3GTP and 1 KCl. The pH was 7.3 and the osmolarity was adjusted to approximately 265 mOsm. To obtain patch-clamp recordings, DN somata were visually targeted through brief GFP excitation. Recordings were acquired in current-clamp mode with a MultiClamp 700B amplifier (Molecular Devices), low-pass filtered at 10 kHz, and digitized at 40 kHz (Digidata 1440A, Molecular Devices).

Whole-cell recording data were analysed in MATLAB using custom written code or using Clampfit 11 software (Molecular Devices), and graphical representation was carried out by using Prism 9.2.0 software (GraphPad). Spike events in response to looming stimuli were determined on the basis of the rise slope (mV ms−1) in the response region above a threshold given from the averaged maximum slope in the baseline region across individual recordings, followed by visual inspection of the raw data. The baseline region of each trial corresponded to the 2-s time window before the beginning of the looming stimulus. The response region was the 150-ms period after the onset of the stimulus. To estimate the magnitude of depolarization in response to looming stimuli, membrane potentials were averaged across individual trials (4–8 trials per neuron), and the area (ms × mV) was calculated in the 150-ms response region.

#### Visual stimulation for electrophysiology

Custom visual stimuli were produced in MATLAB using the Psychophysics Toolbox to display looming stimuli with different approach angles around the fly. We were limited in how far posterior we could show stimuli owing to constraints of the plate to which the fly was tethered to for accessing the back of the head capsule and the microscope. This was especially an issue for DNp11 recordings, as the microscope objective blocks presentation of the posterior stimuli that should most strongly excite DNp11. Thus, our strategy for assessing the functional gradient of the receptive field (RF) was to compare directly measured visual responses in the experimentally accessible visual field to responses predicted by a model we generated from the measured synaptic numbers and an alignment with the visual world (see the section below entitled Mapping the LC4 anatomical RF). Within our accessible visual area, we generated looming stimuli at 32.5°, 45°, 57.5° and 70° along the eye equator (anterior to posterior) and then pitched the plane of these stimuli down 20° to roughly coincide with the tilt of the synaptic gradients we measured. Looming stimuli from different azimuths were shown in randomized sets. Looming stimuli were arrays of three discs, black on a white background, and programmed to expand from 0° to 30° in azimuth in each disc with a 12-s inter-stimulus interval. We used three-disc vertical arrays because we wanted to use a stimulus that would produce as strong a response as possible and which could be varied in azimuth. As LC4 neurons have only an approximately 40° RF, only a handful of LC4 neurons may be excited by a single looming stimulus. Therefore, to activate more LC4 neurons along a given azimuth, we used a column of three. See Extended Data Fig. 4a for a depiction of the looming stimuli used. Visual stimuli were back-projected at 360 Hz onto a 4-inch diameter dome at 768 × 768 resolution. Stimulus frames were synchronized by simultaneously recording a photodiode with the recording trace that monitored a patch of each frame projected just outside the dome and coloured black or white on alternate frames. Constant angular velocity stimuli were generated using the following equation

$$\theta \left(t\right)={v}_{{\rm{a}}}t$$

in which $$\theta$$ is the angular size of the stimulus, $${v}_{{\rm{a}}}$$ is the angular velocity, and $$\theta$$ = 0 at $$t$$ = 0. All stimuli were corrected for distortion and irradiance differences as described previously.

#### P2X2 experiments

Whole-cell patch-clamp recordings from the GF were carried out in 2–4-day-old female flies as described above. For P2X2 receptor activation of LC4 or LPLC2 VPNs, a glass capillary pulled to a 1-μm diameter was positioned on the VPN dendrites, which expressed both GFP and the P2X2 receptor, approximately 50 μm below the surface of the brain. ATP (Sigma A9187, 5 mM) was microinjected (5 psi, 200-ms pulse) under the control of a Picospritzer (Parker Hannifin). To test dorsoventral gradients of functional connectivity between the VPNs and the GF, either the dorsal or ventral part of the lobula was stimulated in an alternating fashion at 90-s intervals to permit recovery between pulses. Whole-cell recording data were analysed as mentioned above. Before calculating the peak amplitudes of the GF response, the membrane potential traces acquired during ATP applications were low-pass filtered and averaged across individual trials as specified in the figure legends.

### Generation of single-cell STaR transgenic flies

A combination of HIFI DNA assembly (NEB) and restriction-enzyme-based cloning was used to generate either 13XLexAoP2-FRT-STOP-FRT-myr::GFP-2A-R::PEST or 13XLexAoP2-FRT-STOP-FRT-myr::tdTomato-2A-R::PEST through modification of pJFRC177 (Addgene: 10XUAS-FRT-STOP-FRT-myrGFP, plasmid no. 32149). First, the 10XUAS sequence of pJFRC177 was replaced by 13XLexAoP2 from pJFRC19 (Addgene: 13XLexAoP2-IVS-myrGFP, plasmid no. 26224). Second, the GFP-coding sequence of pJFRC177 was replaced by either GFP-2A (cassette C: GS linker-FRT-STOP-FRT-GFP-2A-LexAVP16) or tdTomato-2A (UAS-DIPalpha-2A-tdTomato), both followed by the coding sequence of R::PEST recombinase from pJFRC165 (Addgene: 20XUAS-IVS-R::PEST plasmid no. 32142). Transgenic flies were generated by integration of either construct into the VK00033 landing site using a commercial injection service (BestGene). To generate sparsely labelled VPNs with visualized presynaptic sites (sparse StaR), 13XLexAoP2-FRT-STOP-FRT-myr::GFP-2A-R::PEST constructs were recombined with StaR41 (Brp-RSRT-stop-RSRT-myr::smGdP-V5-2A-LexA, laboratory stock). Female flies carrying the recombined constructs were crossed into male flies with VPN-specific LexA driver lines and hsFLP recombinase. At 48 h after puparium formation, pupae were heat-shocked for 15 min in 37 °C water bath.

### Immunohistochemistry

Unless otherwise specified, dissected flies were aged 3–4 days post eclosion. Brains were dissected in ice-cold Schneider’s Drosophila Medium (Gibco 21720–024), and fixed in acid-free glyoxal (Addax Biosciences) containing 5% sucrose (Sigma S9378) overnight at 4 °C. Brains were rinsed repeatedly with PBST (PBS (Bioland Scientific LLC PBS01-03) containing 0.5% Triton-X100 (Sigma T9284)), and incubated in blocking solution (PBST containing 10% normal goat serum (Sigma G6767)) for 2 h at room temperature before incubation with antibodies. Brains were incubated sequentially with primary and secondary antibodies diluted in blocking solution for 24 h at 4 °C, with three rinses in PBST followed by 1 h incubations at room temperature in between and afterwards. Primary antibodies were used at 1:20 (nc82), 1:500 (chicken anti-GFP) and 1:200 (all others) dilutions. All secondary antibodies were used at 1:300 dilutions. The full list of antibodies used is available in the Reporting Summary. The technique for subsequent mounting in DPX was adapted from the Janelia protocol for mounting the central nervous system of adult Drosophila in DPX. After being washed to remove residual secondary antibodies, brains were additionally fixed with PBS containing 4% paraformaldehyde (Electron Microscopy Sciences 15710) for 3 h at room temperature, rinsed with PBS and mounted on 22 × 22-mm square No. 1.5H cover glass (Thorlabs CG15CH2) (with the posterior side of the brain facing the cover glass) previously coated with poly-l-lysine (0.078% solution in deionized water, Sigma P1524) with added 0.2% Kodak Photo-Flo 200 Solution (Electron Microscopy Sciences 74257) followed by a quick 1–2-s rinse with MilliQ water. Brains were dehydrated by placing the cover glass into baths with successively increasing ethanol (Sigma 459844) concentrations (30–50–75–95–100–100–100%, 10 min each) followed by three successive baths of xylene (Thermo Fisher Scientific X5–500), 5 min each. Afterwards the glass was uniformly covered with 8–10 drops of DPX (Electron Microscopy Sciences 13510) and placed on a prepared slide between the spacers made of two 22 × 22 mm square No. 2 cover glasses (Fisher Scientific 12-540B). The slide was left for 24 h in the hood for drying, and then transferred to room temperature and imaged at least 24 h afterwards,

### Confocal image acquisition and processing

Immunofluorescence images were acquired using a Zeiss LSM 880 confocal microscope with Zen digital imaging software using an oil-immersion ×63 objective. Serial optical sections were obtained from whole-mount brains with a typical resolution of 1,024 μm × 1,024 μm × 0.5 μm. Image stacks were exported to Imaris 9.7 for level adjustment, cropping and removal of signal in off-target brain regions and background noise, as well as 3D volume reconstructions.

### Analysis of neuroanatomical data from confocal image stacks

To assess and measure the differential placement of DN dendrites within the LC4 glomerulus, confocal image stacks of colocalized glomeruli and DN dendrites were aligned so that the x axis corresponded to the sagittal diameter (width) of the glomerulus and cropped at the edges of the glomerulus to exclude any extraglomerular DN dendrites from consideration. 3D reconstructions of LC4 axon terminals and DN dendrites were obtained using the Imaris Filaments tool (Extended Data Fig. 10b). The x coordinates of the filaments were exported to GraphPad Prism 9.2.0 and normalized to the sagittal diameter of the LC4 glomerulus (0–1 range). The x coordinate of the centroid of the DN dendritic arbour was calculated as a mean of x coordinates of all filaments and used as a final metric of spatial distribution of dendrites within the glomerulus (Extended Data Fig. 10c).

To assess the spatial proximity between presynaptic sites of individual LC4 or LPLC2 neurons and DN dendrites (single-cell STaR experiments), Brp puncta in single VPN cells were reconstructed using the Imaris Spots tool, followed by identification of their centroids, as well as centroids of reconstructed dendritic filaments. Distance between Brp puncta and DN dendrite centroids was measured along the sagittal diameter of the glomerulus (LC4) or along three cardinal axes (A–P, D–V and L–M) of the glomerulus (for LPLC2). Only female flies were used for analysis to be consistent with the available connectome data, which are in a female fly. Analyser was not blinded to genotype due to characteristic identifiable morphology of DNp02, DNp11 and DNp04, as well as clear anatomical positions of anterior–posterior LC4 and LPLC2.

### Connectomics analysis

#### FAFB connectome reconstruction analysis

We annotated the FAFB serial section transmission EM volume using the CATMAID software to determine the chemical synaptic connectivity between the LC4 neurons and four DNs of interest, DNp02, DNp11, GF and DNp04. As a starting point, we used previously traced skeletons for LC4 neurons. To start tracing the DNs, we used morphological cues from confocal fluorescence imaging in distinct strategies to locate a starting point for tracing each DN. For DNp02, confocal microscopy stacks suggested that the somata neurite travels close to the path of the GF somata neurite. We found DNp02 by locating its neurite within a shared soma tract, which, along with several other neurites, appears encased in a dark sheath. DNp04 was located when tracing the LC4 neurons. The skeleton was then traced out and linked to the same soma tract as DNp02 and GF. DNp11 was located by searching for candidate DNs that cross the midline dorsal of the oesophagus. From each starting node, the full skeleton was traced and compared to the confocal image stacks for confirmation of cell type identity. To determine the chemical synaptic connectivity, we searched for four criteria: T-bars, presynaptic vesicles, synaptic clefts and postsynaptic densities. If a potential synapse possessed two out of four criteria, it was labelled as a synapse. We focused our efforts on LC4 (presynaptic) and DNp02, DNp11, GF and DNp04 (postsynaptic) synapses to gain a representative view of the connectivity between LC4 and the DNs.

#### Mapping the LC4 anatomical RF

To model the real-world RFs of the LC4 population, we followed a previously established method25, and applied it to newly reconstructed LC4 neurons. We first mapped all 55 LC4 dendrites (FAFB volume) onto a layer of the lobula by fitting a second-order surface to all of the dendritic arbours. Each projected dendrite traced out a polygon that represented the field of view of the corresponding LC4 neuron. We modelled each LC4 as a 2D circular Gaussian on this surface. Its height was set to be unity, and its width was given by the radius of a circle that had the same area as the projected polygon. To map each LC4 neuron’s location (COM of the dendrite) onto eye coordinates, we used as reference points previously reconstructed Tm5 neurons25 from two medulla columns, which correspond to the centre of the eye and a dorsal position on the central meridian (the line that partitions the eye between anterior and posterior halves). To estimate an LC4-DN’s RF, we first multiplied each LC4 Gaussian’s height by the number of synaptic connections to that LC4-DN. We then summed all LC4 Gaussians to produce a 2D multi-Gaussian distribution, which was the LC4-DN’s RF. To estimate an LC4-DN’s response to a looming stimulus, we multiplied the LC4 Gaussian’s height by both the number of synaptic connections and the percentage of the LC4 RF that was covered by the stimulus at its maximum size (30°). For instance, if the stimulus overlapped with 40% of an LC4‘s RF, then that LC4 Gaussian’s effective height was the number of connections times 0.4. Finally, all LC4 contributions were summed to produce the estimated response of the LC4-DN to the looming stimulus. Note that LC4s that did not overlap at all with a stimulus contributed nothing to the DN’s response.

#### Hemibrain connectome reconstruction analysis

Volumetric data of neurons and neuropils, as well as connectivity data and synapse locations, were obtained from the neuPrint (hemibrain v1.1) database, (https://neuprint.janelia.org/) and have been processed with the natverse package51 for R (v4.0.3) using custom scripts. All coordinates in these datasets are based on the original voxel resolution of 8 nm.

### k-means clustering of individual neurons within VPN cell type populations

For each VPN cell type, a matrix of synaptic connections between individual VPN neurons and their postsynaptic partners was constructed using the neuprintR package. Postsynaptic partners forming fewer than 50 total synapses with the entire VPN cell type population were excluded (about 1 synapse per individual VPN on average; we reasoned that this threshold would reflect the limit of EM data reconstruction error rate). Synaptic connections within the population of VPN cell type were also removed (for example, LC4 to LC4 synapses). The resulting matrix was scaled such that the variables (individual postsynaptic partners) had unit variance across the observations (individual VPN cells in the population). Principal component analysis was carried out on the scaled matrix. Up to ten principal components were used for k-means clustering on the individual VPNs (the number of PCs was determined on the basis of the drop in the eigenvalues in the scree plots for each VPN type). A value of k was subsequently determined from the corresponding scree plots by the drop in the within-cluster sum of squared distance (example in Extended Data Fig. 6a).

### Correlation in synaptic connectivity

Matrices of correlation in synaptic connectivity (Fig. 4d,f) were generated using the pairwise Spearman’s correlation coefficient of the 300 unique pairs derived from the top 25 postsynaptic partners (based on the total number of synapses and excluding connections with the same VPN cell type) of LC4 and LPLC2, ordered using hierarchical clustering. Each entry evaluates the monotonic relationship between a pair of the synaptic connectivity gradients. For each pair, the correlation coefficient was calculated using the vectors containing the number of synapses between the selected postsynaptic partners and each individual VPN cell within the population (example in Fig. 2h).

### Weighted cendritic centroids

To evaluate the distances between weighted dendritic map centroids for each postsynaptic partner of LC4 and LPLC2, we identified the endpoints of the dendrites innervating the lobula for each individual VPN cell. These were isolated using cut-planes that were manually selected to optimally separate the lobula region (Extended Data Fig. 9a–d). We then evaluated the centroid of the selected endpoints by calculating their spatial average. We repeated these steps for all VPN cells within a population (71 for LC4 and 85 for LPLC2). The resulting 3D centroids were then projected onto the cut-plane. The outlines of the lobula were obtained by evaluating the convex hull of the projections of all the selected endpoints for all of the cells of the examined VPN. To identify a weighted innervation centroid for a given postsynaptic partner, we calculated the overall weighted median using the number of synapses associated with each centroid as weights. We then identified the top anticorrelated pairs of postsynaptic partners by selecting those for which the Spearman’s correlation coefficient is below a certain threshold that was determined by evaluating, for each VPN, the value that optimizes the correlation between the dendritic map and the synaptic connectivity correlation. For each one of these top pairs, we estimated the perpendicular to the line connecting the corresponding weighted median centroids. These lines were combined using the median operator to reduce the influence of potential outliers. This resulted in a single line identifying the optimal unbiased separator of the most anticorrelated pairs (median separation line in Fig. 4e,g). The distance between their projections onto the line perpendicular to the optimal separator (projection line in Fig. 4e,g) was used as a final metric to generate the matrix and calculated for each pair of postsynaptic partners (Extended Data Fig. 9g,h). The projection line for LC4 was almost parallel to the A–P axis of the lobula (Fig. 4e), and slightly deviated from that for LPLC2 owing to the dual nature of synaptic gradients in this cell type (both A–P and D–V).

### Spatial distribution of postsynaptic sites in optic glomeruli

A similar approach based on the estimation of an unbiased separator was used to evaluate the correlation between the centroids of postsynaptic sites for postsynaptic partners of VPNs. To estimate this separator, we started by isolating all postsynaptic sites within the glomerulus using a cut-plane. We then selected the top anticorrelated pairs of postsynaptic partners, in a manner similar to how we analysed the dendritic map centroids. For each pair, we split the postsynaptic sites into two different classes depending on the postsynaptic partner they belonged to and used a support vector machine with a linear kernel to evaluate the optimal separating plane. We then computed the median of these planes. This resulted in a single plane identifying the unbiased optimal separator of the most anticorrelated pairs (median separation plane in Fig. 6b,j). We then projected the postsynaptic sites of each postsynaptic partner onto the line perpendicular to the optimal separator and calculated the distance between the median of the respective projections. The distance matrices for a given VPN cell type were obtained by calculating the pairwise distances between each of the 300 pairs of postsynaptic partners of LC4 and LPLC2 (Extended Data Fig. 9i,j). For selected pairs of postsynaptic neurons, the distributions of postsynaptic sites projections were compared using the two-sample Kolmogorov–Smirnov test (Fig. 6b,j).

### Assessment of topographic mapping in VPN optic glomeruli

Skeletons of individual neurons within each VPN cell type were selected manually on the basis of A–P and D–V topographic location of their dendrites and/or the pattern of k-means clustering of the dendritic maps (15 cells per topographic domain, unless stated otherwise in the figure legends). Groups of neurons with dendrites in different topographic domains were differentially coloured. Axonal processes of the corresponding neurons were traced in the optic glomerulus and visually examined for traces of spatially ordered organization. LC10 neurons were excluded from the analysis owing to previously reported A–P axonal topography6,13. LC6 neurons were excluded owing to previous extensive analysis25 indicating the presence of coarse glomerular retinotopy inaccessible through visual examination.

### Statistical analysis

All statistical analyses were carried out in RStudio 1.4.1103, MATLAB or Prism 9.2.0 software (GraphPad). NS: > 0.05, *P < 0.05, **P < 0.01, ***P < 0.001 and ****P < 0.0001 for all figures where applicable. Statistical tests for Figs. 1e and 3e,h and Extended Data Figs. 1,2,4 and 12 are described in Supplementary Table 1. In all box plots (Fig. 6 and Extended Data Fig. 11), the solid line depicts the median; the upper and lower bounds of the box depict the third and first quantiles of the data spread, respectively. Whiskers indicate minimum and maximum values. All other statistical tests, number of replicates, statistical significance levels and other elements of statistical analysis are reported in the corresponding section of the Methods, along with the associated results and/or in the corresponding figure legends. No data were excluded from the analysis except as noted for the behaviour experiments (see the section in the Methods entitled Behavioural data analysis). All measurements were taken from distinct samples.

### Reporting summary

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