Main

Social cues are essential for coordinating interactions between individuals, facilitating the emergence of group dynamics including mating, aggression and collective foraging8,9,10. Yet social interactions do not occur in isolation. Rather, they unfold in a broader environmental context that structures when, where and how social behaviours are expressed. Courtship and mating, for example, often take place at ecologically privileged locations—food sources1,2, prominent visual landmarks3,4 or suitable nesting sites5,6—where many individuals aggregate, either to increase their encounters with prospective sexual partners or to access key resources that promote reproductive success. In these settings, a central component of the environment is the social collective itself: the multisensory backdrop that emerges from the movement, sensory signals and interactions across all individuals in a group11,12,13,14. Social behaviours are therefore likely shaped by both the static properties of the physical environment and the dynamic features of the social landscape. Yet the neural mechanisms that integrate these distinct sensory streams to regulate social arousal states and structure interindividual interactions remain largely unknown.

The mating behaviours of Drosophila offer a powerful inroad to explore how animals adapt to complex ecological and social landscapes. Species in the Drosophila genus vary widely in their ecology and geographic distribution15,16,17,18,19,20, raising the possibility that mating strategies have evolved in concert with the diverse sensory environments in which reproduction occurs. Many species, including members of the Drosophila melanogaster subgroup, mate on their host plants, typically decaying ephemeral substrates where many individuals congregate17, creating a complex social backdrop for reproduction. Other species reproduce in more isolated social settings. Drosophila elegans, for example, establish individual territories and mate on their host flowers19, whereas species of the Hawaiian subgroup perform competitive lekking in the vegetation surrounding their hosts20. The evolution of Drosophila courtship behaviours may therefore have been shaped by the distinct sensory ecology of a species’ mating site and the structure and dynamics of the social groups that form there.

Reproduction and population density in Drosophila erecta, a close relative of D. melanogaster, are tightly linked to the seasonal availability of its host fruit—the screwpine Pandanus21—creating a narrow window of opportunity for individuals to meet and mate22. Such restricted access raises the possibility that D. erecta has evolved behavioural adaptations that couple reproduction to sensory cues emanating from its host, allowing environmental signals not associated with sexual communication to shape mating behaviour. Here we show that the olfactory volatiles emanating from a food patch exert both direct and indirect control over courtship in D. erecta. We find that food volatiles serve as a potent environmental trigger in this species, driving aggregation and serving as a stringent sensory gate to control a male’s sexual arousal. In parallel, environmental food odours shape the visual landscape in which courtship unfolds by encouraging males to approach and sample prospective mates, amplifying visual motion to transform the sensory backdrop of the social scene. D. erecta males are highly sensitive to this increase in visual motion, in contrast to D. melanogaster, pointing to the evolution of a multisensory feedback loop that coordinates male sexual arousal across members of the group, linking courtship to the broader social context. We show that species-specific differences in the sensitivity to environmental cues seem to arise from variation in how olfactory information impinges on conserved components of the courtship circuitry, indicating a potential neural substrate for the rapid tuning of sensory thresholds that govern sexual arousal. Together, these findings show how both ecological and social cues shape species-specific reproductive strategies. Moreover, our observations underscore that the social landscape forms an integral part of the environment—both reflecting the collective dynamics of the group and actively shaping the sensory experience of each individual in it.

Odour cues gate D. erecta courtship

To investigate how environmental factors shape the reproductive decisions of species with different ecological preferences, we compared the dynamics of groups of D. erecta and D. melanogaster (five males and five females) provided with a small patch of agar perfumed with food volatiles (diameter 21.5 mm) at the centre of a large arena (diameter 190 mm), a configuration intended to mimic the presence of a localized feeding site (Fig. 1a). Although D. erecta and D. melanogaster have distinct hosts and divergent olfactory preferences16,23, both feed on the yeast microbiota that metabolize decaying fruits and thus display attraction to volatiles arising from fermentation15,24. We therefore used apple cider vinegar (ACV), a broadly appetitive fermentation product, as a generic ‘host’ odour to compare how the chemical environment influences mating behaviours. Flies were fed and maintained as virgins in these assays to minimize their motivation to track towards the odour source for purely metabolic needs or in search of an oviposition site.

Fig. 1: D. erecta courtship and mating rely on the presence of ACV.

a, Schematic of large group assay comprising five males and five females in 190-mm arena with a 21.5-mm central food patch. b,c, Top, overlaid trajectories (grey) from representative D. erecta (D. ere) (b) and D. melanogaster (D. mel) (c) assays with agar (left) or ACV patch (right). Trajectory of one fly highlighted in black. Bottom, raster plots depicting the position of each fly relative to the patch over the duration of the assay, aligned by first patch entry (n = 7–10 assays). Patch occupancy is indicated in blue (agar) and orange (ACV). Greyscale indicates linear distance to patch, with lighter shades indicating closer proximity. d–f, Copulations and patch occupancy in assays from b,c. Copulation locations in the presence of ACV (orange) or agar patch (blue) (d). Mean patch occupancy per assay (e). Fraction of females copulated per assay (f). g, Schematic of high-density group assay comprising five males and five females in 38-mm arena with a 21.5-mm food patch. h,i, Courtship index (h) and latency to male courtship initiation (i) for D. erecta (n = 7–8 assays) and D. melanogaster (n = 6 assays). j, Phylogenetic relationships50,51 (left) and courtship indices (right) for D. orena (D. ore; n = 4–5 assays), D. yakuba (D. yak; n = 6–7 assays), D. sechellia (D. sec; n = 7 assays) and D. elegans (D. ele; n = 11 assays) males in small-arena assays. k–m, Social interactions in small-arena assays from h. Distributions of male–female distances for the duration of the assay (solid line represents mean, shading indicates ± standard error (s.e.)) or during bouts of courtship (dotted line, mean), shown for the full range (top) or for close-range interactions only (bottom) (k). Probability (p) of courtship (mean ± s.e.) in the first 10 min (left) or 1 min (centre, right) after courtship initiation (court. init.); centre shows expanded interval corresponding to dotted box at left (l). Mean interaction rate of D. erecta males towards any other fly over the duration of an assay (bold line; individual assays, thin lines) (m, top). Ethograms from representative agar (left, blue) and ACV (right, orange) assays showing interactions with other males (open circles), females (closed circles) and copulations (red circles and lines) (m, bottom). Throughout the figure, data pertaining to agar and ACV are in blue and orange, respectively. Dots in e and f are assay means; dots in h–j are individual males; horizontal bars in dot plots represent the mean. NS, not significant; *P ≤ 0.05; **P < 0.001; ***P < 0.0001. See Supplementary Table 1 for full statistics. 

Source data

We found that in the context of the localized ACV patch, these two ecologically disparate species displayed distinct patterns of behaviour. D. melanogaster broadly explored the arena, giving rise to a dispersed spatial distribution where individuals interacted mostly in pairs and only intermittently in larger groups (Fig. 1c, Extended Data Fig. 1a–e and Supplementary Video 1). By contrast, D. erecta individuals rapidly approached the central ACV patch and remained there for extended bouts (Fig. 1b,e and Extended Data Fig. 1a,b), forming dynamic clusters of three or more interacting flies (Extended Data Fig. 1c–e). D. erecta did not congregate on a patch composed of agar alone (Fig. 1b,e, Extended Data Fig. 1b,f,g and Supplementary Video 1), indicating that food volatiles act as a potent aggregation cue in this species. Consistent with the notion that aggregation serves a social function in D. erecta, more than 90% of their copulations occurred on the ACV patch, in comparison to the spatially dispersed mating observed in D. melanogaster (Fig. 1d,f and Extended Data Fig. 1h). Comparable differences in aggregation and mating behaviour were also apparent when D. erecta and D. melanogaster were presented with a food patch made from the ripe pulp of D. erecta’s native host Pandanus candelabrum (Extended Data Fig. 1i–l), aligned with evidence that ACV shares several key volatiles with the bouquet of fermenting Pandanus fruit25,26,27. Notably, D. erecta refrained from mating entirely in the absence of ACV or Pandanus (Fig. 1f), highlighting the importance of the food patch as a site of reproductive opportunities in this species.

The ACV patch could facilitate mating in D. erecta by simply aggregating individuals, creating a dense social landscape where interactions between males and females are enhanced by proximity. Alternatively, ACV may directly elevate the sexual arousal of males or females on their arrival to the patch. To differentiate between these possibilities, we assessed the courtship dynamics of groups of five males and five females confined to a smaller chamber (diameter 38 mm, 4% area of the large arena; Fig. 1g), allowing us to decouple the effect of spatial proximity from the influence of the chemosensory environment. D. melanogaster males courted vigorously in this arena, independent of the presence of ACV (Fig. 1h and Supplementary Video 2). By contrast, D. erecta males courted only when ACV was present but rarely in its absence, despite the high density of flies (Fig. 1h,i and Supplementary Video 2). Indeed, D. erecta remained dispersed on an agar-only patch (Fig. 1k and Extended Data Fig. 2a), with males rarely approaching or pursuing individuals of either sex (Fig. 1m and Extended Data Fig. 2b,c). In the presence of ACV, however, the spatial distribution of D. erecta individuals was transformed, displaying a pronounced peak at 3 mm (Fig. 1k)—the interfly distance characteristic of courtship pursuit—along with a broad tail, reflecting the dynamic interactions of males as they indiscriminately advanced towards any individual who came into their field of view (FOV) (Fig. 1m and Extended Data Fig. 2d). The rare instances of D. erecta courtship on agar were transient, in contrast to the persistent pursuit observed in the presence of ACV (Fig. 1l,m). ACV thus seems to influence mating behaviours in D. erecta not simply by aggregating males and females but by restructuring their social dynamics.

Different strains of D. melanogaster vary markedly in their sensitivity to courtship cues28. Nevertheless, several strains, including a Cameroonian isolate collected within the overlapping geographic range of D. erecta, courted vigorously even in the absence of ACV (Extended Data Fig. 2e), indicating that the lack of reliance on this environmental signal is a broadly shared trait in this species. Although the limited availability of D. erecta strains precluded a comparable analysis of intraspecific variation, these results indicate that the food volatiles of ACV in D. melanogaster and D. erecta cannot be readily explained by variation within species and instead point to species-level differences in the sensory control of courtship. We therefore extended our analyses to related Drosophila species with distinct host ecologies. Unlike D. erecta, its sister species Drosophila orena, which specializes on Syzygium waterberries18, the closely related generalist Drosophila yakuba16 and the more distantly related specialist Drosophila sechellia, which breeds on Morinda citrifolia17, all vigorously courted conspecifics in both the presence and absence of ACV (Fig. 1j). By contrast, ACV suppressed courtship in D. elegans, a specialist that reproduces on Ipomoea blossoms19, potentially reflecting the limited chemical overlap between ACV and the volatile bouquet of its floral host29. Thus, although the influence of the chemosensory environment on reproductive behaviours varies across species, D. erecta males appear to have evolved a unique dependence on food volatiles to promote their courtship.

Odour cues promote social exploration

How does the chemosensory environment transform the structure of the D. erecta social landscape? Because interactions between individuals were more frequent on ACV, we reasoned that food odours may heighten the salience of visual objects. To explore this possibility, we presented individual males with a stationary fly-sized target—a high-contrast hemispherical bead, 3 mm in diameter (Fig. 2a)—and assessed whether ACV altered their interactions with it. D. melanogaster males were largely indifferent to this visual target, independent of the presence of ACV, spending most of their time circling the perimeter of the arena. D. erecta males, by contrast, remained in close proximity to the bead, an effect that was enhanced by ACV (Fig. 2b,c, Extended Data Fig. 3a–d and Supplementary Video 3). Optogenetic activation of most olfactory sensory neurons using the Orco promoter (Fig. 2d), which replicates the attractive valence of ACV in D. melanogaster30, was sufficient to promote attraction to the bead in D. erecta males on agar, confirming that olfactory input underlies this shift in visual salience (Fig. 2e,f, Extended Data Fig. 3e,f and Supplementary Video 4). Visual approach was not enhanced by the same optogenetic manipulation in D. melanogaster males, underscoring that in D. erecta, olfactory input exerts a species-specific influence on how males interact with their visual surroundings.

Fig. 2: Olfactory cues promote visual exploration in D. erecta males.

