Paired fruit flies synchronize behavior: Uncovering social interactions in Drosophila melanogaster

Social behaviors are ubiquitous and crucial to an animal’s survival and success. The behaviors an animal performs in a social setting are affected by internal factors, inputs from the environment, and interactions with others. To quantify social behaviors, we need to measure both the stochastic nature of the behavior of isolated individuals and how this behavioral repertoire changes as a function of the environment and interactions between individuals. We probed the behavior of male and female fruit flies in a circular arena as individuals and within all possible pairings. By combining measurements of the animals’ position in the arena with an unsupervised analysis of their behaviors, we define the effects of position in the environment and the presence of a partner on locomotion, grooming, singing, and other behaviors that make up an animal’s repertoire. We find that geometric context tunes behavioral preference, pairs of animals synchronize their behavioral preferences across shared trials, and paired individuals display signatures of behavioral mimicry.


Author summary
It is often difficult to describe why an animal behaves the way it does. This is particularly true when we watch several animals at once. We can intuit from watching interactions in different species, from humans to insects, that an individual does not behave the exact same way in a social context as when completely alone. One aim of studying social behavior is to discover underlying principles that are responsible for the behaviors we observe. While we know animals communicate and engage each other, summarizing social interactions is difficult because each individual, much less each each grouping of animals, is different. Here we measure the interactions of paired fruit flies in a systematic way, and capture how different social pairings affect the behavior of the animals. We find males and females pay attention to their environments and what their partners do at different distances, and paired individuals tend to synchronize behavior with their partners across all types of pairings. Introduction Social behaviors are exhibited by a wide variety of species and include such diverse categories as courtship, aggression, dominance, collective flocking, and group decision making [1][2][3][4][5][6][7][8][9][10]. Ultimately, the actions an animal performs are influenced by a combination of genetics, environment, social pressure, and internal state [11][12][13]. Separating these contributions to isolate the nature of social interaction has remained a challenge. It is often difficult to define precisely what a social behavior is. Studies of social behavior range from characterizing simple metrics such as distance between individuals [14,15] to machine learning methods aimed at identifying and scoring the occurrence of specific behaviors from human-annotated datasets [16] to studies of the emergent properties from the social interactions of large numbers of animals in a flock or school [17].
Here, we focus on the effect of one individual on another's behavior in a paired context. In the past, proximity data has been used to discover rules governing the short-range interactions between individuals in groups [15,18,19]. Other work looked unidirectionally at the effect of one individual's locomotion on sensory stimuli from a partner [20][21][22][23]. Social behavior is bidirectional, and these previous methods are insufficient for studying the reciprocal nature of social behavior and are not easily extended to behaviors that are more complicated than locomotion. We build on this previous work by recording the position and full behavioral repertoire of pairs of fruit flies, and separately quantify the effects of environment and social interactions on an individual's behavior [24].
Social behaviors can manifest in multiple ways as illustrated in Fig 1. We represent schematically the behavior of a hypothetical fly through its behavioral time series, or ethogram, and a histogram of the relative frequencies of the occurrence of each of four behaviors. This individual (shown in blue) performs three behaviors, switching stochastically between them, but overall performs each behavior for the same total amount of time as seen in the bar plot ( Fig 1A). The next three panels deal with three possible expressions of social interaction when a second fly (shown in red) is added to the arena. In one scenario, the overall time spent performing each behavior is unaltered but the two flies synchronize their behaviors in time as can be seen in the ethograms ( Fig 1B). Alternatively, the presence of the red fly could cause the blue fly to alter the time spent in each behavior ( Fig 1C). Finally, we consider the possibility that the presence of a partner causes the fly to perform a fourth behavior that only occurs in a social context (Fig 1D). We looked for signatures of these possibilities in our data and find evidence for each type of interaction.
The simultaneous performance of the same behavior in con-specifics ( Fig 1B) has been reported across many species, and the phenomenon has been referred to as mimicry (not to be confused with Batesian mimicry, where one species copies the physical appearance of another [26]), imitation, synchrony, and contagion [25,26]. Neural mechanisms of behavioral mimicry have been explored in humans and the discovery of mirror neurons, cells which reliably fire during the execution of motor sequences performed by others, has spurred hypotheses about their mechanisms in learning and pro-social behavior [27]. The proposed functional roles of mirror neurons in humans and certain apes include action understanding and action learning, properties which are not likely to exist in simpler organisms [28]. However, even simple behavioral mimicry can benefit a group of individuals, and provides evolutionary advantages such as enhanced avoidance of a predator and the facilitation of feeding behaviors [29][30][31][32][33][34]. Social facilitation has also been shown in fruit fly grooming, and suggests that grooming may play a part in social signalling [35]. These effects can arise from simple behavioral matching, where an animal performs a behavior already present in its repertoire in response to the action of another, and do not require complex cognitive mechanisms [36,37]. More recent work has shown that fly dyads separated by a translucent barrier exhibit correlations in their distances to the barrier, and that freely interacting pairs of flies align several other behavioral features such as circling and wing usage [38,39].
Here, we ask whether there are discernible behavioral effects arising from simple social pairings of fruit flies by using an unsupervised behavioral quantification paradigm. We characterize behavior directly from movie images in the same way regardless of social context, and use the resulting behavioral labels to investigate how individuals regulate behavior when placed in different pairings. Our analysis tracks the occurrence of a broad set of behaviors including grooming, locomotion, crawling, and idle behaviors. These categories are defined via an unsupervised clustering method followed by human annotation [24,40].
Comparing the effects of same-sex and courtship pairings on behavior, we find that the behaviors performed by an individual depend on not only the social pairing but also the spatial setting an individual finds itself in. We characterize the behavioral effects induced by the location of a fly within the experimental arena and the distance of the individual to its interaction partner, and identify the presence of behavioral mimicry within interaction pairs at short time scales.

