Drosophila melanogaster behaviour changes in different social environments based on group size and density

Many organisms, when alone, behave differently from when they are among a crowd. Drosophila similarly display social behaviour and collective behaviour dynamics within groups not seen in individuals. In flies, these emergent behaviours may be in response to the global size of the group or local nearest-neighbour density. Here we investigate i) which aspect of social life flies respond to: group size, density, or both and ii) whether behavioural changes within the group are dependent on olfactory support cells. Behavioural assays demonstrate that flies adjust their interactive behaviour to group size but otherwise compensate for density by achieving a standard rate of movement, suggesting that individuals are aware of the number of others within their group. We show that olfactory support cells are necessary for flies to behave normally in large groups. These findings shed insight into the subtle and complex life of Drosophila within a social setting.

I n the wild, many animals interact and congregate into groups. It has been suggested that within a group, individuals follow simple rules based on local information and interact in ways that produce complex phenomena [1][2][3][4] . The benefits of forming groups can include increased foraging times 5,6 , lower predation risks 7-10 , social thermoregulation (e.g. 11,12 ) and access to mates 13 . The composition of a group can influence the health and fitness of individuals within it [14][15][16] . Thus, understanding how the size and density of a group influence self-organisation can provide insight into the relative benefits of group living.
Drosophila melanogaster aggregate and form groups. Drosophila will aggregate even in the absence of food 17 . In addition, groups of flies display collective avoidance to aversive stimuli and increased foraging efficiency 18,19 . Drosophila groups disseminate social information throughout their life history, from larval communication and collective feeding 20,21 to pheromonal communication during pupal metamorphosis 22 to adult information transfer of oviposition preference 23 and social learning 24 . Within this complex social aggregate, flies may regulate inter-individual distance 25 and maintain a social space 26 , thereby limiting ʽran-domʼ encounters in favour of behavioural interactions 27 . Within aggregates, individual flies synchronise themselves to the group, both in terms of overall behaviour 28 and pheromone profile 29 . Thus, flies adjust their behaviour and physiology to group size and composition.
There are at least two explanations for a fly's ability to sense and respond to the group: (1) with larger densities, the frequency of encounters between individuals increases locally and the fly adjusts to this frequency or (2) single flies are able to sense group size globally, such that their behaviour and physiology are influenced by the size of the group. These possibilities have been confounded in previous studies, which often do not separate the effects of group size and density. To disentangle their roles and gain insight into these key features of group dynamics and their underlying mechanisms, we investigate whether flies adjust their behaviour as a function of group size, density, or both using a social network approach. Moreover, we investigate whether olfaction may affect a group's ability to adjust to different sizes and densities.