a, Schematic of bead assay with a male and a female-sized hemispherical bead (approximately 3 mm) centred on a food patch. b, Mean spatial distribution of D. erecta (top, n = 15–18) and D. melanogaster (bottom, n = 8) males on agar (left) or ACV (right). Colour bar indicates relative density. c, Left, trajectories of males in b during the first minute after a fly comes within 3 mm of the bead. Right, bead approaches per minute. d, Left, schematic of olfactory appendages innervated by Orco+ sensory neurons (green). Centre, their projections to the antennal lobes (green). Right, optogenetic bead assay with overhead LEDs. e, Trajectories of D. erecta (top, n = 18) and D. melanogaster (bottom, n = 12) Orco>CsChrimson males in the 2 min before (left, pre) and during (right, LED on) optogenetic activation. f, Left, raster of individual bead approaches over time (circles) for males in e. Right, bead approaches per minute in comparison to control flies reared without retinal (−Ret ctrl; D. erecta, n = 13; D. melanogaster, n = 12) before or during optogenetic activation. Light alone modestly enhances approach, independent of rearing condition. g, Schematic of grid assay containing a lattice of 13 hemispherical beads distributed across a 145-mm food patch. Bead sizes enlarged for clarity. h–l, Behaviour of groups of five males in the bead grid (n = 5 assays per condition). Trajectories on agar (left) or ACV (right) over 20 min (h). Mean approaches per male to each bead, indicated by circle colour and size (i). Bead approaches (black dots) by individual males (rows) over the 20-min assay for representative assays (j). Total number of distinct beads visited (k) and approaches per minute (l) for each male. m, Grid assay with one bead replaced by an immobilized female (♀). Example 20-min male trajectory before (grey) and after (green) first female encounter. n, Distance to the closest bead (top) or immobilized female (bottom), aligned to time of first female encounter (grey dotted line; n = 8; thick line, mean; thin lines, individual males). Red dotted line indicates distance of one fly length (3 mm). o, Song bouts for males in n during bead approaches before (black) and after (green) female encounter. p, Fraction of D. erecta males encountering the female during 20-min assays on agar and ACV (n = 9 assays). Dots in dot plots represent individual males; horizontal bars indicate means. NS: not significant; *P ≤ 0.05; **P < 0.001; ***P < 0.0001. See Supplementary Table 1 for full statistics. Schematics in d adapted from ref. 43, Springer Nature Limited. 

Source data

Despite the strong attraction of D. erecta males to the bead on ACV, they frequently walked away before returning to it, generating a distinctive radial pattern as males alternated between approach and retreat (Fig. 2c and Supplementary Video 3), suggesting that the olfactory environment may also promote visual exploration. To examine this, we placed five D. erecta males in a large arena (diameter 190 mm) decorated with a lattice of 13 beads arranged in a regular square array (Fig. 2g; distance along edge 30 mm). In the presence of ACV, males spent most of their time near one of the targets but also frequently traversed between them (Extended Data Fig. 3h,i), often taking the shortest route (Fig. 2h–l and Supplementary Video 5). On agar, males restricted their exploration to a small fraction of the arena, remaining at their starting location or near the bead closest to it and rarely visiting any other visual targets (Fig. 2h–l, Extended Data Fig. 3h,i and Supplementary Video 5). Comparing the trajectories of solitary males showed that they display a similar shift in their behaviour in the presence of ACV (Extended Data Fig. 3j), indicating that visual sampling is driven by the chemical, not social, context. Without the bead lattice, males on ACV showed no spatial bias and remained broadly distributed across the arena (Extended Data Fig. 3h). By contrast, the visual exploration of D. melanogaster males was unaffected by the chemosensory environment (Extended Data Fig. 3k–o). Olfactory cues thus selectively promote exploration in D. erecta males.

Beads, although attractive visual targets to males, rarely evoked courtship displays such as the wing extensions associated with song production, indicating they are not perceived as potential mates (Extended Data Fig. 3p). Indeed, replacing a single bead in the array with a decapitated female shifted the search dynamics of males: on encountering the female, males often terminated their exploration and maintained her at close range (Fig. 2m,n and Extended Data Fig. 3q,r). Males occasionally resumed exploration of nearby beads after encountering the female but now often sang as they approached (Fig. 2o), indicating that the distinct cuticular pheromones carried by D. erecta females altered the males’ interpretation of visual targets, triggering a shift from exploration to courtship. Males on agar failed to locate the female in the bead lattice (Fig. 2p), suggesting that their limited exploration in the absence of food volatiles hinders their ability to detect or pursue prospective female mates. Thus, ACV promotes locomotion in D. erecta males to drive more frequent sampling of visual objects in their environment, supporting a form of ‘social foraging’ in which they search for reproductive opportunities rather than food resources.

ACV sustains male sexual arousal

In D. melanogaster, courtship is triggered by recognition of an appropriate conspecific female, a behavioural switch mediated by a network of male-specific P1 neurons that integrate multisensory signals—including direct excitatory input from pheromone pathways—to gate entry into a persistent arousal state31,32,33,34. D. erecta females, like their D. melanogaster counterparts, produce sex- and species-specific cuticular hydrocarbons35 that robustly excite the P1 neurons of conspecific males36, indicating that they similarly serve as chemical determinants of mate recognition. Food volatiles could therefore facilitate D. erecta courtship simply by encouraging males to approach females and sample their pheromonal cues. Yet even in the rare instances when D. erecta males initiated courtship on agar, their pursuit was fleeting (Fig. 1l,m), pointing to the possibility that food volatiles are required not only to promote encounters with females but also to sustain male sexual arousal in this species.

Consistent with this, although optogenetic activation of P1 neurons in D. melanogaster is sufficient to evoke persistent courtship37,38, in D. erecta it triggered only transient courtship bouts towards an immobilized female in the absence of ACV, with males rapidly resuming indifference after the optogenetic stimulus (Fig. 3a,b). By contrast, in the presence of ACV, P1 neuron activation drove sustained courtship in D. erecta males, suggesting that although P1 neurons promote entry into a state of sexual arousal, olfactory cues are required for its perpetuation. This olfactory dependence extended to pursuit of a moving visual target. In the absence of ACV, P1 neuron activation evoked only brief bouts of courtship towards a fly-sized 3-mm projected dot rotating on the floor of the assay chamber, whereas in the presence of ACV, males pursued and sang to the target spontaneously, even without P1 activation (Fig. 3c–f and Supplementary Videos 6 and 7).

Fig. 3: ACV promotes sustained courtship pursuit in D. erecta males.

a, Schematic of P1 neurons (green; top) activated in optogenetic assay with a male and an immobilized (decapitated) female target centred in a small arena (bottom). b, Fraction of D. erecta males courting the female before, during (LED on) and after optogenetic activation on agar (top) and ACV (bottom) for P1>CsChrimson males (solid line) and genetic controls (dotted line). Lines show mean ± s.e. Note that males have only a limited time to encounter the female, in comparison to Fig. 2m. c, Schematic of projector assay in which a fly-sized dot rotates at constant velocity. d, Left, tracking index before (pre), during (LED) and after (post) P1 neuron activation. Centre, fraction of males tracking. Right, raster of tracking bouts over time for D. erecta males on agar (top, blue) or ACV (bottom, orange) (n = 10). Grey box indicates time of LED stimulation. Lines indicate means, shading indicates ± s.e. P1>CsChrimson males are coloured; genetic controls are shown in black. e, Schematic of projector assay for wild-type males with a fast, constantly rotating visual target (32 mm s−1) projected on the chamber floor. f, Left, tracking index of D. erecta males on agar (blue, n = 7) or ACV (orange, n = 8). Centre, heatmap depicting target position relative to the male’s egocentric orientation (facing towards right). Right, overlaid male trajectories during target presentation. NS: not significant; *P ≤ 0.05; ***P < 0.0001. See Supplementary Table 1 for full statistics. Schematic in a adapted from ref. 43, Springer Nature Limited. 

Source data

To determine whether continuous olfactory input is required to sustain a male’s arousal, we leveraged the fact that tethered males will spontaneously court a fly-sized visual target projected onto a panorama, faithfully tracking its motion while singing to it38 (Fig. 4a). D. erecta males were largely indifferent to this visual target alone but initiated robust pursuit upon presentation of ACV (Fig. 4b,c,e,f, Extended Data Fig. 4 and Supplementary Video 8). Notably, courtship tracking was transient, with males rapidly terminating their pursuit at the offset of the odour stimulus, reinforcing that ACV is required for the perpetuation of arousal (Fig. 4e,f and Extended Data Fig. 4b–d). D. melanogaster males, by contrast, commenced courtship pursuit at the onset of the visual stimulus and persistently tracked it for the duration of the assay (Fig. 4c,e,f), consistent with evidence that visual cues are sufficient to arouse males of this species, even in the absence of further sensory feedback33,38 (Extended Data Fig. 5).

Fig. 4: ACV odour recruits central courtship circuitry in D. erecta for persistent pursuit.

a, Schematic of two-photon (2P) imaging setup in which tethered flies viewed a rotating visual target projected onto a panorama while receiving clean air or ACV. b, Representative D. erecta male trajectory in virtual space before (black line) and during (orange line) ACV presentation while the visual target is present. VR, virtual reality. c, Visual target position (top) and change in heading for representative D. erecta (centre) and D. melanogaster (bottom) males in clean air (left) and ACV (right). d, Circuit diagram depicting how P1 neuron activity modulates the gain of LC10a visual projection neurons to mediate courtship pursuit38,39. e,f, P1 (e) and LC10a (f) activity and visual tracking in D. erecta (left; P1, n = 5 flies, LC10a, n = 6) and D. melanogaster (right; n = 5 each) males before (pre), during and after (post) ACV presentation (orange). The visual target began to oscillate continuously following an initial 30-s baseline, as indicated by the arrow. Top, neural activity trace (∆F/F). Centre, tracking index. Bottom, mean neural activity and probability of tracking. Thick lines show the mean of individual males (thin lines). Black box in pictogram indicates imaging region. g, Left, P1 and LC10a neural activity in the absence of a visual target in D. erecta (top; P1, n = 5; LC10a, n = 6) and D. melanogaster (bottom; n = 5 each) males. Right, mean P1 or LC10a neural activity. h, Top, representative P1 responses evoked by tapping a conspecific female in D. erecta or D. melanogaster males in clean air. Tick marks indicate taps. Bottom, schematic of tapping assay (left), mean tap-evoked P1 responses in clean air and ACV (centre) and corresponding peak responses (right) for D. erecta and D. melanogaster males (n = 7 each). *P ≤ 0.05; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. Schematics in a and h adapted from ref. 38, Springer Nature Limited; schematics in e–h adapted from ref. 43, Springer Nature Limited. 

Source data

In D. melanogaster, P1 neurons dynamically modulate the gain of LC10a visual projection neurons via a multisynaptic pathway38,39 (Fig. 4d), forming a concise visuomotor circuit that mediates a male’s faithful courtship pursuit when he is sexually aroused. To assess whether this gain control mechanism is conserved, we generated selective genetic drivers that allowed us to record activity from P1 or LC10a neurons in D. erecta males during courtship pursuit. Despite the divergent sensory dependencies of courtship across species, the activity of P1 neurons was correlated with bouts of pursuit in both D. erecta and D. melanogaster (Fig. 4e and Extended Data Fig. 6). Likewise, LC10a visual responses were amplified during courtship in both species, with robust activation each time the target swept in the progressive direction across the male’s ipsilateral visual field during epochs of active pursuit (Fig. 4f and Extended Data Fig. 7a–c). These observations point to a conserved circuit organization in which the gain of LC10a visual responses is dynamically modulated by a male’s sexual arousal to orchestrate mate pursuit in both species. However, whereas visual cues alone are sufficient to vigorously arouse D. melanogaster males, D. erecta males additionally require continuous olfactory input, which appears to act as a stringent species-specific gate to sustain courtship in this species.

Notably, neither LC10a neurons nor the subset of P1 neurons labelled by our genetic driver were activated by ACV (Fig. 4g), indicating that food volatiles do not sustain arousal through direct olfactory input to these conserved circuit components. Moreover, ACV did not alter P1 responses to female pheromones in either D. erecta or D. melanogaster males (Fig. 4h), reinforcing that food odours do not simply tune the excitability of this integrative node to control a male’s arousal. Rather, we found that ACV activates an array of distributed neurons labelled by the sexually dimorphic Fruitless (Fru) and Doublesex (Dsx) transcription factors (Extended Data Figs. 7d–j and 8). These include subsets of neurons innervating the anterior optic tubercle (AOTu), to which LC10a neurons send their axonal projections, and the lateral protocerebral complex (LPC), which is richly innervated by P1 neurons, consistent with olfactory pathways responsive to environmental food odours converging with sexually dimorphic courtship circuits.

Within the LPC, conspecific female pheromones and ACV activated spatially segregated populations of dsx-expressing neurons, suggesting that sexual and environmental chemosensory signals impinge on these central courtship circuits through parallel pathways (Extended Data Fig. 8). This functional organization aligns with connectomic analyses in D. melanogaster, which show that distinct sensory pathways controlling male courtship act through different subsets of P1 neurons and their downstream targets34. Similar spatially segregated responses to female pheromones and ACV were also apparent in the LPC of D. melanogaster and D. yakuba males (Extended Data Fig. 8), species that court conspecifics regardless of the presence of food volatiles (Fig. 1h,j). The conservation of ACV-responsive populations across species may therefore provide a neural substrate for the latent potential of food odours to promote courtship when other sensory cues are experimentally impoverished, such as in the presence of inanimate visual targets (Extended Data Fig. 5). Despite this conservation, among the species we examined, D. erecta males uniquely depend on ACV to sustain courtship of conspecific females, even when P1 neurons are activated to trigger a state of sexual arousal (Fig. 3b,d). Thus, environmental olfactory signals appear to be differentially weighted across species, serving as a stringent gate for persistent sexual arousal in D. erecta, potentially through sexually dimorphic regulatory nodes that interact with, but remain distinct from, the circuitry mediating mate recognition. In support of this possibility, D. erecta males still discriminate between potential mates even when highly aroused on a food patch, avoiding courtship of unsuitable heterospecific females on the basis of the detection of their inhibitory pheromones (Extended Data Fig. 9a).