Behavioral movie recordings
We used a custom-built rig to film the behavior of interacting fruit flies. Our rig can accommodate four experiments at once, allowing for the acquisition of two dozen half-hour movies per day. The setup is the same as described in [24], where four cameras are used at once to record the activity in four separate domes placed on the same back-light. Flies are loaded by gentle manual aspiration and movies are started within a minute after flies are introduced into the arena. Because fruit fly activity and courtship levels are known to vary over their circadian cycles and lifetimes, we aim to capture behavior from flies at similar times within these cycles and film only within the four hours after the lights come on. To keep experiments consistent, we isolate flies upon eclosion and age them four to six days before imaging.
In order to address the effects of a paired social context, and not just the courtship context, we filmed behavioral movies of male-female pairs as well as male and female same-sex pairs. Additionally, movies of isolated flies from the same population for either sex provide a control that allows us to compare spontaneous behavior to interaction. The number of movies and time of behavior recorded for each pairing is summarized in Table 1. Courtship movies are not analyzed past the point of successful copulation, and therefore have variables lengths, whereas all other movies are analyzed over the entire length of recording.

Behavioral analysis
We performed behavioral analysis for all recorded movies using the pipeline introduced in [40]. Table 2 lists the parameters used for image PCA, wavelet decompositions, tSNE embedding, and clustering. The original embedding was performed using a sampling of points from all movies in order to facilitate comparisons between the various social contexts. As the total data set is too large to store the relevant distance matrix in memory (about 60 million data points), we instead train the tSNE algorithm on a smaller training data set of N train = 38,500 points. To generate an informative training set, we first perform a tSNE embedding of regularly spaced points for each movie in the dataset and then build a training set from a diverse selection of points from each movie. This training set was used to perform a final tSNE embedding into which each movie was re-embedded as described previously [40]). We then applied a watershed transform to the resulting density histogram to delineate clusters with local density peaks (for more information refer to [40]). Movies sampled from each category of behavior were manually inspected and found to fall into eight broad categories (Table 3). Examples from several clusters are demonstrated in Supplemental S1 and S4 Videos. S1 and S2 Videos show specific wing movements that were labeled 'left wing song' and 'right wing song' and then combined under the broad category of 'song' in our manual clustering step.