Results
Group size and density alter behaviour in wild-type flies. First, we asked whether wild-type flies form social interaction networks (SINs) with different properties depending on the size and/or density of the group (Supplementary Fig. 1). Their interactions were characterised by use of an automated social interaction identification system 27 . For each group size, as density increases the interaction criteria (angle, distance, time) generally decreases, although due to the non-independent nature of how the criteria are calculated, no statistical tests can be done (see ref. 27 ). As group size increases while maintaining a constant density, the interaction criteria generally increases (Table 1; Supplementary  Fig. 2). Thus, flies are adjusting the ways in which they interact based on the size and density of their groups. Next, movement and interaction rates were evaluated. Interestingly, flies across all group sizes and densities move the same amount (Fig. 1a). Intuitively, one would expect that increasing density would decrease individual movement via collision, with the increasing chance of physical encounters, whereas there would be little change in individual movement across constant densities. These results suggest that wild-type flies are regulating their movement to compensate for increasing densities. In addition, their rates of interaction are both group size-and density-dependent: as both group size and density increase, rates of interaction increase (Fig. 1b). Overall, these results indicate that flies are adjusting their interactions based on their group size and density, both in terms of the rate at which they interact and the way they interact, while regulating their movement to compensate for density.
Next, two SIN properties were evaluated: (1) clustering coefficient: a measure of how interconnected neighbours are to one another 30 and (2) betweeness centrality: a measure of network cohesion 30 . For clustering coefficient, groups of six and 12 behave similarly to each other and have a lower clustering coefficient than groups of 24 flies (Fig. 1c). The higher clustering coefficient in groups of 24 indicates that flies are more interconnected when in a large group. For betweeness centrality, groups of six flies form SINs with lower betweeness centrality than groups of 12 and 24 flies (Fig. 1d). This indicates that when flies are in mediumand large-sized groups, they form SINs with greater network cohesion. Overall, these data indicate that flies can evaluate their social environment and alter their behaviour to regulate for differences in density and group size, suggesting that flies respond to their group using both a local and global approach.
LUSH-mediated olfaction regulates behaviour across groups. We asked whether olfaction is required for flies to evaluate the number of individuals in their group, while maintaining a fixed density. To do this, cells expressing the olfactory binding protein, LUSH, were inhibited. LUSH is expressed in all Drosophila trichoid sensillae 31 and facilitates the binding of ligands to olfactory receptors 31,32 . For all measurements, control flies behave similarly to wild-type flies, suggesting that we are capturing a robust group-size effect (Figs. 1 and 2). In lush-inhibited flies, interaction criteria exhibit a similar trend to those of wild-type flies: at constant density, the interaction criteria generally increase with group size (Table 2). Although movement is genotype-dependent, there was no group-size effect on movement: the experimental lush-inhibited flies move the same amount as at least one of their respective control lines (Fig. 2a). We see a similar trend of interaction rates when compared with wild-type flies, where increasing group size increases the interaction rates (Figs. 1b and 2b). In groups of six, inhibiting lush-expressing cells has no effect on clustering coefficient or betweeness centrality. However, when lush-expressing cells are inhibited in flies in groups of 12 or 24, flies organise themselves in ways that mimic a larger group (Fig. 2c,d). Interestingly, for both clustering coefficient and betweeness centrality, lush-inhibited flies in groups of 12 have a higher clustering coefficient and betweeness centrality than their controls and behave as if they are in a group of 24. Groups of 24 lush-inhibited flies have higher clustering coefficient and Table 1 Interaction criteria for wild-type flies for different group sizes and densities. The median angle and distance at which wild-type flies interact and the median duration of an interaction were determined by an automated system 27 . We calculated interaction criteria for groups of 6, 12 and 24 flies at low (blue), medium (orange) and high (grey) densities.
betweeness centrality values than their controls, presumably behaving like they are in an even larger group (Fig. 2c,d). Overall, we observe that, in medium-and large-sized groups, olfaction is required for flies to accurately detect the number of individuals in their social environment and, when inhibited, flies behave as if in a larger group. Moreover, impairing olfaction has no effect on flies in small groups, indicating that other sensory modalities may be used to evaluate small group sizes.