Visual motion promotes courtship

How do environmental food volatiles and visual cues coordinately shape male behaviour in naturalistic contexts, where many flies aggregate on a food patch? By driving D. erecta males to sample and pursue visual targets (Fig. 2), ACV results in an increase in fly locomotion that scales with the size of the group (Extended Data Fig. 9b–d). In the context of larger aggregates of flies, this odour-dependent shift in locomotion dramatically altered each male’s visual experience (Fig. 5a–e), expanding the fraction of his visual field occupied by other flies (Fig. 5d) and increasing the visual motion sweeping across his retina (Fig. 5a–c,e). Notably, males and females continued to generate motion cues even when copulating, as D. erecta females reliably began to spin while mounted (Supplementary Video 2). The motion generated by interacting individuals on a food patch thus transforms the visual backdrop, suggesting that it may convey broader information about social context to further control male arousal. Indeed, even on agar, males displayed correlated bursts of locomotor activity and courtship (Fig. 5f,g, Extended Data Fig. 9e,f and Supplementary Video 9), consistent with the motion cues emanating from nearby flies transiently elevating male arousal. These observations point to a feedback loop in which ACV both promotes courtship and reshapes the sensory landscape in which courtship unfolds.

Fig. 5: Visual motion cues modulate D. erecta courtship in groups.

a, Schematic of the Drosophila visual field across the left (blue) and right (red) eye, with approximately 15° of binocular overlap. b,c, Left, representative trajectories and final positions of a D. erecta group comprising five males and five females over 10 s in a 38-mm arena on agar (b) or ACV (c). Individuals within (filled oval) or outside (dotted oval) the FOV of a focal male (blue oval) are indicated. Right, projection of focal male’s FOV over that period. d,e, Fraction of a focal male’s visual field occupied by other flies (d) and visual motion within the FOV (e) shown as mean ± s.e. throughout 40-min assay on agar (blue; n = 6 assays) or ACV (orange; n = 5 assays). f,g, Left, representative D. erecta group assay showing velocity for each fly over time, normalized by each individual’s maximum velocity on agar (f) or ACV (g). Right, conditional probability that other flies walk when the focal fly moves (agar, n = 8 assays; ACV, n = 7 assays) compared to shuffled data (grey; means of 100 shuffles per assay). h,i, Courtship indices of D. erecta and D. melanogaster males in conspecific groups (h, black circles) or heterospecific groups (i, red circles) of five males and five females (filled circles) compared with male–female pairs (open circles) on ACV (conspecific groups: D. erecta, n = 7 assays; D. melanogaster, n = 6 assays; pair: D. erecta, n = 20 assays; D. melanogaster, n = 8 assays; heterospecific groups: n = 10 assays each). j, Schematic of projector assay (left) and courtship indices (right) of D. erecta and D. melanogaster males on ACV with a single conspecific female (open circles) or a female and two constantly rotating fly-sized projected dots (closed circles, green). k, Schematic of visual replay experiment. Trajectories recorded from groups on agar or ACV were replayed as moving black ellipses to a test male–female pair in a 38-mm arena containing agar or ACV. l,m, Courtship indices for all combinations of chemical environment and replayed visual scenes for D. erecta (l) and D. melanogaster (m). Male–female pair was in an arena containing either agar (blue ellipse) or ACV (orange ellipse) and paired with visual playback recorded from a group on agar (blue ellipse) or ACV (orange ellipse) (D. erecta, n = 15; D. melanogaster, n = 10 each) or the ACV recording slowed to the average speed of flies on agar (orange ellipse with blue outline; n = 12). Black dotted lines indicate baseline courtship indices in an agar arena with visual playback recorded from a group on agar. n, Schematic depicting the direct and indirect effects of food odour (orange) on the sexual arousal and social behaviours of D. erecta males in an aggregate of conspecifics. Dots in dot plots represent individual males; horizontal bars in dot plots represent the mean. *P ≤ 0.05; ***P < 0.0001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. 

Source data

Aligned with the synergistic effect of food odours and visual motion on arousal, we found that individual D. erecta males on ACV displayed more vigorous courtship when part of a larger group (five pairs of conspecifics) than when presented with just a single female in isolation—an effect not observed in D. melanogaster (Fig. 5h). Courtship towards a conspecific female was similarly enhanced by the presence of a same-sized group of Drosophila simulans, underscoring that these courtship-promoting cues are not species-specific (Fig. 5i). Moreover, male courtship in D. erecta was elevated by simply projecting two continuously rotating dots onto the assay chamber floor, highlighting that visual motion is sufficient to promote arousal (Fig. 5j and Supplementary Video 10).

Male courtship in D. erecta thus appears to be influenced by both the chemosensory environment of a food patch and the dynamic motion of the social group on it. To explore the composite effects of food odour and visual motion, we recorded the group dynamics of five pairs of D. erecta males and females on agar or ACV, approximated each fly’s centroid position as a high-contrast ellipse and then played back these visual motion cues to a ‘test’ D. erecta male and female pair (Fig. 5k and Supplementary Video 11). We observed that courtship in D. erecta males was enhanced by playback of the visual scene recorded from flies interacting on ACV (Fig. 5l). Courtship of the test pair on ACV was comparable when presented with either the visual scene recorded on agar or the scene recorded on ACV but slowed to match the velocity of flies on agar. D. erecta males therefore appear to be sensitive to the speed of visual targets, rather than their distinct dynamics. Notably, males on ACV, presented with the visual motion cues recorded on ACV, displayed the highest level of courtship, supporting the synergistic effects of the chemosensory and visual environment. Neither the presence of ACV nor playback of the social scenes recorded on ACV further increased the vigorous courtship displayed by D. melanogaster (Fig. 5m). Together, our data indicate that the chemosensory environment of a food patch promotes and perpetuates a male’s sexual arousal in D. erecta by driving males to sample and pursue visual targets, which in turn reshapes the visual social scene to further reinforce mating behaviours (Fig. 5n).

Discussion

In Drosophila, courtship unfolds as a tightly coupled feedback loop between prospective mates, continuously shaped by the reciprocal exchange of sensory signals between male and female. Here we examined how this feedback loop is influenced by the ecological and social context of mating sites, showing that in D. erecta, both the olfactory volatiles emanating from a food patch and the collective dynamics of flies congregating there coordinately control courtship. We find that food odour regulates male courtship in D. erecta through two distinct mechanisms: first, by gating a male’s arousal to promote pursuit of potential mates; and second, by further enhancing his arousal through the increased visual motion of other individuals on the food patch, creating a feedback loop that elevates courtship in environments where reproductive opportunities are likely to be most abundant. D. erecta has thus evolved a striking dependence on environmental cues as an integral part of its reproductive strategy.

D. erecta’s distinct sensitivity to its environment may represent an adaptation well aligned with its specialization on Pandanus fruit, a seasonally restricted host that is only transiently available for reproduction. Breeding populations of D. erecta surge during the two-to-four-month period when Pandanus fruit is present and then sharply decline as the availability of fruit wanes21,22. During seasons when Pandanus is scarce, D. erecta can opportunistically subsist on other fruits, but in greatly diminished numbers, pointing to the inherent cost of specialization on ephemeral resources21,22. Although it remains unclear whether D. erecta’s reliance on food odours for mating is a direct adaptation to the seasonality of its host, such strict dependence underscores how Pandanus serves as a key ecological hub supporting the reproductive cycle of this species.

Variable access to mating sites, however, is not limited to D. erecta, as many drosophilids use fleeting host substrates to reproduce15,17,24. The chemosensory environment of mating sites may therefore modulate sexual arousal more generally. Consistent with this, the ability of ACV to promote courtship appears to be maintained in a latent form across Drosophila species, emerging only when males are presented with a relatively impoverished two-dimensional visual target (Extended Data Fig. 5) or in darkness7. Likewise, ACV has been shown to alter the salience of visual objects during flight in D. melanogaster40, indicating that the arousing effect of food volatiles is broadly conserved, with its behavioural expression quantitatively tuned by species-specific sensory thresholds. The modulation of reproductive behaviours by chemosensory cues not directly related to sexual signalling thus seems an evolutionarily malleable trait, shaped by the ecology and social landscape in which species evolve. Indeed, although ACV, a chemical mimic of fermenting substrates, enhances the sexual arousal of species that mate on decaying fruit, it inhibits courtship in the flower breeder D. elegans. Sexual arousal can therefore be enhanced or suppressed by environmental contexts, underscoring the bidirectional influence of the chemical environment on reproductive behaviour.

In D. erecta, the sensory threshold for arousal appears to be particularly high, rendering sustained courtship strictly dependent on continuous olfactory input. Indeed, transient activation of P1 neurons is insufficient to drive the persistent pursuit that other Drosophila species display37,38, indicating that olfactory input acts downstream of P1 neurons or on other circuit elements to perpetuate a male’s arousal. Consistent with this idea, ACV not only sustains P1-mediated arousal but can independently promote courtship pursuit. Although the precise neural locus of ACV’s action remains to be elucidated, the comparable activation of Dsx+ neurons in D. erecta, D. melanogaster and D. yakuba suggests that species-specific gating of courtship reflects quantitative reweighting of conserved olfactory inputs rather than recruitment of novel pathways. For example, D. melanogaster can become highly aroused through visual input alone, consistent with evidence that subsets of P1 neurons receive direct LC10a input34. P1 neuron activity in turn modulates the gain of LC10a responses38, forming a recurrent circuit poised to perpetuate visually guided courtship pursuit. One intriguing possibility is that ACV-responsive olfactory pathways gate this feedback loop in D. erecta, such that both vision and food volatiles are required for males to sustain their sexual arousal.

Such subtle variation in conserved elements of courtship circuits underscores how these pathways can diversify while maintaining their core function, enabling different species to rapidly adapt to their distinct ecological needs41. This flexibility may be facilitated by their modular architecture. Pheromone responses in P1 neurons, for example, are unaffected by ACV (Fig. 4h), and responses of Dsx+ neurons in the LPC to pheromones and ACV are spatially distinct (Extended Data Fig. 8), indicating that olfactory and pheromonal pathways remain at least partly segregated. Such an organization may preserve the ability of males to discriminate between conspecific and heterospecific females even when highly aroused on a food patch (Extended Data Fig. 9a). The modularity of courtship circuits36,42,43 thus favours the independent diversification of distinct circuit elements, allowing D. erecta to evolve behavioural sensitivity to environmental cues and exploit fleeting reproductive opportunities such as those provided by its host fruit.

Beyond the direct modulation of circuits perpetuating sexual arousal, ACV also serves to structure the social landscape at multiple levels. First, ACV triggers D. erecta flies to rapidly track to the odour source. Flies in our experiments were fed and sated, suggesting their aggregation on a food patch is driven by reproductive rather than metabolic needs. Second, once on the food patch, ACV promotes males to sample visual targets, presumably in search of sexually receptive females, transforming the visual scene through their collective motion during this form of ‘social foraging’. Finally, because D. erecta males are highly sensitive to visual motion, their courtship is further enhanced by the presence of moving visual targets. This in turn orchestrates the behaviour of nearby individuals such that their bouts of pursuit become synchronized, an effect most apparent on agar, where periods of immobility are punctuated by intermittent bursts of activity across the group.

Aggregating in larger groups increases a male’s access to potential mating partners but at the same time promotes competition, which is thought to be fierce on a crowded food patch44,45. Reproductive success in these competitive environments requires that males fend off their rivals and isolate a female for long enough to initiate copulation46. As a consequence, a male’s sensitivity to visual motion may confer an advantage in gaining access to potential mating opportunities by triggering him to chase after any visual object that may be a receptive female or courting pair. Indeed, on a food patch, males become attracted to all visual objects and indiscriminately approach a male, a female or a bead (Extended Data Fig. 2d). The drive to compete therefore likely structures the collective activity observed in groups of D. erecta.

Although Drosophila is not typically thought to engage in collective social behaviours, the dynamics of D. erecta on a food patch may follow the same principles that structure schooling fish13, swarming locusts12 or murmurations of starlings14,47. In these systems, simple local interaction rules—such as attraction and repulsion among neighbours—align the behaviour of many individuals into concerted actions12,48,49. Likewise, in D. erecta aggregates, the behaviour of neighbouring flies serves as an environmental reference that modulates courtship behaviour: not through direct signalling between prospective sexual partners, but through generic visual motion cues that indicate the broader environmental context. However, in contrast to canonical examples of collective behaviours—where information is thought to be cooperatively shared to optimize the fitness of all individuals in the group—D. erecta’s sensitivity to group dynamics probably evolved to enhance individual reproductive fitness to succeed in a competitive environment. Our results thus indicate that collective behaviours can emerge from diverse selective pressures, giving rise to coordinated actions even in species not generally considered ‘social’.