Calculating behavior correlations
Probability densities for each coarse behavior are found by calculating the fraction of time an individual spent in each state as determined by embedding in the behavioral map. The densities for any given individual or experimental group can be written as P = [p song + p wing + p locomotion . . .] where each entry of P is the fraction of time spent in the given behavior, and the sum over P is one. Correlations between behavioral probabilities within individuals and between paired individuals are measured using the Pearson's linear correlation coefficient. For example, the correlation between male song behavior and female locomotion in the courtship case is calculated by finding the Pearson's correlation coefficient of all male courtship p song probabilities with their corresponding female courtship partners' p locomotion probabilities. This returns a measure of how well each pair of behaviors is correlated between social partners irrespective of timing.

Density map similarity metrics
We quantify the similarity between experiments in different social contexts by calculating the Jenson-Shannon (JS) divergence between their behavioral probability distributions (Eq 1) [41]. Since any behavioral map (represented by a 501x501 matrix) may have very small values, a mask is first applied to each map before comparison so that only entries with value > 1E − 6 in the mean behavioral map are used. All infinite and NaN values are then removed before summation. Units are presented in bits. Table 3. Eight coarse behavioral clusters were used to describe 116 fine-grained behaviors obtained from the behavioral map. These broad descriptions were used to sort behaviors and label the behavioral map.

Mutual information analysis
In order to probe the temporal coupling of behaviors, we calculate the mutual information (MI) between paired behaviors for all movies in a given context and for each movie individually. We use the following equation, where B 1 and B 2 are the underlying distributions of behaviors for a given type of individual.
While this calculation provides a measure of how much information is present between two behavioral time series of interest, it is more informative to consider the pointwise entries of the MI before summation, which is calculated for each pairwise set of behaviors . This value reveals how much each pairwise entry contributes to the total MI, and accounts for how often a pair of behaviors co-occur compared to their expected co-occurrence assuming no social interaction. These values may be negative if behaviors occur together less than expected assuming independence. Given the large and variable sizes of our datasets, it is difficult to interpret the absolute value of the MI. We thus produced synthetic data using an 8-state Markov Model (MM) with probability and transition matrices matching our data from trajectories through the coarse behavioral space for each interaction context. This synthetic data is the same length as the true data for each context and provides a baseline level for the MI expected from a random Markovian process that can be compared to the MI from experiments.

Results
We recorded the behavior of Drosophila melanogaster across lone and paired individuals in a featureless circular arena of radius R arena = 11 mm for up to 30 minutes (or until copulation in the case of courtship pairings). The number of experiments and total time recorded for each pairing are summarized in Table 1. Video was recorded from above on a back-lit stage, where flies were allowed to freely move and interact under a plastic dome. The resulting videos were analyzed using an unsupervised behavioral platform to assign behavioral labels [24,40]. We also extracted the position and orientation of each individual over time from the videos.

Position and orientation for single and paired flies
The shape and size of the physical environment can affect where animals go and what they do. To start, we tracked the position and orientation of each animal in the arena across all behavioral recordings. Flies in all measured conditions showed a preference for the edge compared to the middle of the arena, which we quantified through the distance to the center, d c (Fig 2A). This effect has been previously reported when flies are restricted to a circular arena, and shows the importance of arena geometry when considering spontaneous behavior [42]. We also see a drop off at very high d c as the fly must push itself into the sloped region of the domed arena to occupy those locations.
For paired contexts, we calculated the distance between the individuals, d p (Fig 2b). These distributions are bi-modal for all pairings with a narrow peak at short distances and a broader tail that extends to the largest separation that the animals can achieve, d p = 2R arena . These features are indicative of an interaction between the animals and not consistent with a model in which the position of the animals is uncorrelated. We compared the histograms in Fig 2b to the expected distribution of distances between two points randomly chosen from the measured

