article: Isolation profoundly influences social behavior in all animals. In humans, isolation has serious effects on health. Drosophila melanogaster is a powerful model to study small-scale, temporally-transient social behavior. However, longer-term analysis of large groups of flies is hampered by the lack of effective and reliable tools. We built a new imaging arena and improved the existing tracking algorithm to reliably follow a large number of flies simultaneously. Next, based on the automatic classification of touch and graph-based social network analysis, we designed an algorithm to quantify changes in the social network in response to prior social isolation. We observed that isolation significantly and swiftly enhanced individual and local social network parameters depicting near-neighbor relationships. We explored the genome-wide molecular correlates of these behavioral changes and found that whereas behavior changed throughout the six days of isolation, gene expression alterations occurred largely on day one. These changes occurred mostly in metabolic genes, and we verified the metabolic changes by showing an increase of lipid content in isolated flies. In summary, we describe a highly reliable tracking and analysis pipeline for large groups of flies that we use to unravel the behavioral, molecular and physiological impact of isolation on social network dynamics in Drosophila.
  Social interactions range from simple touch contacts as seen in Caenorhabditis elegans, Drosophila melanogaster (fruit flies) and other animals, to the most complex social behaviors of primates including human beings [1–4]. Social interactions are a key feature of the life style of many species. In socially interacting species, isolation is thought to profoundly influence the response to stress, as shown in humans, monkeys, mice and fruit flies [5–10]. In humans, isolation is known to even affect the onset and progress of diseases [11]. Furthermore, a few studies revealed a potential link between social conditions and gene expression [12,13]. For example, Cole et al [14] profiled leukocytes from older humans with different social connections and found correlations between genome-wide transcriptional activity and social conditions, specifically the level of loneliness. This suggests that changes in social conditions, particularly the degree of “isolation”, may influence gene expression patterns. To unravel the complex mechanisms of social behaviors, which occur in groups, tools are essential to analyze all interacting individuals at the same time. Whilst most studies still focus on dyadic interactions to limit the complexity of analysis [15–17], these studies cannot reflect the group-level relationships. More recently, researchers have begun to use social networks to analyze the relationships among the whole group of individuals [18–21]. Social network analysis allows to examine and quantify the social relationships in groups, such as the influence of individuals towards the whole group, spread of behavior throughout the group, etc. [22]. For our needs, social network analysis completes the toolset required to study the effects of isolation on group behavior, which includes also molecular and genetic analysis, and individual and grouped physiological and behavioral analysis. Drosophila melanogaster is a very powerful genetic and neuroscience model that can to a certain extent readily be used to study social behavior and its underlying mechanisms. In order to study social behaviors in the fly, for example the effects of isolation on behavior and metabolism, a few key challenges remained open and needed to be addressed. These include appropriate experimental setups, reliability and accuracy of tracking, behavioral classification and detailed social network analysis. Presently, few of these are readily available with the required level of accuracy that we needed for our study on the effects of isolation on social behavior. While there has been enormous progress in the study of pairs of flies in dyadic interactions [2], tools are lacking for larger groups. Especially, the efficient and accurate tracking of large groups of flies is a non-trivial problem. Ctrax, introduced by Branson and colleagues [23], was one of the first powerful algorithms to track multiple unmarked flies under laboratory conditions. While it can identify flies or other animals accurately when apart from each other in high resolution recordings, Ctrax creates tracking errors during interactions (loss and swap of individual identities and creation of new tracks) in a low resolution video [24]. Similar algorithms were used in 3D tracking methods using multiple cameras [25], in which the unexplained assumption was made that each interaction involves only 2 flies. Though such assumption may be valid for small numbers of flies, it may become incorrect as the number of flies increases. idTracker [26] was introduced to track multiple unmarked animals including flies to stop identity errors from propagating after interactions, even with complete occlusions. However, as stated by the authors, for idTracker to be in proper working order, the image of each individual should comprise at least 150 pixels, which is almost ten times more than that of a typical fly in videos acquired with easily accessible and affordable cameras. Therefore, the currently available tracking algorithms are either unreliable or they have too many constraints for simple and efficient usage, thereby making improvements like the one we propose in this paper necessary. The next key issue in the analysis of social behaviors is the classification of various types of behaviors. Manual scoring is observer-dependent and can be arduous when multiple flies are involved [23]. Schneider J, et al [27] proposed a rule-based automated alternative to classify a number of well-defined interactions based on distance, duration and approach angle. However, the approach described in their study is not generic and cannot be applied to classify other behaviors. Also, the natural behavior of a fly is difficult to describe by a set of rules. An interactive machine learning based approach (JAABA) was recently proposed by Kabras et al [28], in which a user iteratively labels specific behaviors, and a machine learning algorithm uses these as training examples to predict future occurrences of the same behavior. However, the iterative process of creating the training dataset might be tedious for long videos. Thus, our approach differs from the above approach both in the classification strategy and in way that the training dataset is extracted. Schneider et al [20] were the first to study social interactions of Drosophila at the group level by generating unweighted dynamic networks. Based on binary social network parameters, they concluded that social isolation had no effect on the networks. On the other hand, Simon et al [5] used a static parameter called the social space index, denoting the distance between resting non-interacting flies, to conclude that 7 days of isolation enlarges the social space between young (3–4 days old) flies. Our aim in this work is to extend these initial studies on social isolation, by investigating the effect of isolation on the social structure of flies at group-level over a long period of time. Although a social interaction network can be useful to quantify social behaviors, it has its limitations when comparing different conditions, such as different biological repeats of an experiment. In that case, the intuition is to average the parameters of the social networks obtained from the individual repeats, which is only valid for a homogenous network structure [20]. This is certainly not true in our case, since in our social isolation experiments, each time a new batch of flies is used. In this paper, we propose a novel method to average social networks by matching individual flies, such that the variance of network parameters is reduced. In summary, in this paper we describe an effective and reliable pipeline to image and analyze large groups of walking male flies. The pipeline consists of 1) an efficient and relatively low-cost acquisition setup, 2) an improved tracking algorithm (error-free for up to 16 male flies) based on a graph-theoretical framework, 3) a machine learning method for the classification of social interactions, and 4) a novel algorithm for computing an average social network to analyze the social structure. We apply this pipeline to study behavioral changes due to isolation and correlate these with changes in genome-wide gene expression. Our results show strong and specific effects of isolation on social network dynamics, metabolic gene expression and animal physiology.
  Data acquisition was performed using Flyworld, a closed computer vision setup, consisting of a specifically designed arena [29] and a high speed digital camera (Fig 1A). We previously developed Flytracker [30], an algorithm to track fruit flies in a video using a graph-theoretical framework that ensures an accurate estimate of the number of flies, even when multiple flies interact. As a result of the algorithm, we obtain trajectories for each fly’s body center along with its head and tail positions. Flytracker was able to track up to 50 male flies without further error-fixing (Fig 1B–1D and S1–S3 Videos). To demonstrate the improvement Flytracker provides compared to previously available methods, we used Ctrax to reanalyze our videos, and found that it detected wrong numbers of flies in 60–70% of the frames (Table 1, S4 Video), varying from 6 to 17 flies in 16-fly videos. This resulted in broken tracks and thus identity losses, requiring further patching effort to connect the broken tracks. Next, we tested the resolution limit of Flytracker. To this end we recorded videos of male and female flies walking in an arena originally designed for Buridan’s paradigm [31] (see S1 File for a detailed illustration of the setup). Briefly, our Buridan’s arena consists of a 12cm platform surrounded by water preventing the flies form reaching an illuminated cylinder beyond the water. Flies with clipped wings are placed in the area and are filmed from above at low resolution (7–10 pixels per fly) as they walk freely within the arena. We tested the tracking of 1,2 and 10 flies. In all cases Flytracker successfully tracked the flies (S5 Video) as they walked within the arena. However, tracks were lost when the flies were at the very edge of the arena touching the water, likely due to changes in pixel intensity at the arena-water edge. These data suggest that Flytracker can successfully identify and track individual flies or group of flies in videos form multiple settings and at a range of resolutions, including as low as 7–10 pixels per fly. To validate Flytracker, we established ground-truth. For this, we manually tracked all flies, and found only three identity swaps in one 50-fly 1-hour video and zero errors in two randomly chosen 16-fly 1-hour videos (S6 Video, details are described in the Methods). The swaps of identities in the 50-fly video occurred when 2 flies jumped while crossing each other. In all subsequent experiments, groups of 16 male flies were used to ensure that no tracking errors occur, which is crucial for the following procedures. After video acquisition and tracking, a supervised machine learning-based method as described by Nath et al [32] was used to detect the social interactions between male flies. Social interactions were defined as close physical contacts between two or more flies. In this paper, only “head to-tail touch” events (see Methods for a detailed definition) were considered (Fig 1E, S7 Video). A “touch” was defined as a head-to tail touch event in a single frame. A “touch interaction” is obtained when a touch lasts for at least 15 consecutive frames (~0. 5s). A gap of at least 15 frames between two consecutive interactions was required to separate the two interactions. A training and test dataset was generated by a human expert, annotating frame-by-frame touch events in the video. Using the fly trajectories and body positions, relative and temporal features were extracted. Based on these features, the supervised learning algorithm was trained to recognize single frame head-to-tail touch events after which touch interactions could be extracted. From each tracked video, a directional weighted interaction network for touch interactions was constructed. This network can be represented by an adjacency matrix. Fig 1F shows such a matrix as a heat map. A sample adjacency matrix and its corresponding network are shown in S6A and S6B Fig. Each node represents a fly and each edge denotes that there have been one or more touch interactions between two flies, where the thickness of the edge indicates the number of interactions. From multiple repeats of an experiment under the same conditions, an average network is calculated by first matching the individual social networks using a graph matching technique, followed by averaging the weights of these matched graphs in order to ensure optimal correspondence between flies at similar locations across the 10 networks [33] (S2 Fig). The average weighted directional networks of control experiments and experiments under social isolation conditions were compared quantitatively. For this, we calculated three types of parameters: individual fly parameters such as the Weighted Degree (describing the tendency of a fly to interact), local interaction parameters such as the Clustering Coefficient (describing the strength of interactions between neighboring flies) and global interaction parameters such as the Global Efficiency (describing the overall structure of the network). The key parameters for our analysis were the Weighted Degree, Weighted Total Interactions (describing the tendency of flies to interact in the whole group), Clustering Coefficient, Global Efficiency, Assortativity (describing the tendency of interactions between similarly active flies), Betweenness Centrality (describing the importance of a fly as connection “hub” to other flies) and Transitivity (describing the global tendency of flies to interact with another fly with shared adjacent flies). For a detailed description of all the parameters please refer to the methods section. Besides these network parameters, the Total Walking Distance is calculated directly from the tracks as a measure for the locomotor activity. In order to test our social network analysis pipeline and to study the effect of isolation on the social network structure, we performed isolation experiments. In a first set of experiments, we tested the effect of 6-day isolation on the social network. From ten repeats of the experiment, each time with a different control and isolation group, we constructed the average networks of the control and isolated groups and analyzed their network parameters (Fig 2G and 2H). A strong effect of 6-day social isolation was that the flies displayed an enhanced locomotor activity, demonstrated by a significant increase in Total Walking Distance (Fig 2A). However, when looking at the global network characteristics, e. g. by the global network parameter Weighted Total Interaction, no significant differences between isolated and control flies were found (Fig 2B). This indicates that the total social activity across the entire network was not significantly affected by 6 days of isolation. In contrast, we found a significant increase of individual network parameters such as the Weighted Degree and the other degree related parameters for the isolated flies (Fig 2C, S3A–S3C, S3E and S3F Fig). Thus, while the total number interactions remained similar, individuals within the isolated group revealed an increased amount of interactions and an enhanced locomotor activity. To address the observation that isolation enlarges the number of interactions without a major change in the global structure of the social network, we examined local network parameters. No significant difference between control and isolated flies was found in the Betweenness Centrality. Therefore, no evidence was found for an enhanced activity of specific “hub” flies (S3D Fig). In contrast, the Clustering Coefficient of isolated flies was found to be significantly higher than that of controls (Fig 2D), indicating a significant increase in the amount of local interactions among neighboring flies within the network. In other words, we observe an increase in the amount of social interactions among local groups of isolated flies relative to controls. As stated above, the activity at the whole-group level was not affected by isolation, since along with the Weighted Total Interaction, the other global network parameters did not differ significantly between the control and isolated flies. This was the case for Global Efficiency, Density, Assortativity and Transitivity, respectively (Fig 2E and 2F and S3G and S3H Fig). In summary, we found that 6 days of isolation caused an increase in the locomotor activity and frequency of interactions at the local level without changing the global structure of the social network. The isolation period of 6 days may be longer than required to cause changes in social behavior. Conversely, behavioral changes may have occurred and then disappeared again within the 6-day period. To determine the minimum number of days of isolation required to result in social behavioral changes, we repeated the isolation experiments for periods of 1,2, 3,4 and 5 days of isolation using the same methodology. Fig 3 shows the obtained average networks. Interestingly, compared to the control groups, the visualization of the networks of the isolated flies shows increased connectivity (which amounts to an increase in the number of interactions, proportional to the thickness of the arrows), which rises steadily and rapidly over time. Isolated flies walked significantly more than flies in control groups starting from day 2 of the experiment onwards (see Fig 4A). The walking distance continued to rise steadily during the 6 days of isolation. Similarly, an increase in Weighted Degree and Clustering Coefficient occurred very early (day 1) and persisted over the entire isolation period (Fig 4B and 4C). These results indicate that an increase in locomotor activity, individual interactivity and amount of local interactions occurs very quickly after social isolation, with a persistent long-lasting effect. In contrast, we found no significant differences in global parameters. Weighted Total Interaction and Global Efficiency showed an increase on days 3 and 5, but not on other days (Fig 4D and 4E). We found similar effects for the other global parameters Assortativity, Density and Transitivity (Fig 4F and S4G and S4H Fig). The network data indicated that individual and local social parameter changes after social isolation are early-occurring and long-lasting. Next, we investigated if these behavioral changes were accompanied by alterations in gene expression [34]. To this end, we performed RNA-sequencing of 16 male flies isolated for 1,2, 3 and 6 days, and their equally treated grouped housed control flies. Our differential expression analysis showed that the vast majority of changes in gene expression occurred after 1 day of isolation and that the changes were very transient (Fig 5A). A few changes were seen on Day 2 (Fig 5B), and the effects on gene expression almost completely disappeared on Day 3 and Day 6 (S5A and S5B Fig). Specifically, 136 genes showed significant changes in expression levels on Day 1, with 64 upregulated genes and 72 downregulated genes (Fig 5C). On Day 2, there were 23 upregulated genes, including 7 persisting from Day 1 and 12 downregulated genes, all persisting from Day 1. Thus, while both behavioral and gene expression level changes were initiated early (Day 1 and/or Day 2), behavioral alterations were long lasting, while changes in gene expression levels were transient. Altogether, our data so far suggest that already after only a single day of isolation flies alter their physiology and behavior to promote social interactions with neighboring flies. One of the individual fly parameters that changes early and persistently is walking distance. We therefore asked how this individual fly parameter might relate with local network-level parameters affected by isolation such as Weighted Degree and Clustering Coefficient and how this might evolve over isolation time. To this end, we calculated the correlation coefficient between walking distance and local interaction parameters on days 1,2 and 6. We find that after 1 day of isolation there is a strong correlation between walking distance and local interaction parameters in isolated flies but not in controls. These correlations emerge in controls on day 2 and persist in both groups on day 6 (S7 Fig). This suggests that already after one day of isolation flies dedicate much of their walking to social interaction, even when there is not yet a significant change in the total distance they walk. Finally, to gain insight into the physiological processes affected by isolation-induced that might trigger early changes in behavior, we analyzed the isolation-induced gene expression alterations. The DAVID Bioinformatics Resources 6. 8 (Beta) [35,36] was used to investigate the functions of those genes using the GO (Gene Ontology) terms: MF (Molecular Function), CC (Cellular Component) and BP (Biological Process). GO enrichment analysis shows that most changes affect genes involved in metabolism (Fig 5D and 5E and S5C and S5D Fig). Specifically, there was enrichment for genes involved in lipid (lipase activity) and carbohydrate metabolism and cellular degradative processes among the upregulated genes, and enrichment for genes involved in amino acid and biogenic amine metabolism among the downregulated genes. No other categories were found to be significantly enriched. Next, we investigated if isolation affects gene expression by changing isoform balance through alternative splicing. To this end, alternative splicing events in our RNA-seq data [37] were profiled. However, a very limited number of alternative splicing events (S1 Table) was found, affecting no more than 1 or 2 genes on any given day of isolation. On early days (Day 1 and Day 2) genes encoding cytoskeletal proteins, such as Myofilin, coding a core protein in the thick filaments of muscle [38], and Pif1B, a Janus Kinase and microtubule-interacting protein coding gene [39], were affected. Mf was alternatively spliced on both the first two days. After 3 days of isolation, a gene encoding a nucleic acid regulating protein, namely the Purine-nucleoside Phosphorylase Related protein, CG16758 [40], and the squid (sqd) [41] gene encoding an RNA-binding protein were affected. All these changes involved a reduced number of exons in the mature mRNA. Interestingly, in flies isolated for 6 days, the desaturase 1 (desat1) gene, whose product is involved in fatty acid synthesis [42,43] and pheromone (cuticular hydrocarbons) biosynthesis [44] was affected through the choice of an alternative first exon. Our genomic-wide expression analysis showed that isolation of fruit flies caused changes in the expression and splicing of genes involved in lipid and hydrocarbon metabolism. To test if these changes are biologically relevant, we tested if the observed changes correlate with physiological changes in vivo by measuring the weight and lipid content of isolated flies compared to controls. The wet weight, dry weight, and lipid weight of 16 flies of each group were measured (S5E–S5G Fig), hence lipid weight as well as lipid weight normalized by dry weight (lipid/dry-weight) were calculated (S5H and S5F Fig). We found that isolated male flies, have significantly higher lipid content (13. 36% ± 5. 52%, mean ± SD) than that of control flies (9. 40% ± 3. 54%, mean ± SD) (Fig 5F). Furthermore, the absolute values of dry weight and ether weight are both significantly higher in isolation group, whereas lipid extracted weight has less difference compared to absolute lipid weight. This suggests the absolute dry weight increase in isolation group comes mainly from lipid composition. Additionally, we observed a similar increase in lipid/dry-weight was in isolated female flies (Fig 5F).
  In this paper, we describe the establishment of a novel framework for the accurate tracking of multiple flies, their behavior classification and a method to study social network dynamics. We use this framework to study the effects of isolation on social network dynamics and performed the first genome-wide gene expression analysis to correlate transcriptomic and behavioral changes upon social isolation in male Drosophila. Importantly, this pipeline uses easily available hardware to record long videos of interacting flies. The use of a graph-theoretic structure for the tracking algorithm allows to detect a constant number of flies in each frame, thus it is highly reliable and accurate and no further steps are required to correct for broken tracks. We confirmed this by the manual tracking of 2 randomly chosen videos. The supervised machine learning approach that we used for classification is generic and allows to extend the study of mere “touch” interactions to other types of interactions such as “sniff” or “chase”. Therefore, this platform is well suited for an accurate large-scale, long-term assessment of social behavior in flies. In theory, this approach is transferrable to any other species. Additionally, the interfaces between different components of the pipeline are compatible with other established methods, so that other researchers can adapt their experiments to our pipeline with minimum effort. In this study, we implement for the first time the use of an average network for social touch interactions for a large group of male flies. Previously, [20] work used social network analysis to study group behavior in flies. In their research, the dynamic iterative network was built based on the consecutive interactions among the individuals, for example 33 consecutive interactions were used for iterative network construction in most results, rather than a fixed period of interactions. When they compared the differences between networks, they averaged the parameters of networks, which might lose information of heterogeneity within the network since the flies are not in similar position/functions within the group. Unlike network analysis in other fields [45–47], individuals (flies) in our research are not the same across networks, which could create hierarchy within the group. Taking the heterogeneity of network into account, matching individuals across the networks while studying multiple network is crucial for accurate analysis of behaviors. The average network built in our work based on graph matching of individuals first minimized the variance across the networks hence generates closer result to reality. Having developed these tools, we applied them to study the consequences of isolation on social network dynamics. The results showed that social isolation affects the interactions between isolated flies by increased locomotion activity and local social interactions, with minimal effects on the global pattern of social interactions. Social isolation in humans is a risk factor for, and may contribute to, poorer overall cognitive performance and executive function, increased negativity and depressive cognition [48]. There are more and more studies trying to unravel the relations between social environment changes, for example, isolation, and gene expression, to understand the process of the social influence. Previous studies on leukocyte of elderly human being have revealed some connections between social loneliness to immune system gene expression changes [14]. A study on mice shows [49] showing upregulated brain-derived neurotrophic factor upon social isolation. We tracked the changes in gene expression over social isolation time and found that changes in gene expression occurred very early together with, and even before some of, the behavioral changes. These gene expression alterations were highly specific, affecting mainly metabolism, and very transient. Further experiment demonstrated that isolation has caused increase in the weight of Drosophila compared to that of control group, both in the gross weight (wet weight, dry weight, and ether weight) and normalized lipid content. It is tantalizing to speculate that a transient alteration in the metabolic state of flies upon social isolation plays a potentially causal role in long term behavioral changes, but this needs to be studied in much greater depth in the future.
  Canton-S wild-type Drosophila melanogaster were raised on standard cornmeal/agar medium in large vials at room temperature (22 °C) and a 12h light/dark cycle. 9-day old flies were taken out of their vials and put onto a petri dish after cold anesthetization. Male flies were collected under a stereo microscope. Groups of 16 male flies were sorted and introduced into a new small vial. All flies were kept in new vials for one day before treatment. After one day, the flies were transferred to new small vials either individually or grouped depending on the treatment. For the isolation group, 16 flies were transferred to 16 new small vials and kept in the small vial for 1–6 days, depending on the length of isolation. For the control groups, all 16 flies were transferred to one small vial and kept for 1–6 days, depending on the length of treatment in the experimental group. In total for each repeat of the experiment, there were 6 groups of isolated flies and 6 groups of control flies. All experiments were repeated 10 times. We constructed Flyworld (Peira bvba, Turnhout, Belgium) to record multiple flies in a walking arena [29] under different illumination conditions, with a high-speed infrared camera (Fig 1A). The 3D models of the arena and key supporting materials (S1 File) are developed using SolidWorks 2012 which can be read and measured using a free version software, eDrawing. The IR LED panel underneath the arena was made by Peira. The main parts including arena and camera cost approximately 3000 euros. On the day of recording, flies were taken out of vials and put into the fly chamber of Flyworld using cold anesthetization 2–4 hours after the start of light cycle. After a one-minute recovery period, the locomotion activities of the flies were recorded for 60 minutes in complete darkness. Movies were recorded at 30 fps using a high-speed infrared Genie HM640 camera (640x480px, Teledyne Dalsa, Waterloo, Canada). The recording chamber was designed to enforce the movements of flies in a two dimensional plane [29]. In order to accomplish this, the height of the chamber was limited to 3. 5 mm, which prevents flying but still permits free walking without clipping off the wings [23]. The ceiling of the chamber was coated with Sigmacote (Sigma-Aldrich NV/SA, Diegem, Belgium), which prevents flies from walking on the ceiling and obscuring the imaging of other flies. This procedure is crucial to achieve error free tracking, since it reduces the chance of total occlusion between flies. The chamber and the cover were cleaned with 75% ethanol between each experiment to remove possible residues on the setup. The videos were recorded in an uncompressed format, and were later compressed using MPEG-4. A compression rate was chosen which does not compromise the image quality but reduces the video size. The Flytracker is developed mainly using MATLAB (version 2015b, tested on both Mac OS Sierra and Windows 7 systems, now available for download and development at github (https: //github. com/flytracker/flytracker). Flytracker’s reliability in tracking multiple flies is based on one particular assumption that shapes the algorithm: the number of flies remains constant throughout the video. Since the field of view of the camera in Flyworld covers the whole walking arena, this assumption is automatically met. As in Ctrax [23], tracking is achieved in two steps: fly detection and identity assignment. During fly detection, each frame is segmented to separate flies from the background. Each fly is detected as a set of white connected components on a black background. Each fly in this setup has an area of approximately 20 pixels. The key feature of Flytracker is a graph-based framework [50] to estimate the number of interacting flies in a frame. If the number of connected components is lower than the total number of flies in a frame, one or more connected components in a frame will contain 2 or more interacting flies. These are easily detected since their sizes are larger than the typical size of a single fly. When assuming that the previous frame has been processed and all flies are identified, a bipartite graph is constructed between the previous and the current frame. A bipartite graph contains 2 disjoint subsets of nodes, with edges only connecting one subset to the other [51]. In our case, the first subset denotes the previous frame and contains all individual flies as nodes while the second subset denotes the current frame and initially contains all connected components that contain 2 or more interacting flies. These nodes are then duplicated n times, where n is the number of missing connected components, i. e. the total number of flies minus the number of connected components in the frame (S1A Fig). Edges connect the nodes from the previous frame with the nodes from the current frame, and are weighted by the distance between the locations of the corresponding flies. The assignment problem has now become a minimum weighted matching problem and is solved using the Hungarian Algorithm [52]. As a result, a minimum weighted graph is obtained in which each node from the previous frame is connected to one of the nodes of the current frame. The number of edges that a node in the current frame receives is then the number of interacting flies in the corresponding connected component. This connected component is then split into individual flies using the Expectation-Maximization algorithm, also applied by Ctrax. The main advantage of the proposed graph-based method is that in each frame the correct number of flies and thus tracks is always identified. Once all connected components are split to contain one unique fly, the flies can be identified by a unique assignment with the flies from the previous frame. For this identity assignment step, exactly the same framework is applied using a weighted bipartite graph where one set of nodes in the graph represents the flies in the previous frame, while the other set of nodes represents the flies in the current frame, again connected by an edge, weighted by the distances between the corresponding fly locations. Minimization of this weighted bipartite graph is again done by the Hungarian algorithm [52,53]. The orientation of the flies is determined based on the assumption that a fly mainly walks with its head pointing in the direction of its motion [23]. To validate the tracking results, two experts have independently examined one 50-fly and two 16-fly 1-hour videos. In Supplementary Video 4, a particular fly (Fly 1) is labeled with a black box for easy tracking. Positions of the particular fly, 30 frames before and after the current frame are displayed in black dots to help the observer to predict possible losses of identity. All flies were labeled with their fly ID number. During each validation cycle, an observer followed the particular fly throughout the whole 1-hour video to check if there is a loss or swap of identities. After completion of one cycle, the observer choses another particular fly (Fly 2) and so on to repeat the above procedure until all flies have been analyzed. The same procedure was applied to validate two 16-fly 1-hour videos. Once all flies are tracked, social interactions between the flies can be detected. Flies can exhibit different types of interaction (e. g. chasing, sniffing, …). Given the low spatial resolution of Flyworld, detailed fly body kinematics are not visible, which limits our search to simple types of interactions. In this work, we focused on one particular touch event, in which one fly (the interactor fly) approaches another fly (the interacted fly) by a head-to-tail contact. A touch interaction was then defined as a situation where a touch event lasts for at least 0. 5 seconds, while a gap of at least 0. 5 seconds was required to separate two distinct touch interactions. Single frame touch events were determined by a supervised learning method, using Support Vector Machines (Nath et al [32]). For this, a number of features was calculated from the fly tracks. In order to be able to distinct a single frame head-to-tail touch event from other touch events, these features need to describe the specific action dynamics from the fly. For this, 22 temporal features are defined, i. e. the Euclidean distances between the interactor and interacted flies over 11 time frames centered around the time frame under consideration, and the relative displacements of the interactor fly over the same time window. A training data set was built by manually annotating touch events. The training data set contained 1000 frames of touch events and an equal number of no-touch events. Testing data sets were built by manually annotating 3 different fly-pairs exhibiting the two events. Each testing data set contains 1000 events, to be classified into one of the two behavioral classes. The result of the classifier was validated with the ground–truth of the testing data set. A separate comparison was also made with a second expert’s annotation on the same video and on the same set of flies. Once all frames are classified either as a touch event or as a no-touch event, the touch interactions are determined based on the 0. 5 second rule. All fly trajectories are then subdivided into intervals in which the fly either exhibits a touch interaction or not. After video annotation and classification, the results are represented by a weighted adjacency matrix, which is a square matrix, with each element denoting a particular fly pair. The value of the element (weight) represents the number of touch interactions between the particular fly pair. From the adjacency matrix, a social network is constructed, as a directed weighted graph, by representing flies by nodes and their specific touch interactions by edges. An illustrative example adjacency matrix and its corresponding social network is shown in S6A and S6B Fig. The sample adjacency matrix contains the number of touch interactions between any pair of flies. Each node in the corresponding social network in S6B Fig represents a fly and an edge denotes that the particular fly pair exhibits touch interactions. Each edge is weighted by the number of touch interactions between the fly pair, as shown by the thickness of the edge. The network is directed in order to identify the principal interactor fly and the interacted fly: the edge starts from the node of the principal interactor fly and points to the node of the interacted fly. In the networks, the flies are labeled with numbers (from 1 to 16) in ascending order of out-going activity (number of touch interactions as an interactor fly) so that all flies with similar network ranking across different networks are placed into similar positions. Each social network was quantified by nine well established network parameters, as previously defined by Wey. T et al [21]. Each adjacency matrix is normalized by its maximum weight before computing the social parameters. We use the same example network from S2 Fig to explain and compute the parameters. S2 Table show the values of all parameters of the sample social network. The parameters are subdivided into three categories. Individual parameters: Local parameters: Global parameters: In order to represent several experimental repeats as a single network with the same features as the individual networks, a methodology is proposed to construct a single graph from a set of multiple graphs. If D = (X1, …, Xk) is a sample of k graphs, then the standard method of calculating the mean graph, M=1k (∑i=1kXi) will fail because it assumes that the fly representing a particular node is the same for all graphs. However, in our experiments, each graph is constructed using a new set of flies. A correspondence between the flies in the different graphs should be established. Such a correspondence is established by an optimization-based graph matching technique [58,59]. If W1 and W2 represent 2 (m × m) networks, then both graphs are matched by minimizing the Frobenius norm ∥W1 –PW2PT∥, where P is the set of all (m × m) permutation matrices [33]. Since this minimization problem is NP-hard, we use the Graduated Assignment algorithm [60]. Once all the graphs are matched, there is a correspondence between the flies in one network to the flies in the other networks. , i. e. fly 1 representing node 1 of graph 1 corresponds to fly 1 representing node 1 of graph 2 and so on. Then, the standard method can be used to compute the average network M=1k (∑i=1kX′i), where X′i represents the matched network of the ith experiment. Algorithm 1: Algorithm to compute the average network of a set of k social interaction networks. Input: a set of k (m x m) interaction matrices each representing a social interaction network. Output: an average network of the set of k originals networks. Step 1: Choose one interaction matrix W1 and set the mean matrix M = W1 Step 2: For i = 2 to k Step 3: End Isolated or control flies were collected on the day of experiment. Isolation or grouped housing lasted for six days. Three repeats of each experiment were performed, with 16 flies in each group. Flies were collected 2–4 hours after the light cycle starts. Cold anesthesia was used to immobile the flies and to transfer them into RNA free tubes with beads. Following the TRIzol (Invitrogen) protocol [55]. In short, 16 whole bodies of fruit flies were homogenized and RNA was extracted after phase preparation and precipitation. RNA sequencing was done following standard protocols of Illumina NextSeq. Raw sequence reads from the FASTQ files of 24 samples were mapped against the Drosophila melanogaster reference genome dm3 using STAR2. 3. 1t with default parameters [61]. Only the uniquely mapped reads were used in the following analysis. To identify the differentially expressed genes, the reads were counted against the Ensembl Drosophila melanogaster annotation BDPG5 to calculate the numbers of reads per gene. The counts of all samples were tabulated. Then this table was fed to DESeq [62] for normalization and identification of differentially expressed genes between control and isolated groups for all four time points (1 day, 2 day, 3 day and 6 day) using the standard workflow as previously described [62–64]. The Benjamini-Hochberg procedure [65] was used to correct for multiple hypothesis testing. The differentially expressed genes are identified with an FDR cutoff of 0. 05. To identify the differentially alternatively spliced events, the reads were count against the gene models generated from the Ensembl Drosophila melanogaster annotation BDPG5 to calculate the number of reads on the splicing junctions. The junction counts were then processed to extract the splicing events. The counts for each event was tabulated and the differential splicing of each event between control and isolated groups for all four time points (1 day, 2 day, 3 day and 6 day) was tested using the Dirichlet multinomial model as previously described [37]. The Benjamini-Hochberg procedure [65] was used to correct for multiple hypothesis testing. The differentially alternative spliced events were identified with an FDR cutoff of 0. 05. Gene Ontology (GO) analysis for differentially expressed genes of all comparisons was performed using Fisher’s exact test. The dry weights of adult flies were measured with a Mettler-Toledo XS105 precision balance in groups of 16 from isolated or grouped housed flies (see the isolation part of the Methods for details). After dry weight measurements, the adults were put in the same groups into Falcon tubes, which were racked overnight in an oven at 50°C containing silica gel. The next day the dry weight of the flies was measured. The lipid content of the same groups of flies was measured by lipid extraction using petroleum ether (Sigma-Aldrich, 320447, adapted from Fairbanks and Burch [66]). To measure lipid content, the same groups of flies were placed overnight in sealed test tubes containing 3 mL of petroleum ether. The next day the ether was poured away and the larvae were dried for several hours at 50°C. The total lipid content was calculated as the dry weight subtracted from the dry weight after ether extraction. The percentage of lipid content from the dry weight was calculated afterwards. Since the data was not normal distributed, we used non-parametric statistical analysis for locomotion activity and social activity. Walking distance is analyzed using unpaired t test with Welch’s correction for isolation experiment and two-way ANOVA with multiple comparisons within control or isolation groups over 6 days. In isolation experiments, we used the non-parametric Mann-Whitney test to compare social parameters between isolation group and control group. Non-parametric two-way ANOVA (Scheirer-Ray-Hare extension to Kruskal-Wallis) test was used for post-hoc multiple comparison in experiments where flies were isolated for different days. Fisher’s exact test was used for GO enrichment analysis. D’Agostino & Pearson normality test was used for normality test of lipid/dry-weight analysis. Paired t-test was used for comparison between control and isolation groups in lipid weight experiment.
summary: Social isolation severely affects the behavior and physiology of social animals, including humans. The fruit fly is a powerful model for studying the mechanisms of development, health and disease and is also used to study social behaviors such as mating and aggression. However, these studies are limited to examining few individuals for shorts amounts of time, due to the lack of effective computational tools for the analysis of large groups over prolonged time. To overcome this hurdle, we built a new behavioral arena and developed new software that accurately tracks many flies simultaneously over long time periods. The arena is cheap and easy to build and the software works with low resolution videos. Using these improved tools, we studied social isolation in groups of male flies. We found that isolation caused flies to form stronger interactions with neighboring flies in their social network. These behavioral changes were preceded by transient changes in the expression of metabolism genes and eventually resulted in isolated flies accumulating fat, as has been previously observed in studies in mice and humans. Our study opens the door for the use of fruit flies in future studies of social isolation.
keywords: invertebrates
  machine learning algorithms
  medicine and health sciences
  applied mathematics
  sociology
  social sciences
  animals
  biological locomotion
  simulation and modeling
  animal models
  algorithms
  alternative splicing
  drosophila melanogaster
  model organisms
  mathematics
  artificial intelligence
  network analysis
  experimental organism systems
  social networks
  drosophila
  research and analysis methods
  computer and information sciences
  lipids
  behavior
  gene expression
  insects
  arthropoda
  biochemistry
  rna
  machine learning
  eukaryota
  rna processing
  nucleic acids
  physiology
  genetics
  biology and life sciences
  physical sciences
  organisms
title: A simple computer vision pipeline reveals the effects of isolation on social interaction dynamics in Drosophila