Methods

Fly stocks and husbandry

Flies were housed at 25 °C and 50–65% relative humidity on a 12 h light/12 h dark cycle, except for animals used in optogenetics experiments, which were reared in darkness. Stocks used for behavioural experiments were reared on standard molasses food, 2P imaging lines were reared on Würzburg food for at least five generations to increase animal robustness, and flies expressing optogenetic actuators were kept on sugar-yeast food to prevent intake of the cofactor retinal. Fly stocks used were as follows: D. melanogaster stocks 71G01-Gal4 (39599) and UAS-GCaMP6s (42746) were obtained from Bloomington Stock Center. Canton-S (G. Maimon, Rockefeller University), CO4n and RG11n (J. Pool, University of Wisconsin-Madison), UAS-CsChrimson (V. Jayaraman, Janelia Research Campus) and VT029314 (LC10a)-LexA, LexAop-GCaMP6s (I. Ribeiro and B. Dickson, Janelia Research Campus) were generously shared by the indicated colleagues. Wild-type D. erecta (14021-0224.01), w− D. erecta (14021-0224.07) and D. yakuba (14021-0261.00) were obtained from the Cornell Stock Center. Ruta lab D. simulans, D. orena (D. Stern, Janelia Research Campus), D. erecta 71G01-Gal4, UAS-GCaMP6s, UAS-CsChrimson, ppk23-mutant and D. erecta as well as D. yakuba Dsx-Gal4 (Y. Ding, University of Pennsylvania) were previously generated36 or shared by the indicated colleagues. D. erecta VT029314 (LC10a)-Gal4, Fru-Gal4, Orco-Gal4 (for labelling, see Extended Data Fig. 10), ∆Orco and ∆Ir8a were generated in this study. The 71G01-Gal4 driver labels a subset of approximately 1052 out of 78 highly interconnected P1 neurons described in D. melanogaster34 and a similar number of neurons in D. erecta36.

Transgene generation

Vector backbone pRC12B36 with ie1.mCherry minigene reporter was used to clone the synthesized VT029314 enhancer fragment gBlock (IDT) upstream of Gal4 by means of Gibson assembly (NEB). The construct was co-injected with hyTsps mRNA into embryos for transposase-mediated genome integration. Chemosensory coreceptor knockouts were generated by targeted excision of the first three exons (Orco) or the entire coding region (Ir8a) using CRISPR–Cas9-mediated homology-directed repair inserting a fluorescent marker gene cassette encoding mCherry under the viral ie1 promoter (Orco) or RFP under control of D. melanogaster 3xP3 (Ir8a). The Orco-Gal4 line in D. erecta was generated by cloning 5,496 bp upstream of the Orco translation start site upstream of the Gal4 sequence into the pCaSpeR backbone and a gateway cassette (pCaSpeR-DEST3 (DGRC, 1029; Research Resource Identifier: DGRC_1029)). The Fru-Gal4 line was generated by first establishing an attP landing site in the D. erecta fruitless locus and subsequently inserting a splice acceptor-Gal4 element. The landing site was created using CRISPR–Cas9-mediated cleavage to the intron 5′ of the exon containing the ATG start codon (as previously described)53 with homology-directed repair inserting the attP sequence. The resulting validated fruattP line was used as a target for site-specific integration of a splice acceptor-Gal4 element, which contained an ie1.mCherry transformation marker.

All transgenic lines in D. erecta were made in a wild-type genetic background except the Orco-Gal4 line, which was constructed in a w− background. For experiments, all constructs were crossed into a wild-type (w+) background to exclude potential behavioural effects of the w− mutation.

Immunohistochemistry

Adult brains were dissected in Schneider’s media (Sigma) and immediately transferred to cold 1% paraformaldehyde (Electron Microscopy Sciences) for overnight fixation at 4 °C. Samples were then washed three times in PAT3 buffer (0.5% bovine serum albumin, 0.5% Triton, phosphate-buffered saline pH 7.4). Brains were blocked in 3% Normal Goat Serum for 90 min at room temperature and incubated in primary antibodies (1:1,000 chicken anti-GFP (Abcam, ab13970), 1:50 mouse anti-brp (Developmental Studies Hybridoma Bank nc82)) for 3 h at room temperature followed by an overnight incubation step at 4 °C. Brains were then washed three times in PAT3 buffer and once in phosphate-buffered saline. Brains were mounted in Vectashield (Vector Laboratories). Images were captured on a Zeiss LSM 880 using a Plan-Apochromat ×20 (0.8 numerical aperture) objective.

Free-behaviour assays

All free-walking behavioural assays were conducted at 25 °C and 50–65% relative humidity between 0 and 3 h after lights on. Virgin males and females were collected after eclosion and group-housed separated by sex for 4–7 days before the assay. Flies were aspirated without anaesthesia, females first followed by males. All free-behaviour videos were recorded with FlyCapture 2 (v.2.13.3.61) at 30 or 42 frames per second (fps) in back light from a white light pad (Logan Electric) using a Point Grey FLIR Grasshopper camera (GS3-U3-32S4M-C 3MP) fitted with a HF12.5SA-1 lens (Fujinon). Central food patches of varying sizes (see below) were formed either from agar (2% w/v) perfumed with ACV (20% v/v), agar (2% w/v) with P. candelabrum fruit pulp (20%) or a 2% agar-only control.

Large arena

Assays were performed in 190-mm-diameter, 3-mm-high circular slope-walled Delrin chambers with a central food patch of 21.5 mm diameter. Five females were transferred to the chamber by mouth aspiration followed by five males. Once the males were loaded, the assay commenced, and groups were recorded for 40 min. Single-individual assays lasted 20 min. The centroid position of each fly was tracked in every frame, and identity swaps were manually corrected using the Caltech FlyTracker (v.1.0.5)54. The positional data were then used to infer individual trajectories, relative distributions and the distance of flies to the central food patch in MATLAB (v.2023b, MathWorks). A clustering fly was defined as within 3 fly lengths of at least one other fly, whereas a solitary individual was defined as being at a distance of at least 3 fly lengths from all other flies in the arena. The timing and position of copulations were manually scored.

Grid arena

Grid assays were conducted in modified large 190-mm-diameter arenas with a large 145-mm-diameter central food patch. A grid forming a lattice of 13 black, fly-sized (3 mm diameter) hemispherical plastic beads (Etsy) arranged in a regular square array was placed on the patch. The grid consisted of five equidistant beads along the horizontal midline with a distance of 30 mm along the edge, three equidistant beads 30 mm above and below and one more bead 30 mm above and below the three beads, all aligned along the midline. Assays with either five males or a single solitary male were recorded for 20 min. For ‘social foraging’ assays, one randomly chosen bead of the grid was exchanged with an immobilized decapitated female. Recording commenced after aspiration of all males. The centroid position and speed of each fly was tracked in every frame using AnimalTA (v.3.2.2)55. If necessary, identity swaps were corrected manually in the software. Exact bead positions were extracted for each assay using the same software. Distances of males to beads or the immobilized female and visits to visual targets were calculated from the positional data and used to infer individual trajectories and relative distributions. Summary statistics including the number of beads visited per male, bead approaches over time, the number of times a male switched between any two different beads, and the fraction of time spent per bead or with the female were calculated from positional data in MATLAB. A visit was defined as an individual spending at least 30 s within 3 fly lengths (approximately 9 mm) of a bead or the female. The timing of an approach was defined as the first frame of a visit bout. Bead switches were defined as the visit of any bead different than the previous one. Male unilateral wing extensions (singing) during the approach of a bead or a female were tracked manually using BORIS (v.7.13.9)56.

Small arena

Assays were performed in 38-mm-diameter, 3-mm-high circular slope-walled Delrin chambers with a central food patch of 21.5 mm diameter. Videos were recorded in 2 × 2 grids using the same recording setup as above. Females were aspirated first, followed by males, and assays commenced after the last fly was loaded for a 40-min recording. Strain-variation assays were restricted to D. melanogaster because of a lack of availability of further D. erecta strains. For heterospecific group assays, four pairs of D. simulans females and males were transferred to the assay chamber first, followed by one D. erecta female and one male. Ppk23-knockout assays were performed by first transferring a D. melanogaster female target to the arena, followed by mouth aspiration of either a wild-type or a D. erecta ppk23-mutant tester male on ACV. In single-bead assays, a hemispherical black plastic bead of approximately 3 mm diameter (Etsy) was placed on the food patch at the centre of the assay chamber first, followed by aspiration of a single fly, after which the assay commenced. Bead assays were recorded for 20 min. The centroid position and orientation of all flies were tracked and manually corrected for identity swaps in FlyTracker. Reproductive behaviours of males were then inferred in MATLAB from their orientation, heading direction and position relative to visual stimuli and other flies in the arena. Specifically, we extracted male approach and tracking of other flies, close-range courtship and copulations. Approach was defined as the directed movement (greater than or equal to 0.8 mm s−1) towards a sedentary object, such as another fly or a plastic bead from within a distance of maximally 4 fly lengths (approximately 12 mm). We scored approach when the male’s orientation was within 60° of the line connecting his and the target’s centre of area, up to a distance of 1.5 fly lengths (4.5 mm), where it had to be within 45°. Courtship was defined as periods during which males were approaching or tracking another fly or were within 1.5 fly lengths (approximately 4.5 mm) of a female with an angle of at least 45° subtending the line connecting the male’s and female’s centroids. We calculated the courtship index as the fraction of time a male was engaged in courtship for the duration of the assay (Courtship index = Time spent courting/Assay length). If a male copulated, courtship index indicates the fraction of time a male was engaged in courtship until copulation. To calculate the visual experience of males in groups in different chemosensory environments, the angular position and width of other flies in the arena on the focal fly’s visual field were calculated in MATLAB on a frame-by-frame basis as previously described57.

Free-behaviour visual virtual reality projector assays

All free-behaviour visual virtual reality assays were performed in 38-mm-diameter, 3-mm-high slope-walled chambers made of Delrin, coated with white self-adhesive vinyl paper (Livelynine) to enhance reflectance and increase the contrast of projected shapes. Visual stimuli were directly projected onto the assay chamber surface28 using a DLP LightCrafter 4500 mini projector (Texas Instruments). Tester males were aspirated into the assay chamber and allowed to acclimate for 5 min before visual stimulus projection started, and recording commenced for 5 min using a Basler acA3088-57uc camera with a 8 mm/f 1.8 lens (Edmund Optics) in pylon Viewer (v.6.3.0). If pairs of flies were used, the female was aspirated first, followed by the male, after which the assay commenced and was recorded for 40 min. All videos were recorded at 30 fps. For all but the visual environment replay assays, either 30 μl 2% (w/v) agar perfumed with ACV (20% v/v) or a 30 μl 2% agar-only control was pipetted into the centre of the assay chamber and allowed to solidify before flies were aspirated. To avoid obstructing the visual environment replay, four equidistant 30-µl dots were placed in a square formation at the periphery of the assay chamber.

Constant angular velocity stimulus assays

Males were presented with either a slow dot rotating clockwise at 16 mm s−1 with a 7.5-mm radius from the centre of the assay chamber, a fast dot rotating counterclockwise at 32 mm s−1 with a 15.5-mm radius from the centre of the assay chamber or both simultaneously. Each dot had a diameter of 3 mm. For mating assays, a female target was added and both visual stimuli were presented after the aspiration of the male. The assay commenced for 40 min or until copulation, whichever was first. The positions of the visual stimuli, female and male were tracked using flyTracker, and male visual object tracking behaviour was inferred in MATLAB on the basis of his orientation, heading direction and position relative to the visual stimuli and female. Tracking was defined as the directed movement towards a moving object within the orientation criteria described for approach in free-behaviour small-arena assays above. The data were then used to calculate the tracking index for each male. The tracking index was defined as the fraction of time a male tracked a visual stimulus during the course of an assay (Tracking index = Time spent tracking/Assay length).

Visual environment replay assays

The visual environment replay videos were prepared as follows. Individual trajectories tracked and manually corrected with FlyTracker were extracted from one representative recording of a D. erecta group of five males and five females on ACV and one recorded on agar in a small 38-mm arena. The positional centroid information as well as the orientation of each individual were then used to place a black ellipse at each fly’s position with the long axis (length 3 mm) aligned to the orientation for each frame for a total of 5 min recorded at 30 fps. The 5 min were then looped to create a 40-min video for each chemosensory condition. This was done because on ACV, the accumulation of copulating pairs over time changes the visual environment of a group from one dominated by dynamic movement during courtship to a more sedentary one. We thus extracted a representative 5-min block of a group dominated by courtship on ACV. For the agar video, we extracted the 5-min block beginning at the same time point. For the assay, replay of either the agar or ACV visual environment was paired with agar (2% w/v) or agar perfumed with ACV (20% v/v). A female fly and a male fly were aspirated into the arena, and the recording started together with video replay. Male behaviour towards the female was scored manually using BORIS for 40 min or until copulation, whichever came first. Manual tracking was necessary because flies were obscured by the ellipse projections at low contrast at times, which was not detectable by automated software. The behavioural data were then used to calculate the tracking index for each male.