PLOS COMPUTATIONAL BIOLOGY
probability distributions of occupancy in the arena (red lines) and find that all pairings spend more time at short distances than for this null model.
We further find that individuals in courting pairs spend much more time close to each other than those in same-sex pairs. This is likely because most of the behaviors associated with courtship occur at a short distance to allow for physical, chemical, and auditory communication and attempted copulation. Interestingly, the male-male and female-female pairs also exhibit a peak at short distances, indicating that these pairings also induce short-range social interactions. To further visualize the combined effects of pairing and the environment, we plotted the two-dimensional histogram, P(d c , d p ), for each context (Fig 2C). For same sex pairs, the short-range interactions mostly occur near the edges of the arena (high d c ) whereas courting pairs display short-range interactions over a larger area in the arena.
We next examined the preference of flies to orient themselves relative to a partner ( Fig 2D). We define the angle of heading for a paired individual as the displacement in degrees from facing toward the interaction partner as described in [24]. The courting male predictably spends most of his time facing toward the female while the female is unlikely to face toward the male during courtship as she spends most of the time moving away from the male. The same-sex pairings exhibit more uniform distributions of heading, indicating that they do not prefer to face towards or away from their interaction partner as strongly as during courtship. Interestingly, the paired males and paired females show a suppression of heading directly toward their interaction partner. This effect has been suggested previously, when it was shown that a female odor incited males to orient toward and touch other flies, but a male odor had a lesser effect [43].

Quantification of behavior across social contexts
We quantified the behaviors exhibited by lone and paired flies using the method described in [40] and [24]. In summary, each time point from a movie is mapped to a point in a two-dimensional representation of the postural dynamics of the body (Fig 3). The estimated two-dimensional probability density, visualized as a heat map such as in Fig 3a, describes the behavioral repertoire of a set of individuals. Clusters from the two-dimensional point cloud, found using a watershed algorithm on the estimated density, represent distinct stereotyped behaviors. A watershed transformation of this density generated from all recorded individuals produces 116 fine-grained behavioral clusters that capture all of the behaviors performed by lone and paired flies in our experimental arena. We manually assigned each of these clusters to one of 8 coarsegrained behavioral labels (song, wing, locomotion, crawl, anterior, posterior, small/slow, and idle) by viewing randomly selected movie clips that were assigned to each fine-grained cluster. Fig 3a shows the progression from points in the two-dimensional space to a density map which is then segmented based on the coarse labels. Finally, we visualize the frequency of each behavior in a bubble plot where the area of each circle corresponds to the relative amount of time a given behavior was performed. The colors and position for each label are shown in Fig  3d. The transition probabilities between pairs of behaviors are displayed using curved black lines [44]. These plots (Fig 3b) are then used to compare the relative frequency of each behavior in a given context, as well as to show the transition structure between the coarse-grained behaviors.
We find that behavior varies based on social context (lone, or paired with a same-sex partner or opposite-sex courtship partner, Fig 3b). Males perform more fast locomotion behaviors than females when isolated in the experimental chamber, while females tend to crawl and turn more often. Lone individuals of both sexes perform anterior grooming more than their paired counterparts, but paired individuals perform more posterior grooming and wing movements

PLOS COMPUTATIONAL BIOLOGY
across all pairings. Females in a same-sex pairing are idle much more often than individuals in any other experimental group. Individuals in any of the paired contexts display an increase in small body movements (such as reaching using the legs) over isolated individuals. Locomotion decreases from the lone baseline in each paired context except for male-male pairings, where there is a sharp increase. Finally, male individuals in same-sex pairings also display a decrease in idle behaviors over their lone counterparts.
To compare behavior quantitatively, we calculated the Jensen-Shannon (JS) divergence between the behavioral probability densities for all pairs of contexts (Eq 1, Fig 3c) [41]. The JS divergence measures the similarity between two probability distributions. By performing a hierarchical clustering of all pairwise similarities, we find that the three female contexts are most similar to each other, followed by the lone and male-male paired contexts. Courting males are by far the most different, driven by courtship-specific song and wing behaviors. Interestingly, males that are lone or paired with another male are more similar behaviorally to females from all contexts than to courting males.