Discussion
In this paper, we show that flies can detect the number of individuals around them and, importantly, their behaviour changes depending on that number. We test group size and density separately and show that some, but not all, group behaviours are density-dependent. A fly's ability to sense and respond to the group is not merely a function of flies encountering each other more frequently: although their interaction rates and interaction criteria change based on both group size and density, their social network properties were primarily dependent on group size. Thus, individual group members can sense their social environment and are influenced by the size of their group. Moreover, we show that lush-expressing cells are necessary for detecting group size. LUSH is required to detect cis-vaccenyl acetate (cVA), a male-specific volatile pheromone, which is known to cause aggregation and dispersal in Drosophila 33,34 . It is possible that cVA is a necessary component for flies to accurately assess group size but that it is not the only factor necessary: when lushexpressing cells are inhibited, flies in groups of six show no effect in their SIN properties. This indicates that flies in small groups may rely on non-olfactory mechanisms for sensing the social environment, such as vision, mechanosensation or auditory cues. Previous studies on groups of 12 flies failed to show effects of vision or sound on group-level structure 35 . However, recent research indicates that both vision and the cVA receptor, Or65a, are required to regulate social group interactions in groups of 10 flies 36 and groups of 50 flies' social clustering is impacted by various sensory modalities, including olfaction, vision and touch 17 . Further studies on smaller group sizes are required to fully dissect how flies detect their social environment. Individuals following simple rules may yield complex group responses despite the absence of a centralised or global control mechanism, a phenomenon defined as self-assembly 37 . At the group level, this can manifest as insect swarms, fish shoals or avian flocks 1-3,38 . The group size-dependent behaviour that we observe for betweeness centrality is seen in shoaling fish, where group sizes greater than six have different foraging properties in the presence of a predator compared with groups of six or less 39 . Similar to our finding of movement across different densities, ants have also been shown to regulate their behaviour based on density 40 . Recent research shows that SINs are formed by various species of Drosophila and their network properties differ across species 41 . Thus, social regulation at the group-level spans across species, taxa and across a variety of social systems. Perhaps because flies are small and move at a quick time scale, most research has not focused on what happens within a group of flies. Yet, it is clear that Drosophila melanogaster has an innate capacity to assess its social environment and participate in complex group behaviour.  Fig. 4).
Video acquisition and fly treatment. Experiments were acquired as described in Schneider et al. 35 . Briefly, fly stocks were maintained at 25°C in a 12/12 Light-Dark cycle. Collections were done under light anesthesia (CO 2 ) within 4 h of eclosion. The appropriate numbers of male flies were housed for 3 days at 25°C in a 12/12 Light-Dark cycle in vials with food. Flies were housed in group sizes determined by treatment. Experiments were performed within a 2-h window starting 3 h before lights off. Flies were gently aspirated by mouth into plexiglass arenas and were allowed to acclimate for 10 min prior to the 30-min video acquisition. Video acquisition was performed in an environmental chamber (25°C, 60% humidity) using Fview software (open source, Ubuntu package used) and FireflyMV (Point Grey) cameras. Each assay was performed on a distinct sample of flies. Flies were discarded after the 30-min video was recorded.
Arena diameters are described in Supplementary Fig. 1. The pLUSH-Kir2.1 experiment was performed at medium density for all group sizes.
Social interaction networks (SINs). These experiments were performed as described by Schneider et al. 35 . Briefly, each flies' trajectory was tracked from the videos using Ctrax (open source, versions 0.3.2 and 0.5.18) to track fly movement, orientation and identity. Ctrax-Fixerrors was used to manually inspect/correct fly trajectories. Custom algorithms were used to generate the SINs at 25% network density. Each network iteration had its structural measure calculated, and then normalised against 10,000 random networks which preserved the in-and outdegree of the iteration to create a Z-score.
Social distance and social interaction space were determined using an opensource automated algorithm described by Schneider & Levine 27 in Matlab (Mathworks).
To generate 'null' datasets, we mixed and matched trajectories within a treatment to generate virtual trials which contained the appropriate number of flies. These trials, therefore, controlled for the movement and behaviour of flies in our arena without social feedback. The 'null' dataset's connectivity matrices and measurements were calculated as above.
To control for the artificial change in network measures caused by varying the network size, the Z-scores of our observed networks were normalised a second time against the average mean and average standard deviation of the respective 'null' measurements.
Each trial (or n = 1) indicates the mean from an independent group of flies (at their correct group size/density/genotype) that were discarded after the 30-min network experiment was acquired. For each experimental treatment, we acquired videos from~20 independent groups of flies (n =~20 for each treatment).
Statistics and reproducibility. We analyzed four network properties, movement and interaction rate. For each experiment, a two-way ANOVA was performed in Matlab (MathWorks) with a Bonferroni corrected alpha (α = 0.008) followed by a Tukey-Kramer post hoc (α = 0.05). Each data point indicates a mean from a single trial, derived from a group of flies that were filmed once and then disposed of. For Reporting summary. Further information on research design is available in the Nature Research Reporting Summary linked to this article.

Data availability
The datasets generated during and/or analyzed during the current study are provided as Supplementary Data.

Code availability
Custom code used in this manuscript is available upon request from the corresponding author.
Received: 8 November 2019; Accepted: 22 May 2020; The median angle and distance at which flies interact and the median duration of an interaction were determined by an automated system 27 . We calculated interaction criteria for groups of 6, 12 and 24 flies at medium density for Kir2.1 UAS control flies (pink), pLUSH-Gal4 control flies (pink) and lush-silenced Kir2.1/pLUSH experimental flies (turquoise).