Tethered virtual reality assays

Tethering

Males (4–5 days old) were briefly (less than 30 s) anaesthetized on CO2 and subsequently tethered to a custom-milled plastic head plate similar to those used in previous studies38,58. Flies were held in place by a string across the cervical connective and fixed to the head plate by both eyes and the back of the thorax using UV-curable glue (Loctite 3106 and Bondic). The string was subsequently removed, and flies were left to recover in a warm, humidified chamber (25 °C, 50–70% humidity) in the dark. Flies were transferred to an air-supported ball of 5 mm (D. erecta) or 6.35 mm (D. melanogaster) diameter after 30 min and left to acclimatize for 45 min.

Virtual reality system

We adapted a previous hardware design for presenting tethered males with visual stimuli38,59 and extended it to provide odours with temporal precision. The system, described in detail in ref. 38, consists of an aluminium base keeping an air-supplied Styrofoam ball afloat, held in place by a custom 3D-printed holder adapted to fit either the original 6.35-mm ball used for D. melanogaster males or a 5-mm ball for D. erecta males. The conical screen surrounding the ball was kept at the original dimensions (large diameter: approximately 220 mm, small diameter: approximately 40 mm, height: approximately 60 mm) but was cut from holographic rear projection film (Megicolim). The visual stimulus was rear-projected around the male using a DLP 3010 Light Control Evaluation Module (Texas Instruments). A high-contrast circular visual stimulus of approximately 28° diameter mimicking the angular size of a female fly 2 mm from the male was rear-projected onto the screen, moving in a symmetric 150° arc at constant angular velocity (50° sec−1). For odour delivery, we fit Teflon tubing to the setup providing a constant stream of humidified air with low flow volume (0.5 l min−1) towards the male’s head from the front at a 45° angle and approximately 2 mm from the fly to not obstruct the view on the screen. The tubing was 1 cm in diameter, making sure the entire male was engulfed by the stream of air. Pure ACV odour was mixed with water vapour to a concentration of 50% by two digital mass flow controllers and fed into the outlet tubing by switching from pure air using solenoid valves controlled by means of a data acquisition device (MMC 1408 FS). This ensured the air-flow rate was constant throughout the experiment. Acquisition of the male’s positional readout was based on positional tracking of the spherical treadmill using FicTrac (v.2.0), which was combined with the regulation of visual stimulus generation and odour delivery in MATLAB on a single computer.

Experimental parameters

Each assay lasted 210 s, beginning with a 30-s baseline period followed by the projection of the oscillating visual stimulus for the remaining 180 s. ACV odour was delivered for 60 s beginning 90 s after assay start, exposing the male to 60 s of visual stimulus only before and after odour delivery.

Anosmic mutant assays

To assess the role of olfaction in the ACV-dependent visual tracking of D. erecta males in the tethered virtual reality assay, we produced a transgenic line mutant for the chemosensory coreceptors Orco and Ir8a deficient in the principal olfactory pathways previously implicated in the detection of ACV volatiles60,61. Double mutants were tethered and assayed as described above.

Tracking index

The tracking index was defined as previously described36 to reflect the fidelity and vigour of the male’s pursuit of the visual target.

Optogenetic assays

Optogenetics experiments were performed by expressing the light activated cation channel CsChrimson in olfactory sensory neurons (Orco-Gal4) or P1 neurons (71G01-Gal4) with flies reared on sugar-yeast food lacking retinal, a cofactor required for channelrhodopsin function. After 5 to 6 days, tester flies were transferred to food containing 400 μM all-trans-retinal for two days before the experiment. Controls were transferred either to a new sugar-yeast food vial or alternatively to food containing retinal when using a genetic control. Genetic control males carried CsChrimson without a Gal4 driver. For optogenetic activation, flies were exposed to light at a wavelength of 625 nm emitted by red LEDs (Cree Xlamp XP-E2). We used three different experimental configurations.

Free-behaviour optogenetic assay

Small 38-mm assay chambers with a central 21.5-mm food patch formed from agar (2% w/v) perfumed with ACV (20% v/v) or an agar control were backlit with blue light. A female, immobilized by decapitation or an inanimate hemispherical bead (diameter 3 mm), was placed at the centre of the arena. After aspiration of the male, assays were run for 6 min, with two 2-min blocks of baseline background illumination interleaved with the delivery of red light pulsing at 5 Hz with a pulse length of 0.1 s for 2 min. For assays with a decapitated female, red light for optogenetic activation was delivered from below the assay chambers using an array of nine high-power LEDs emitting red light at high intensity to penetrate the Delrin resulting in a power of approximately 7 µW mm−2 at the surface. For bead assays, red light was delivered from above using five high-power LEDs. Male behaviour was tracked using FlyTracker. His position, orientation relative to the female and heading direction were used to track courtship behaviour and to calculate the courtship index as described above.

Free-behaviour projector optogenetic assay

Small 38-mm assay chambers were coated with a white adhesive film to increase reflectance and illuminated from above using a LightCrafter 4500 mini projector (Texas Instruments) set to emit light exclusively through its blue LED channel by switching off the red and green LEDs for background lighting. P1 neurons labelled with 71G01-Gal4 were activated by red light delivered from above using five high-power LEDs. Assays were run for 6 min, with two 2-min blocks of baseline background illumination interleaved with a 2-min delivery of constant red light in addition to the background light. Male behaviour was tracked using flyTracker. His position, orientation relative to the female and heading direction were used to calculate the tracking index. Tracking was defined as the directed movement towards a moving object within the orientation criteria described for approach in free-behaviour small-arena assays above. The data were then used to calculate the tracking index for each male. The tracking index was defined as the fraction of time a male tracked a visual stimulus during the course of an assay (Tracking index = Time spent tracking/Assay length). Population behaviour was summarized by the fraction of males courting across assays over time.

Tethered optogenetics assay

Males used for optogenetics assays were tethered as described above in ‘Tethered virtual reality assays’. Assays lasted 210 s beginning with a 30-s baseline followed by visual stimulus delivery for the remaining 180 s. One 1.5-mm optic fibre (Edmund Optics) was coupled to a high-power red LED (650 nm, LED Engin) mounted on a heat sink (Ohmite) and placed directly above the head of the fly. Orco+ olfactory sensory neurons were activated by pulsing light at 5 Hz with a pulse length of 0.1 s for 60 s after 90 s. Tracking index was calculated as described above.

Two-photon functional imaging

Fly preparation

Males were tethered as described above. After recovery, the plate was filled with saline (108 mM NaCl, 5 mM KCl, 2 mM CaCl2, 8.2 mM MgCl2, 4 mM NaHCO3, 1 mM NaH2PO4, 5 mM trehalose, 10 mM sucrose, 5 mM HEPES, pH 7.5 with osmolarity adjusted to 265 mOsm) covering the fly’s head. The cuticula above the antenna and between the eyes was cut with a 30-gauge needle and removed with forceps without anaesthesia to provide optical access to the central brain. The tracheae covering the top of the brain were removed using forceps, after which flies were transferred to the ball to recover in darkness for 45 min.

Functional imaging

Experiments were performed with an Ultima two-photon laser scanning microscope (Bruker Nanosystems) with a Chameleon Ultra II Ti:Sapphire laser. Samples were excited at a wavelength of 920 nm, and emitted fluorescence was detected with a GaAsP photomultiplier tube (Hamamatsu). Images were acquired in Prairie View (v.5.6; Bruker) with a ×40 Olympus water-immersion objective with 0.8 NA. To reduce noise caused by light emitted by the projector during imaging, the red and green LED channels were switched off. In addition, a piece of blue-light filter paper (Rosco) was placed in front of the projector lens. After the male’s resting period on the ball, the objective was lowered over the brain to identify the brain region of interest (ROI). We centred a small ROI yielding an imaging rate of 4–8 Hz. Laser power was kept low to reduce stress on the fly. ROIs were drawn in a single hemisphere, depending on the neural population imaged. For P1 and LC10a imaging, an ROI was drawn in the LPC and AOTu neuropil, respectively, where axonal projections were densest. For fru and dsx imaging, a larger ROI was drawn, encompassing neurites in both the LPC and adjacent AOTu to capture neural activity simultaneously.

For experiments with a moving visual stimulus, experimental parameters and calculation of the tracking index were as described in ‘Tethered virtual reality assays’. For pheromone tapping experiments, a virgin conspecific female (4–8 days old) was mounted on a micromanipulator serving as pheromone stimulus and presented in sets of six touch bouts 30 s apart to allow neural activity to return to baseline between taps. Pheromone and ACV responses in dsx+ neurons in the LPC were assessed in the same ROI for each animal, where the order of presentation of odour and pheromone stimuli was randomized.

Imaging analysis

Imaging data were postprocessed and analysed using Fiji (v.2.14.0, NIH). For each experimental recording, frames were motion corrected and aligned along the x and y axes by the Template Matching plugin. Residual background noise from the projector was reduced from raw time series using the Despeckle function. Finally, an ROI was drawn across the entire population of interest containing neuropil to extract the average fluorescence. Fluorescence was normalized in MATLAB for each recording using the average fluorescence over the first 30 s of an experiment as baseline (F0). ∆F/F was defined as ∆Fi/F0 = (Fi − F0)/F0, where i denotes the current frame. Because imaging data were collected at a lower frame rate than behavioural data, behavioural data were downsampled using linear interpolation at the imaging time points. Data from pheromone and ACV imaging of Dsx+ neurons were normalized by matching ∆F/F of pheromone responses across species and adjusting odour responses accordingly.

Statistical analysis

MATLAB was used for statistical analyses and plotting. The Shapiro–Wilk method was used to test normality, and the appropriate parametric/non-parametric statistical test was used. In cases for which several comparisons were made, appropriate post hoc tests were conducted as indicated in Supplementary Table 1. All statistical tests used were two-tailed.

Reporting summary

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

Data availability

Source data are provided with this paper.

Code availability