The effect of arena position on behavior
We combined measurements of animal position and postural dynamics to investigate the effect of environment on behavior. We visualized the behavior of individuals from each experimental group at varying distance from the center of the arena (Fig 4c). First, we considered the behavior of lone individuals given arena position and found that active behaviors such as locomotion and crawling increase the further an individual resides from the center of the arena, as has previously been reported [42]. Males in particular spend a large portion of time circling the arena, illustrated by the sharp increase in locomotion fraction after the 7 mm mark. Anterior, posterior and wing grooming, on the other hand, are more commonly performed toward the center of the arena and suppressed at the edge when compared to locomotion and crawling.
Paired flies show the same trend as a function of distance from the arena center, and we see enriched locomotion at the edges of the arena (Fig 4c). Behavior does not depend linearly on distance from the center of the arena. We quantified the amount of change in behavior with position by computing the JS divergence between behavioral densities at different radii ( Fig  5A). For all contexts, the distribution of behaviors observed from time points where flies are within 7 mm of the center are fairly similar whereas there is a marked change in behavior at the 7 mm mark. This effect is stronger in males than females, and is not as prominent in the courtship condition for either sex, likely due to social arousal interfering with environmental cues.

The effect of a partner on behavior
We have previously shown that distance to a courtship partner has an effect on behavioral density [24]. We generated behavioral maps for each paired context from time points spent in sliding 2 mm distance bins to the partner, and find that this is also true for same-sex pairings. We performed the same analysis of similarity between distributions as when investigating spatial effects, and discovered a block-like structure in the all-to-all JS divergence measurements across partner distance in certain contexts (Fig 5b). There appear to be two modes in courting male behavior depending on proximity to the female, and the drop off between these modes occurs at a distance of approximately d p = 4 mm. Surprisingly, the male-male context has a similar behavioral switch at this distance, although the effects are not as strong as in the courting context. The changes to the female behavioral density as a function of partner distance are more subtle in either female context, and suggest that social behavior in females is not as dependent on these simple variables.
In order to build models of social behavior, we must consider whether the individual preferences of animals within a pairing affect the behavior of both individuals. We first calculated the correlation coefficient between all pairs of behaviors performed by an individual animal in the single and paired contexts (S1 Fig). The correlation analysis within individuals is related to how animals distribute their time between different behaviors. There are several consistent trends across all individuals, such as positive correlations between crawling and locomotion,

PLOS COMPUTATIONAL BIOLOGY
which simply means that individuals that tend to walk often also tend to run more than their counterparts. Another similar finding is that individuals that perform wing-related behaviors often also perform more posterior grooming, likely because these behaviors are related and are typically performed one after the other through the hierarchical transition structure of fly behavior [44][45][46][47]. Other features of both lone and paired individuals include negative correlations between vastly different behaviors. For example, there is a strong negative correlation in all cases between crawling and idle behaviors, which accounts for the fact that flies that spend their more of their time moving will spend less time standing still.
Correlations in behaviors between paired individuals illustrate how a social pairing influences the behavior of each present individual (Fig 6). We display the correlation values between coarse-grained behavioral densities of paired individuals and find that there are strong positive correlations across several behavioral pairings. We find that locomotion, anterior grooming, and idle behaviors are correlated in same-sex pairs of flies (correlation values between paired females are .64, .63, and .59, respectively, and correlation values between paired males are .68, .55, and .60, respectively). Courting flies also have a moderate to strong correlation for locomotion (r = .69) and anterior grooming (r = .65) within pairs, as well as other weaker off-diagonal correlations corresponding to courtship specific behaviors such as