Code used for analysis is available at GitHub (https://github.com/rutalaboratory/Brand_etal_2026).

References

  1. Severinghaus, L. L., Kurtak, B. H. & Eickwort, G. C. The reproductive behavior of Anthidium manicatum (Hymenoptera: Megachilidae) and the significance of size for territorial males. Behav. Ecol. Sociobiol. 9, 51–58 (1981).

    Article  Google Scholar 

  2. Markow, T. A. & O’Grady, P. Reproductive ecology of Drosophila. Funct. Ecol. 22, 747–759 (2008).

  3. Allan, J. D. & Flecker, A. S. The mating biology of a mass-swarming mayfly. Anim. Behav. 37, 361–371 (1989).

    Article  Google Scholar 

  4. Beani, L., Cervo, R., Lorenzi, C. M. & Turillazzi, S. Landmark-based mating systems in four Polistes species (Hymenoptera: Vespidae). J. Kans. Entomol. Soc. 65, 211–217 (1992).

  5. Leboeuf, B. J. Sexual behavior in the northern elephant seal Mirounga angustirostris. Behaviour 41, 1–26 (1972).

    Article  CAS  PubMed  Google Scholar 

  6. Nelson, C. M. Male size, spawning pit size and female mate choice in a lekking cichlid fish. Anim. Behav. 50, 1587–1599 (1995).

    Article  Google Scholar 

  7. Grosjean, Y. et al. An olfactory receptor for food-derived odours promotes male courtship in Drosophila. Nature 478, 236–240 (2011).

    Article  CAS  PubMed  Google Scholar 

  8. Bastock, M. & Manning, A. The courtship of Drosophila melanogaster. Behaviour 8, 85–111 (1955).

  9. Carroll, C. R. & Janzen, D. H. Ecology of foraging by ants. Annu. Rev. Ecol. Syst. 4, 231–257 (1973).

  10. Anderson, D. J. Circuit modules linking internal states and social behaviour in flies and mice. Nat. Rev. Neurosci. 17, 692–704 (2016).

    Article  CAS  PubMed  Google Scholar 

  11. Couzin, I. D. Collective cognition in animal groups. Trends Cogn. Sci. 13, 36–43 (2009).

    Article  PubMed  Google Scholar 

  12. Sayin, S. et al. The behavioral mechanisms governing collective motion in swarming locusts. Science 387, 995–1000 (2025).

    Article  CAS  PubMed  Google Scholar 

  13. Katz, Y., Tunstrøm, K., Ioannou, C. C., Huepe, C. & Couzin, I. D. Inferring the structure and dynamics of interactions in schooling fish. Proc. Natl Acad. Sci. USA 108, 18720–18725 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  14. Ballerini, M. et al. Empirical investigation of starling flocks: a benchmark study in collective animal behaviour. Anim. Behav. 76, 201–215 (2008).

    Article  Google Scholar 

  15. Carson, H. L. The Ecology of Drosophila Breeding Sites. Harold L. Lyon Arboretum Lecture Vol. 2 (Univ. of Hawaii Foundation, 1971).

  16. Lachaise, D. et al. Historical biogeography of the Drosophila melanogaster species subgroup. In Evolutionary Biology Vol. 22 (eds Hecht, M. K. et al.) 159–225 (Springer, 1988).

  17. Markow, T. A. Host use and host shifts in Drosophila. Curr. Opin. Insect Sci. 31, 139–145 (2019).

    Article  PubMed  Google Scholar 

  18. Comeault, A. A. et al. A nonrandom subset of olfactory genes is associated with host preference in the fruit fly Drosophila orena. Evol. Lett. 1, 73–85 (2017).

    Article  PubMed  PubMed Central  Google Scholar 

  19. Ishikawa, Y., Kimura, M. T. & Toda, M. J. Biology and ecology of the Oriental flower-breeding Drosophila elegans and related species. Fly 16, 207–220 (2022).

    Article  PubMed  PubMed Central  Google Scholar 

  20. Spieth, H. T. Behavioral characteristics of Hawaiian Drosophila. Proc. Hawaii. Entomol. Soc. 26, 101–108 (1986).

    Google Scholar 

  21. Tsacas, L. & Lachaise, D. Les Drosophilidae des savanes preforestleres de la region tropicale de Lamto (Cote-D’lvore). II. Le peuplement des fruits de Pandanus candelabrum (Pandanacees). Ann. Univ. Abidjan E 7, 153–192 (1974).

  22. Rio, B., Couturier, G., Lemeunier, F. & Lachaise, D. Evolution d’une spécialisation saisonnière chez Drosophila erecta (Dipt., Drosophilidae). Ann. Soc. Entomol. Fr. 19, 235–248 (1983).

  23. Linz, J. et al. Host plant-driven sensory specialization in Drosophila erecta. Proc. R. Soc. B 280, 20130626 (2013).

    Article  PubMed  PubMed Central  Google Scholar 

  24. Mansourian, S. & Stensmyr, M. C. The chemical ecology of the fly. Curr. Opin. Neurobiol. 34, 95–102 (2015).

    Article  CAS  PubMed  Google Scholar 

  25. Gong, H. et al. Natural statistics of host odours predict species-specific olfactory behaviours in Drosophilids. Preprint at bioRxiv https://doi.org/10.64898/2026.03.27.714575 (2026).

  26. Liu, R. C., Li, R., Wang, Y. & Jiang, Z. T. Analysis of volatile odor compounds and aroma properties of European vinegar by the ultra-fast gas chromatographic electronic nose. J. Food Compos. Anal. 112, 104673 (2022).

    Article  CAS  Google Scholar 

  27. Wang, L. et al. Screening of lactic acid bacteria in Cupei of vinegar and the application in the fermentation of liquid-state apple cider vinegar. China Brew. 44, 185–191 (2025).

    Article  CAS  Google Scholar 

  28. Ryba, A. et al. Strain variation identifies a neural substrate for behavioral evolution in Drosophila. Curr. Biol. 36, 1247–1259 (2026).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  29. Zhang, W. & Liang, X. Headspace gas chromatography-mass spectrometry for volatile components analysis in Ipomoea cairica (L.) sweet leaves: natural deep eutectic solvents as green extraction and dilution matrix. Foods 8, 205 (2019).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  30. Bell, J. S. & Wilson, R. I. Behavior reveals selective summation and max pooling among olfactory processing channels. Neuron 91, 425–438 (2016).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  31. Kohatsu, S., Koganezawa, M. & Yamamoto, D. Female contact activates male-specific interneurons that trigger stereotypic courtship behavior in Drosophila. Neuron 69, 498–508 (2011).

    Article  CAS  PubMed  Google Scholar 

  32. Clowney, E. J., Iguchi, S., Bussell, J. J., Scheer, E. & Ruta, V. Multimodal chemosensory circuits controlling male courtship in Drosophila. Neuron 87, 1036–1049 (2015).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  33. Kohatsu, S. & Yamamoto, D. Visually induced initiation of Drosophila innate courtship-like following pursuit is mediated by central excitatory state. Nat. Commun. 6, 6457 (2015).

    Article  CAS  PubMed  Google Scholar 

  34. Rubin, G. M. et al. Networks of sexually dimorphic neurons that regulate social behaviors in Drosophila. Curr. Biol. 36, 4697–4716 (2026).

  35. Jallon, J. M. & David, J. R. Variations in cuticular hydrocarbons among the eight species of the Drosophila melanogaster subgroup. Evolution 41, 294–302 (1987).

    PubMed  Google Scholar 

  36. Coleman, R. T. et al. A modular circuit coordinates the diversification of courtship strategies. Nature 635, 142–150 (2024).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  37. Hoopfer, E. D., Jung, Y., Inagaki, H. K., Rubin, G. M. & Anderson, D. J. P1 interneurons promote a persistent internal state that enhances inter-male aggression in Drosophila. eLife 4, e11346 (2015).

    Article  PubMed  PubMed Central  Google Scholar 

  38. Hindmarsh Sten, T., Li, R., Otopalik, A. & Ruta, V. Sexual arousal gates visual processing during Drosophila courtship. Nature 595, 549–553 (2021).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  39. Ribeiro, I. M. et al. Visual projection neurons mediating directed courtship in Drosophila. Cell 174, 607–621 (2018).

    Article  CAS  PubMed  Google Scholar 

  40. Cheng, K. Y., Colbath, R. A. & Frye, M. A. Olfactory and neuromodulatory signals reverse visual object avoidance to approach in Drosophila. Curr. Biol. 29, 2058–2065 (2019).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  41. Banerjee, A., Phelps, S. M. & Kebschull, J. M. The unusual effectiveness of evolution in systems neuroscience. Cold Spring Harb. Perspect. Biol. 18, a041510 (2026).

    Article  PubMed  PubMed Central  Google Scholar 

  42. Ye, D., Walsh, J. T., Junker, I. P. & Ding, Y. Changes in the cellular makeup of motor patterning circuits drive courtship song evolution in Drosophila. Curr. Biol. 34, 2319–2329 (2024).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  43. Seeholzer, L. F., Seppo, M., Stern, D. L. & Ruta, V. Evolution of a central neural circuit underlies Drosophila mate preferences. Nature 559, 564–569 (2018).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  44. Partridge, L., Hoffmann, A. & Jones, J. S. Male size and mating success in Drosophila melanogaster and D. pseudoobscura under field conditions. Anim. Behav. 35, 468–476 (1987).

    Article  Google Scholar 

  45. Dukas, R. Natural history of social and sexual behavior in fruit flies. Sci. Rep. 10, 21932 (2020).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  46. Hindmarsh Sten, T., Li, R., Hollunder, F., Eleazer, S. & Ruta, V. Male-male interactions shape mate selection in Drosophila. Cell 188, 1486–1503 (2025).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  47. Cavagna, A. et al. Scale-free correlations in starling flocks. Proc. Natl Acad. Sci. USA 107, 11865–11870 (2010).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  48. Larsch, J. & Baier, H. Biological motion as an innate perceptual mechanism driving social affiliation. Curr. Biol. 28, 3523–3532 (2018).

    Article  CAS  PubMed  Google Scholar 

  49. Sridhar, V. H. et al. The geometry of decision-making in individuals and collectives. Proc. Natl Acad. Sci. USA 118, e2102157118 (2021).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  50. Obbard, D. J. et al. Estimating divergence dates and substitution rates in the Drosophila phylogeny. Mol. Biol. Evol. 29, 3459–3473 (2012).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  51. Yang, Y., Hou, Z. C., Qian, Y. H., Kang, H. & Zeng, Q. T. Increasing the data size to accurately reconstruct the phylogenetic relationships between nine subgroups of the Drosophila melanogaster species group (Drosophilidae, Diptera). Mol. Phylogenet. Evol. 62, 214–223 (2012).

    Article  PubMed  Google Scholar 

  52. Pan, Y., Meissner, G. W. & Baker, B. S. Joint control of Drosophila male courtship behavior by motion cues and activation of male-specific P1 neurons. Proc. Natl Acad. Sci. USA 109, 10065–10070 (2012).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  53. Stockinger, P., Kvitsiani, D., Rotkopf, S., Tirián, L. & Dickson, B. J. Neural circuitry that governs Drosophila male courtship behavior. Cell 121, 795–807 (2005).

    Article  CAS  PubMed  Google Scholar 

  54. Eyjolfsdottir, E. et al. Detecting social actions of fruit flies. In Proc. European Conference on Computer Vision (eds Fleet, D. et al.) 772–787 (Springer, 2014).

  55. Chiara, V. & Kim, S. Y. AnimalTA: a highly flexible and easy-to-use program for tracking and analysing animal movement in different environments. Methods Ecol. Evol. 14, 1699–1707 (2023).

    Article  Google Scholar 

  56. Friard, O. & Gamba, M. BORIS: a free, versatile open-source event-logging software for video/audio coding and live observations. Methods Ecol. Evol. 7, 1325–1330 (2016).

    Article  Google Scholar 

  57. Schretter, C. E. et al. Social state alters vision using three circuit mechanisms in Drosophila. Nature 637, 646–653 (2025).

    Article  CAS  PubMed  Google Scholar 

  58. Maimon, G., Straw, A. D. & Dickinson, M. H. Active flight increases the gain of visual motion processing in Drosophila. Nat. Neurosci. 13, 393–399 (2010).

    Article  CAS  PubMed  Google Scholar 

  59. Weisman, J. L. et al. Drosophila maintain a consistent navigational goal angle for days to weeks. Preprint at bioRxiv https://doi.org/10.64898/2025.12.09.693277 (2025).

  60. Semmelhack, J. L. & Wang, J. W. Select Drosophila glomeruli mediate innate olfactory attraction and aversion. Nature 459, 218–223 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  61. Ai, M. et al. Acid sensing by the Drosophila olfactory system. Nature 468, 691–695 (2010).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

Download references

Acknowledgements

We thank S. R. Datta, D. Kronauer, Y. Ding, J. Rhee, A. Ryba, C. Dowell and T. Qadri for comments on the manuscript; G. Maimon, V. Jayaraman, I. Ribeiro, B. Dickson, Y. Ding and D. Stern for sharing fly lines; J. Weisman and G. Maimon for sharing designs for their projector-based visual virtual reality system presenting tethered flies with a visual stimulus in advance of publication; M. Hathiyari, T. Hindmarsh Sten, R. Li, C. Chapa, P. Stock, P. Strogies, J. Petrillo and Rockefeller Precision Instrumentation Technologies for technical advice; N. Parker for sharing his grid assay design; L. Vosshall for access to the two-photon system; R. Tulino for assistance in generating the Orco-Gal4 line; and the members of the Ruta lab for discussion. Stocks obtained from the Bloomington Drosophila Stock Center, NIH P40OD018537, the Cornell NDSCC Stock Center and FlyBase were used in this study. A vector obtained from the Drosophila Genomics Resource Center, NIH 2P40OD010949, was used in this study.

Funding

This work was supported by the Simons Foundation (grant no. 718234), a Kavli Neural Systems Institute Fellowship and NIH NIGMS grant no. K99GM151471 (P.B.); NIH NIGMS Medical Scientist Training Program grant no. T32GM152349 to the Weill Cornell/Rockefeller/Sloan Kettering Tri-Institutional MD-PhD Program (N.B.E.); NIH NIDCD grant no. F30DC023130 (N.B.E.); a Helen Hay Whitney Foundation Fellowship and NIH NIGMS grant no. K99GM141319 (R.T.C.); an ERC Starting Grant (grant no. 802531) and by the Francis Crick Institute, which receives its core funding from Cancer Research UK (grant no. CC2067), the UK Medical Research Council (grant no. CC2067) and the Wellcome Trust (grant no. CC2067) (L.L.P.-G.); NIH NINDS grant no. R35NS111611 and the Simons Foundation Collaboration for the Global Brain (V.R.). V.R. is an Investigator of the Howard Hughes Medical Institute.

Author information

Author notes

  1. Philipp Brand

    Present address: Evolutionary Neuroscience and Behavior Group, Max Planck Institute for Brain Research, Frankfurt am Main, Germany

  2. Rory T. Coleman

    Present address: Department of Biology, Center for Neural Science, New York University, New York, NY, USA

  3. Sarah Zylka

    Present address: Department of Biology, Boston University, Boston, MA, USA

Authors and Affiliations

  1. Laboratory of Neurophysiology and Behavior and Howard Hughes Medical Institute, The Rockefeller University, New York, NY, USA

    Philipp Brand, Katharine Keller, Rory T. Coleman, Noelle B. Eghbali, Sarah Zylka & Vanessa Ruta

  2. The Francis Crick Institute, London, UK

    Lucia L. Prieto-Godino

Authors

  1. Philipp Brand
  2. Katharine Keller
  3. Rory T. Coleman
  4. Noelle B. Eghbali
  5. Sarah Zylka
  6. Lucia L. Prieto-Godino
  7. Vanessa Ruta

Contributions

P.B. and V.R. conceived of and designed this study. P.B. designed and performed experiments, analysed data and interpreted the results, with input from V.R. P.B. designed and generated transgenic lines with input from R.T.C. K.K. carried out grid assay and ∆ppk23 experiments, contributed to small- and large-arena assays, assisted with the generation of transgenes and conducted immunohistochemistry brain preparation and imaging. R.T.C. designed and generated the Fru-Gal4 driver line in D. erecta. N.B.E. conducted the visual environment replay experiment. S.Z. assisted with initial courtship assays and cloning. L.L.P.-G. designed and generated the Orco-Gal4 driver line in D. erecta and collected P. candelabrum fruit. P.B. and V.R. wrote the manuscript with input from all authors.

Corresponding author

Correspondence to Vanessa Ruta.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review

Peer review information

Nature thanks the anonymous reviewers for their contribution to the peer review of this work. Peer reviewer reports are available.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data figures and tables

Extended Data Fig. 1 D. erecta aggregates on a central food patch in the presence of ACV.

a) Projections of the distribution of every fly over the first 15 min of representative 40-min group assays with 5 males and 5 females in a large 190 mm arena with a 21.5 mm central food patch (red circle) formed from agar perfumed with ACV (orange) or an agar control (blue) for D. erecta (left) and D. melanogaster (right). The positions of each fly in every 250th frame are overlaid, projecting a total of 108 frames over 15 min. b) Population occupancy of the central patch over time for 40-min group assays with 5 males and 5 females in a large 190 mm arena with a 21.5 mm central food patch for D. erecta (above) and D. melanogaster (below). Occupancy ranges from 0 with no individuals on the patch to 1 when all 10 individuals of the group are located on the central patch at a given time. Means ± standard error are indicated in black and shaded regions for assays on an ACV (orange) or agar patch (blue). Patch occupancies of individual assays are shown in shaded lines (n = 10 each). c) Fraction of individuals of group assays in (b) within 3 fly body lengths of one other fly (paired, black), in a group of three or more flies (grouped, dark grey), or at a distance over 3 body lengths from any other individual (solo, light grey) over time for D. erecta (above) and D. melanogaster (below). All flies in the entire arena were included in the analysis. Means ± standard errors are indicated. d) Total amount of time at least one group of three or more flies is present in assays with 5 males and 5 females in a large 190 mm arena with a 21.5 mm central food patch formed from agar perfumed with ACV (orange) or an agar control (blue) for D. erecta (D. ere) and D. melanogaster (D. mel). Means (black bars) and individual assays (dots, n = 10 each) are shown. e) Mean number of flies in large arena (190 mm) group assays (5 males and 5 females) present in clusters of three or more individuals throughout the whole 40-min assay for D. erecta (D. ere) and D. melanogaster (D. mel) in the presence of an agar (blue) or ACV (orange) patch. Assay means (dots, n = 10 each) and overall mean (black bar) are shown. f) and g) Mean distance of individuals in large 190 mm arena from the central 21.5 mm food patch formed from agar and perfumed with ACV (orange) or an agar control (blue) (f) and number of patch visits (g) for D. erecta (D. ere, agar n = 70 flies from 7 assays; ACV n = 100 flies from 10 assays) and D. melanogaster (D. mel; n = 100 flies from 10 assays, each) over 40 min. Black bars indicate the mean. h) Fraction of all copulations per large 190 mm arena group assay (5 males and 5 females; n = 10 assays each) that commenced on the central 21.5 mm patch formed from agar perfumed with ACV (orange) or an agar control (blue) for D. erecta (D. ere) and D. melanogaster (D. mel). i) Raster plots depicting the position of each individual fly relative to the Pandanus patch over duration of the assay (n = 6 assays) for D. erecta (left) and D. melanogaster (right). Time on the patch is highlighted in yellow. Greyscale indicates linear distance to the patch with decreasing distance shaded in lighter shades of grey. Individuals are aligned by the time of their first entry to the patch. j) Comparison of the spatial distribution of copulations in the presence of a Pandanus patch (yellow dots) for D. erecta (left) and D. melanogaster (right) (n = 6 assays). k) Mean patch occupancy for all flies for D. erecta (D. ere) and D. melanogaster (D. mel) (n = 6 assays). l) Fraction of all copulations that were initiated on the central food patch for D. erecta (D. ere) and D. melanogaster (D. mel). Each dot represents a separate assay (n = 6) and bars represent the mean. Scale bar indicates relative density. All statistical tests performed were two-sided, where appropriate. Comparisons that were statistically significant are indicated as: *p ≤ 0.05; **p < 0.001; ***p < 0.0001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics.