Synchronization of instantaneous behaviors
The correlation analysis above shows that flies will align their behavior when introduced to an arena together, however this does not tell us about the temporal structure of paired behavior. In order to address whether individuals change their behavior not just due to the proximity of the interaction partner but also the behavior it is performing, we looked for structure in the simultaneous behavior of paired flies. We calculated the mutual information (MI) between the ethograms of paired individuals and display the positive components that contribute to the total information in Fig 7a. We compared these measurements to the MI between non-interacting individuals by modeling the fly behavior as Markovian using the measured behavioral probability densities and transition matrices (S3 Fig). We find that in all three types of pairs there is a clear enrichment of information along the diagonal, which indicates that paired individuals perform the same behavior more often than is expected by underlying probability alone. This effect comes mainly from simultaneous locomotion, anterior grooming, and idle states, and varies according to pairing. Female-female pairs are particularly likely to remain idle together whereas male-male and courting pairs are more likely to locomote together, clear examples of Synchronized Behavior (Fig 1B).
The mutual information in the same-sex pairings is symmetric because each interaction is counted twice, once for each individual. The courting matrix considers the male and female behaviors separately. The non-negative partial mutual information in the first few columns means that there is some information about what the female is likely to be doing while the male is singing and performing wing motions, and this is most often idle behaviors, slow movements, and anterior grooming. When we sum over the partial mutual information values in each category, we can calculate the total mutual information for a particular context, summarized in Table 4.
When we calculate the mutual information (MI) on a movie-by-movie basis (Fig 7B), and consider only the underlying probability for each individual instead of all individuals in that context, we find that the information content is somewhat diminished across each of the contexts. This indicates that paired individuals have some mutual behavioral effect that is not simply related to their simultaneous actions. The enrichment in the simultaneous locomotion and simultaneous anterior entries informs us that even within a pairing, these behaviors are more likely to be performed together than by chance. The reduction in paired male simultaneous locomotion and paired female simultaneous idle states, however, indicates that this effect in the combined MI calculation is due to a synchrony effect on an experimental, and not temporal, scale. In other words, two females placed together may both become more idle for the course of a recording, but not necessarily synchronize the time spent idle in the way that occurs with other simultaneous behaviors. The same is true for males particularly prone to locomotion.
Histograms of partial mutual information (PMI) for several synchronized behaviors show that not all pairings contribute to positive non-zero MI values (S4 Fig). Courtship pairings with high PMI values for synchronous locomotion indicate times where males spent a long period of time chasing females, but even this interaction was seen in only some recordings.
Similarly, each PMI distribution shows that many pairings, even when pooled data shows an effect, did not individually show synchronization.
We illustrate the synchronization of behavior using ethograms of paired individuals that were in the top quartile of synchronization by correlation and mutual information metrics in Fig 8. The same-sex pairings display synchronization of anterior grooming, posterior  Table 4. The sums across partial mutual information are calculated for each context from the matrices displayed in Fig 7 and 7b and from simulated data generated using a one-step MM with probability densities and transition data derived from behavioral sequences for each condition. All values are in bits.