Source data

Extended Data Fig. 2 ACV promotes approach of other flies and visual objects in D. erecta males.

a) Mean relative distribution of flies in small 38 mm arena group assays with 5 males and 5 females in the presence of a central 21.5 mm food patch (red circle) formed from agar perfumed with ACV (right) or an agar control (left) for D. erecta (above; agar n = 8, ACV n = 7) and D. melanogaster (below; agar n = 6, ACV n = 6). b) Interaction per minute of all five D. erecta males of 5 male and 5 female group assays in small 38 mm arenas with a central 21.5 mm food patch towards any other individual in the arena for D. erecta (D. ere; agar n = 8, ACV n = 7) and D. melanogaster (D. mel; agar n = 6, ACV n = 6). Individual males (dots) and means (black bars) are indicated for assays with ACV (orange) or an agar (blue) patch. c) Interactions of all five males towards any other individual in the arena over the duration of an assay (top, solid line represents mean and shaded line individual assays) and ethogram of each male for either agar (blue; n = 8) or ACV (orange; n = 7) showing individual interactions with other males (open circle) and females (closed circle). Top panels and assays 5,8,11 and 15 are replotted from Fig. 1m. d) Approaches per minute of individual males towards a single female, another male, or an inanimate fly-sized hemispherical visual target (⌀ ca. 3 mm) in a small 38 mm arena with a central ACV (orange) or agar (blue) patch for D. erecta (top; targets: female: agar n = 16, ACV n = 19, male: agar n = 17, ACV n = 20, bead: agar n = 18, ACV n = 15) and D. melanogaster (bottom; targets: female: n = 8, each, male: agar n = 24, ACV n = 26, bead: n = 8, each). Means (black bar) for all assays (dots) are indicated. All males were paired with a single mobile target (another male or female), or a single hemispherical bead positioned at the center of the arena. e) Courtship index of flies in small 38 mm arena group assays with 5 males and 5 females in the presence of a central 21.5 mm food patch (red circle) formed from agar perfumed with ACV (right) or an agar control (left) for different D. melanogaster lines derived from populations in North America (Canton-S (CS); n = 6 assays) and Africa (Cameroon (CO4n); n = 4 assays and Rwanda (RG11n); agar n = 5, ACV n = 6 assays). CS data are replotted from Fig. 1h. All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; ***p < 0.0001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. Schematics in d adapted from ref. 43, Springer Nature Limited.

Source data

Extended Data Fig. 3 ACV promotes exploration of visual objects in D. erecta males.

a) Schematic depicting assay in which a single male was provided a female-sized hemispherical bead (ca. 3 mm) at the center of a small 38 mm arena with a 21.5 mm central food patch (red circle) formed from agar perfumed with ACV or an agar control. b) Fraction of time individual D. erecta (D. ere, left, agar n = 18, ACV n = 15) and D. melanogaster (D. mel, right, n = 8) males (dots) spent within three body-lengths of the hemispherical bead at the center of a small arena in the presence of an ACV (orange) or agar (blue) patch over 20 min. Mean is indicated by black bars. c) Mean velocity of flies in b). d) Frequency distribution of the central hemispherical bead position relative to the heading direction of D. erecta (top, n = 15–18) and D. melanogaster (bottom, n = 8) males in (b) on an agar (blue, left) or an ACV (orange, right) patch. Coordinates are shown using orientations of all males over 20 min with respect to the egocentric orientation of the male, heading towards the bead at 0/2π, while the bead is behind the male at π. e) Schematic of a fly head highlighting olfactory appendages (third antennal segments and maxillary palps) innervated by Orco+ olfactory sensory neurons in green and innervation of antennal lobes in the brain (center). Right: Schematic of optogenetics bead assay comprised of a single male with a female-sized hemispherical bead (⌀ ca. 3 mm) at the center in a small 38 mm arena with a 21.5 mm central agar patch. Arena is fitted with LEDs emitting 625 nm (red) light from top. f) Left: Overlaid trajectories of D. erecta (top, n = 13) and D. melanogaster (bottom, n = 12) Orco>CsChrimson control males reared without retinal over the 2 min prior to (left, pre) and during 2-min (right, LED on) optogenetic activation. Right: Raster of individual bead approaches (circles) for each male in the 2 min prior to and during optogenetic activation (grey shaded area). g) Mean distribution of males in 38 mm arenas with one isolated male in the presence of a central 21.5 mm food patch (red circle) formed from agar perfumed with ACV (right) or an agar control (left) for D. erecta (n = 4). No visual target was provided in these assays. Scale bar indicates relative density. h) Top left: Schematic of grid assay containing a lattice of 13 fly-sized hemispherical visual targets (⌀ ca. 3 mm) arranged in a regular square array in a large 190 mm arena on a large 145 mm food patch (red circle) formed from agar perfumed with ACV or an agar control. Bead sizes are enlarged and not to scale to highlight grid pattern. Top right: Mean distribution of groups of 5 D. erecta males on ACV without lattice of hemispherical visual targets over 20 min (n = 5 assays). Bottom: Mean distribution of groups of 5 D. erecta males in the presence of lattice on an agar (left) or ACV (right) patch (n = 5 assays, each). Scale bar indicates relative density over 20 min. i) Number of times any single D. erecta male within the group of 5 males switched from one hemispherical visual bead target to another on an agar (blue, left) or an ACV (orange, right) patch (n = 5 assays, 5 males each) over 20 min. j) Top: Overlaid trajectories of individual D. erecta males on agar (left) and ACV (right) in the presence of the bead grid (n = 8 assays) over 20 min. Bottom: Mean distribution of individual D. erecta males on an agar (left) or ACV (right) patch in the presence of a bead lattice. Scale bar indicates relative density. k) Overlaid trajectories of groups of 5 D. melanogaster males on agar (left) and ACV (right) in the presence of the bead grid (n = 5 assays) over 20 min. l) Mean number of approaches per male in (k) for each bead in the grid over 20 min indicated by color and size of the circle. m) Four representative assays from (k) for agar (left) and ACV (right), in which bead approaches for each male (rows) are depicted (black dots) over the 20-min assay. n) and o) Total number of beads in the grid visited (n) and approaches per minute (o) for each individual male in (k) on agar (blue, n = 25 males) and ACV (orange, n = 25 males). p) The number of song bouts per bead approached for D. erecta males in grid assay containing a lattice of 13 fly-sized hemispherical visual targets in a large 190 mm arena on a large 145 mm food patch formed from agar perfumed with ACV (orange, n = 8) or an agar control (blue, n = 8). Individual males were alone in the assay chamber and behavior was scored for all approaches during 20-min assay. q) Distance of a male to the immobilized decapitated female (black) and the closest bead in representative grid assay shown in Fig. 2m with the bead in the second row on the left replaced by an immobilized decapitated female over 20 min. Red dotted line indicates one fly length (3 mm) distance. Once male has encountered the female, he remains close to her for the remainder of the assay, moving farther from the rest of the beads. r) Average fraction of time a male spent with each bead prior to encountering the female (black dots) and fraction of time male spent with the female after encountering her (green dots) for all males that encountered the female on ACV (n = 8). All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: n.s.: not significant; *p < 0.05; **p < 0.001; ***p < 0.0001. See Supplementary Table 1 for full statistics. Schematics in e adapted from ref. 43, Springer Nature Limited.

Source data

Extended Data Fig. 4 Stimulation of olfactory pathways triggers courtship tracking.

a) Schematic showing virtual reality behavioral setup for tethered flies provided with an oscillating visual target (black dot) and with ACV presented through odor tube. b) Target position in the male visual field (top) and corresponding heading direction (center) and tracking index (bottom) of a representative D. erecta male prior to (black), during (orange), and after (black) presentation of ACV with visual target continuously oscillating after an initial 30 s baseline period. c) Tracking indices (TI) of eight wild type D. erecta males prior to (black), during (orange), and after (black) presentation of ACV with continuously oscillating visual target (black arrow) as in (b). d) Left: Mean tracking index of wild type D. erecta males (n = 8, same males shown in c), prior to (black), during (orange), and after (black) presentation of ACV with continuously oscillating visual target (black arrow). Thick lines represent the mean, shaded areas the standard error. Right: Probability of tracking. e) Same as in d) but with D. erecta males mutant for the chemosensory co-receptors Orco and Ir8a (n = 4) deficient in the major olfactory pathways previously implicated in the detection of ACV volatiles60,61. f) Left: Tracking index of D. erecta males expressing CsChrimson in Orco+ olfactory sensory neurons in the antenna and maxillary palps prior to (pre), during (LED) and after (post) optogenetic activation (n = 3). Lines indicate mean ± standard error (shaded). Right: Probability of tracking. All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. Schematic in a adapted from ref. 38, Springer Nature Limited.

Source data

Extended Data Fig. 5 ACV plays a conserved role promoting courtship pursuit across species.

a)Tracking index of D. erecta towards either a slow (16 mm/sec) rotating dot (n = 10, each), a fast (32 mm/sec) rotating dot (agar n = 7, ACV n = 8), or both dots presented together (n = 9, each) in the presence of agar (blue) or ACV (orange). Data for the fast rotating dot are replotted from Fig. 3f. b) and c) Left: Tracking index of D. melanogaster (b) and D. yakuba (c) males towards either a slow (16 mm/sec) rotating dot (Dmel: agar n = 12, ACV n = 11), a fast (32 mm/sec) rotating dot (Dmel: agar n = 15, ACV n = 13), or both dots presented together (Dmel: n = 11, each, Dyak: agar n = 6, ACV n = 7) in the presence of agar (blue) or ACV (orange). Right: Heatmap depicting the position of the fast visual target with respect to the egocentric orientation of the male (facing towards right) for assays in which both stimuli were present. All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; *** p < 0.0001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics.

Source data

Extended Data Fig. 6 P1 neural activity is correlated with courtship tracking across species.

a) and b) P1 neural activity (∆F/F) of D. erecta (a) and D. melanogaster (b) males plotted against tracking index for five individuals (rows) for the entire experiment (all), during the 30 s baseline period (baseline), and with a continuously oscillating visual target prior to (vis, pre), during presentation of visual stimulus and ACV (vis + acv) and after (vis, post) presentation of ACV with only visual target. Line of best fit (red), Pearson correlation coefficient and p-value are indicated for each plot. See Supplementary Table 1 for full statistics.

Source data

Extended Data Fig. 7 LC10a visual responses are similar in D. erecta and D. melanogaster and ACV activates distributed components of the fru+ courtship circuitry.

a) Schematic of LC10a neurons and region of interest imaged (black box). b) LC10a neural activity (∆F/F) recorded in the right hemisphere of a representative D. erecta (left) and D. melanogaster (right) male tracking an oscillating visual target plotted against the position of the target (black line) in the male visual field colored by the target’s progressive (black) and regressive (grey) movement. ACV was provided throughout. c) Target position in the male visual field (top), corresponding LC10a neural activity (center), and heading direction (bottom) for a representative D. erecta male in the presence of ACV during an initial 10 s baseline period and then with visual target continuously oscillating. d) Schematic of fru+ innervation of the Lateral Protocerebral Complex (LPC, green) and Anterior Optic Tubercle (AOTu, red) and ROI used to image both neuropils simultaneously (black box). e) and h) Left: Neural activity (∆F/F) of aggregate Fruitless (Fru+) neurons in the lateral protocerebral complex (LPC) innervated by P1 neurons. Top: Neural activity. Center: tracking index of males prior to (black), during (orange), and after (black) presentation of ACV with visual target continuously oscillating after an initial 30 s baseline period (Dere n = 4, Dmel n = 6). Bottom: neural activity in the absence of a visual target for D. erecta (e; n = 5) and D. melanogaster (h; n = 5). Thick lines represent the mean across individual males (thin lines). Arrow indicates appearance of visual target. Neural activity in LPC and AOTu was imaged simultaneously for each male. Right: Mean neural activity (top, bottom) and probability to track (center) before, during, and after presentation of ACV. f) and i) Left: Neural activity (∆F/F) of aggregate Fruitless (Fru+) neurons in the anterior optic tubercle (AOTu) innervated by LC10a axons. Top: Neural activity. Center: tracking index of males prior to (black), during (orange), and after (black) presentation of ACV with visual target continuously oscillating after an initial 30 s baseline period. Bottom: neural activity in the absence of a visual target. Thick lines represent the mean across individual males (thin lines). Arrow indicates appearance of visual target. Neural activity in LPC and AOTu was imaged simultaneously for each male. Right: Mean neural activity (top, bottom) and probability to track (center) before, during, and after presentation of ACV for D. erecta (f) and D. melanogaster (i). g) and j) Neural activity of Fru+ neurons in the lateral protocerebral complex (LPC) plotted against neural activity of Fru+ neurons in the anterior optic tubercle (AOTu) of males shown in e) and f) for D. erecta (g) and in h) and i) for D. melanogaster (j) with (top) and without (bottom) a continuously oscillating visual target. Dots represent individual frames color coded by the presence (orange) or absence (black) of ACV odor. Line of identity is indicated as grey dotted line. All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. Schematics in a and d adapted from ref. 43, Springer Nature Limited.

Source data

Extended Data Fig. 8 ACV activation of courtship circuitry is conserved across species.

a) Schematic showing 2-photon imaging setup for tethered flies provided with a conspecific female pheromone stimulus. b) Representative labeling of dsx+ processes in the LPC (left), maximum projections of their response to ACV (center), and to tapping a female stimulus (right) for D. erecta (top), D. melanogaster (center), and D. yakuba (bottom). c) Mean tap-evoked responses (left) and corresponding peak responses (right) for D. erecta (n = 5), D. melanogaster (n = 6), and D. yakuba (n = 6) males. d) Neural activity of D. erecta (top, n = 5), D. melanogaster (center, n = 6), and D. yakuba (bottom, n = 6) males prior to (black), during (orange), and after (black) presentation of ACV. Neural activity is represented as change in fluorescence (∆F/F), normalized to tapping responses of each individual (c) across species. Thick lines represent the mean across individual males (thin lines). Right: Mean neural activity. All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; **p < 0.001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics. Schematics in a adapted from refs. 38,43, Springer Nature Limited.

Source data

Extended Data Fig. 9 Locomotion in D. erecta depends on the chemosensory environment and scales with the group size.

a) Courtship index of D. erecta males paired with a D. melanogaster female in small 38 mm arenas with a central 21.5 mm food patch formed from agar perfumed with ACV. Males were either wild type (black, n = 8) or mutant for the DEG/ENaC sodium channel ppk23 (red, n = 7). Courtship indices for the entire 40 min of the assay (left) or the 10 min following courtship initiation are shown. Black lines indicate mean. Enhanced courtship in mutants is consistent with evidence from other species that ppk23 is essential to detection of heterospecific pheromones, suggesting that D. erecta remain averse to courting D. melanogaster females on ACV due to detection of heterospecific pheromones by ppk23+ sensory neurons. Black line indicates mean. b) Mean velocity of individual female and male D. erecta (left) and D. melanogaster (right) in pairs (1m1f, Dere n = 20, each, Dmel n = 8, each) or groups of 5 males and 5 females (5m5f, Dere agar n = 8, ACV n = 7 assays, Dmel n = 6, each) in small 38 mm arenas with a central 21.5 mm food patch formed from agar perfumed with ACV (orange) or an agar control (blue). Individual (dots) and overall means (black line) are indicated. c) Fraction of time male (left) and female (right) D. erecta (D. ere) and D. melanogaster (D. mel) in b) spent moving when paired (1m1f) or in groups (5m5f) over 40 min in a small 38 mm arena with a central 21.5 mm food patch on agar (blue) or ACV (orange). Black lines indicate mean. d) Mean velocity of individual D. erecta (left) and D. melanogaster (right) males in small 38 mm arenas with a central 21.5 mm food patch formed from agar perfumed with ACV (orange) or an agar control (blue). Individual (dots) and overall means (black line) are indicated (n = 10, each). e) Mean velocity of all other males and females in the group during the 2 s window preceding a male courtship bout, compared to a permuted null distribution of 2-s velocity windows in D. erecta groups on agar (left, n = 8 assays) and ACV (right, n = 7 assays). f) Movement probability of a female target for D. erecta (left) and D. melanogaster (right) 1 male and 1 female pair assays in small 38 mm arenas with a central 21.5 mm food patch for the whole 40-min assay (filled circle) and the five second period before the male engages in courtship (open circle) on agar (blue, Dere n = 20, Dmel n = 8) or ACV (orange, Dere n = 20, Dmel n = 8). All statistical tests performed were two-sided, where appropriate. Those comparisons that were statistically significant are indicated as: *p ≤ 0.05; ***p < 0.0001; all other tests were not statistically significant. See Supplementary Table 1 for full statistics.

Source data

Extended Data Fig. 10 Neural labeling of key transgenic lines.

Male brains stained for GFP (green) and neuropil counterstain (magenta) visualizing neural expression patterns of transgenic lines labeling olfactory sensory neurons a) and b) (Orco-Gal4), LC10a neurons c) and d) (VT029314-Gal4), and sexually dimorphic neurons expressing the fruitless e) and f) (Fru-Gal4) and g) and h) (Dsx-Gal4) transcription factors. Scalebars: 50 µm.

Supplementary information

Reporting Summary (download PDF )

Peer Review File (download PDF )

Supplementary Video 1 (download MOV )

Group behaviour in a large arena with central food patch. Representative video clips of D. erecta and D. melanogaster groups of five males and five females in large 190-mm arenas with a central food patch filled with agar perfumed with ACV (orange) or an agar-only control (blue). Clips displayed at 30× speed.

Supplementary Video 2 (download MOV )

Groups in small arena with central food patch. Representative clips of D. erecta and D. melanogaster groups of five males and five females in small 38-mm arenas with a central food patch filled with agar perfumed with ACV (orange) or an agar-only control (blue). Clips displayed at 10× speed.

Supplementary Video 3 (download MOV )

Behaviour of individual males towards an inanimate bead. Video comparing behaviour of individual D. erecta and D. melanogaster males in a small 38-mm arena towards a central hemispherical plastic bead of 3 mm diameter on ACV (orange) or an agar control (blue). Recordings are displayed at 10× speed.

Supplementary Video 4 (download MP4 )

Optogenetic activation of Orco+ olfactory sensory neurons in the presence of a visual target on agar. Video clips of individual D. erecta and D. melanogaster males expressing the channelrhodopsin CsChrimson under the expression of the Orco promoter in small 38-mm arenas with a small black plastic bead on the central agar patch. The representative videos show male behaviour during an initial 2-min baseline period, followed by 2 min of red LED illumination and a final 2-min period with LEDs turned off again. Displayed at 4× speed.

Supplementary Video 5 (download MOV )

Group of males presented with a grid of beads. Video comparing the behaviour of five D. erecta males in a large arena with a large food patch filled with agar perfumed with ACV (orange) or an agar-only control (blue) towards a grid of small hemispherical plastic beads. Clips displayed at 10× speed.

Supplementary Video 6 (download MOV )

Optogenetic activation of P1 neurons in the presence of a moving visual target. Comparison of representative video clips of D. erecta males expressing the channelrhodopsin CsChrimson in P1 neurons (using 71G01 driver) or a CsChrimson only control in a small 38-mm arena with a constantly rotating dot projected onto the floor of the arena of males. Thirty µl of either agar (blue) or agar perfumed with ACV (orange) are added to the center of the arena. Male behaviour is shown before and following onset of red LED light. Clips are shown at 2× speed.

Supplementary Video 7 (download MOV )

Male courtship tracking of projected dots. Behaviour of a D. erecta male in the presence of 30 µl agar perfumed with ACV (orange) and an agar-only control (blue) towards a constantly rotating dot projected onto the surface of a small 38-mm arena. Representative videos shown at original speed.

Supplementary Video 8 (download MOV )

Food-odour-dependent tracking of visual stimulus in tethered setup. Clip of a tethered D. erecta male running on a spherical treadmill presented with an oscillating ‘fictive female’ on a conical screen in front of him before and during exposure to ACV odour. For interpretability of his walking direction, the tracked movements of the treadmill are indicated as a continuous blue line. Shown at 0.5× speed.

Supplementary Video 9 (download MOV )

Correlated burst of courtship activity on agar. Video clip of a group of five male and five female D. erecta in a small arena with a central food patch filled with agar showing how inactivity is interjected with a burst of spontaneous group activity. Displayed at 10× speed.

Supplementary Video 10 (download MP4 )

Courtship with additional moving visual stimuli. Comparison of example videos of a pair of one male and one female D. erecta in a small 38-mm arena supplemented with 30 µl agar perfumed with ACV in the center with and without two constantly rotating black dots projected onto the floor of the assay chamber. Clips played at 2× speed.

Supplementary Video 11 (download MP4 )

Visual social scene replay experiment. Video shows the experimental design of transforming a recording of a group of five D. erecta males and five females on ACV into a visual representation used to replay to pairs of tester males and females followed by two representative replay experiments in which D. erecta pairs are presented with 30 µl agar perfumed with ACV in the center of a 38-mm arena and either a social scene representative of a group on agar or on ACV. Behaviour clips displayed at 5× speed.

Source data

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

[Check for updates. Verify currency and authenticity via CrossMark]

Cite this article

Brand, P., Keller, K., Coleman, R.T. et al. Ecological and social cues orchestrate concerted courtship in Drosophila. Nature (2026). https://doi.org/10.1038/s41586-026-11209-9

Download citation

  • Received: 16 November 2025

  • Accepted: 24 September 2026

  • Published: 04 November 2026

  • Version of record: 04 November 2026

  • DOI: https://doi.org/10.1038/s41586-026-11209-9