PLOS COMPUTATIONAL BIOLOGY
grooming (which sometimes appears as a combination of wing movements and posterior grooming) and locomotion. Additionally, the overall densities of behavior look very similar within pairs, corresponding to the correlated behaviors described in Fig 6. For comparison, several ethograms from lone individuals are displayed in the same way (S6 Fig). The courtship example here is demonstrative of many successful courtship pairings, where grooming and locomotion may be synchronized early on, followed by the introduction of male song and an increase of slow female behaviors. One possible explanation for the synchronization we observe based on MI values is that one individual will be startled or begin running based on the activity of the other individual sharing the arena. This could be based on visual cues that do not necessitate the presence of another fly, but instead simply any moving object. After exclusion of time points where either individual in an experiment was moving quickly (threshold = .4mm/s) we find that the positive distribution of PMIs indicating simultaneous anterior movements is not diminished (S5 Fig). This means that even within time spent standing still and performing only small movements, individuals spent more time than expected jointly performing grooming of their heads and antennae than expected by assuming independence.
While there are clear trends for preference of positioning between animals in a small arena (Fig 2), we also find that the preferential execution of different behaviors depends on an individual's location in the arena and especially distance to its partner. We visualize these preferences given each of eight coarse behaviors in Fig 9. We observe differences between the behavior of flies between contexts that indicate different aspects of paired behaviors. Females in a courtship condition show few distinctions between behavioral preference, whereas a courting male shows a clear preference for different behaviors based on distance to his courtship target. Courting males differ from males in a same-sex pairing in several interesting ways in particular: they run while near their courtship target (chasing), and perform anterior movements as well as idle behavior more rarely when near the interaction partner. These preferences, coupled with a propensity to perform wing extension and wing motions (song) when near the female result in canonical courtship behavior.

Discussion
Here, we investigate the structure of fruit fly social behavior at several scales, paying particular attention to the differences between paired and lone flies. We find that being in a social setting has a predictable effect on what an animal does that depends on the specific context. Unpaired animals respond strongly to the arena geometry and these effects persist in paired contexts. On top of this geometric modulation, the distribution of behaviors performed by an individual changes with the distance between animals and the difference in their headings. Our methods utilize new computer vision methods that can address the entire behavioral repertoire [48][49][50] and find changes across the spectrum of behaviors including locomotion and grooming. We find evidence for three different ways in which social interactions modulate fly behavior (Fig 1). By examining the MI between the behaviors of paired animals, we find multiple examples in which the general behavior of an individual is altered by the presence of a partner ( Fig  1C). Surprisingly, we also find evidence for the synchronization of behaviors between the individuals (Fig 1B), evidenced both by measurement of the MI and through examination of paired ethograms. Finally, we observed the introduction of song in males when in the presence of a female, a behavior that the male never performs when alone or when paired with another male (Fig 1D).
The use of behavioral clustering techniques that automatically produce labels for large amounts of data have allowed identification of other more subtle types of interactions [51][52][53]. We see a shift in behavioral density not only when pooling data over many individuals (Fig 3) but also within individuals experiencing different social situations (Fig 6). The correlation coefficients of certain behaviors (namely anterior-anterior, locomotion-locomotion, and idleidle) between pairings of individuals within a given pairing indicate that each paired set of flies is unique but on average pairs tend to adjust or match their behaviors throughout an interaction. Mutual information analysis on pooled and individual interaction experiments confirms this matching, and indicates an even more precise temporal component of behavioral synchronization. Even by excluding data points where either individual was moving within the experimental chamber, we find that individuals perform anterior movements together more often than expected when assuming independence.
These aspects of behavioral organization offer an explanation for how more complex, and potentially collective, social behaviors are constructed [38,39,54]. Groups of flies may use synchronization in social situations to successfully navigate new environments by leveraging information from their con-specifics [55]. Some social imperatives, such as that of the male to chase and sing to the female, may outweigh these subtle effects. One aspect of the synchronization we observe is that it is inconsistent across pairs even within the same context. The stochastic nature of behavior may balance organizational principles and lend to exploration and variation. Social interaction lends itself to heightened states of motivation or arousal, and the quantitative approach presented here is one way to discover and characterize the behavioral tuning that accompanies these latent states [56,57]. Given a way to identify these potentially subtle yet distinct behavioral effects, we may be able to begin linking these distributed effects to their genetic and neural bases [58,59].

S1 Fig. Correlations between coarse behaviors across contexts.
The behavioral density given eight coarse behaviors is calculated for each individual in a given context, and the correlation coefficient between all pairs of behaviors over all individuals in specified context is displayed. A higher correlation coefficient corresponds to a set of behaviors that co-occur more frequently within individual experiments than expected by chance.