A New Chamber for Studying the Behavior of Drosophila

Methods available for quickly and objectively quantifying the behavioral phenotypes of the fruit fly, Drosophila melanogaster, lag behind in sophistication the tools developed for manipulating their genotypes. We have developed a simple, easy-to-replicate, general-purpose experimental chamber for studying the ground-based behaviors of fruit flies. The major innovative feature of our design is that it restricts flies to a shallow volume of space, forcing all behavioral interactions to take place within a monolayer of individuals. The design lessens the frequency that flies occlude or obscure each other, limits the variability in their appearance, and promotes a greater number of flies to move throughout the center of the chamber, thereby increasing the frequency of their interactions. The new chamber design improves the quality of data collected by digital video and was conceived and designed to complement automated machine vision methodologies for studying behavior. Novel and improved methodologies for better quantifying the complex behavioral phenotypes of Drosophila will facilitate studies related to human disease and fundamental questions of behavioral neuroscience.


Introduction
Due to the development of sophisticated genetic tools, Drosophila has emerged as a powerful model system for studying the causal relationships between genes, neurons, and behavior [1][2][3]. Progress in identifying such relationships is inhibited by the fact that the methods available for quantifying behavior lag in sophistication behind the tools available for manipulating gene or neuron function [4]. Machine vision offers a promising strategy for automatically tracking and measuring the behavioral phenotypes of flies [5][6][7][8][9][10][11][12][13]. However, the robustness of these automatic methodologies is highly dependent on the quality of the raw data contained within the digital movies of the flies' behavior. Conventional chambers used for studying the behaviors of flies possess several features that make the measurement and analysis of behavior difficult. For example, high ceilings permit flight, which is difficult to track using a single low-temporal resolution camera. Vertical walls in a chamber allow flies to walk up and onto the ceiling, creating a situation in which flies may overlap and obscure each other. Vertical walls also lead to significant changes in the appearance of flies as they move among the different surfaces of the floor, wall, and ceiling. These deviations in appearance can obscure identifiable features that might have been useful for detecting specific behaviors, such as the position of the fly's wings and limbs. Furthermore, cracks, corners, and vertical surfaces are attractive to flies and promote their clustering on the wall or in the periphery of the chamber. These features all result in problematic scenarios for automatic tracking methods based on a digital video stream (Fig. 1).
Here we present a new strategy for constructing experimental chambers that restrict the behavior of flies to within a monolayer. Low ceilings prevent flies from hopping or flying over each other, an acute angle formed between sloped walls and the ceiling reduces the number of flies walking onto the ceiling, and a slippery ceiling limits the duration flies may cling to the ceiling before falling to the floor. Previous methods to keep flies within a monolayer have required elaborate designs, such as water moats [14] or thermal barriers [13], and the limitation and tedium of clipping off the flies' wings. Our design lessens the probability that flies obscure each other, limits the variability in their appearance due to moving among various regions of the chamber, and promotes a greater number of flies to move throughout the center region of the arena. Flies within the new chamber can exhibit all of the behaviors normally observed in a laboratory setting, with the exception of flight. The new design helps in generating improvedquality raw data and therefore complements machine vision methodologies for automated studies of complex behavioral phenotypes of fruit flies.

Fewer Problematic Conjunctions
To compare the number of flies that have a high probability of overlapping, we introduced groups of 50 flies into chambers with our new sloped-wall design and conventional chambers with vertical walls. Aside from the shape of the wall, the chambers had comparable heights and diameters. After allowing flies to settle for 1 hour, we counted the number of problematic flies, i.e., flies residing on the walls and ceiling of each chamber (Fig. 2). For 14 days, we observed groups of flies introduced into 2 chambers with sloped walls and 2 chambers with vertical walls. As expected, chambers with sloped walls contained negligible numbers of problematic flies, whereas the percent of problematic flies in chambers with vertical walls ranged from 30% to 70% (Fig. 2B).

Behavior Restricted to Monolayer
To illustrate how chambers with the new design complement automatic methodologies for studying behavior, we used Ctrax software designed to track and retain the identity of individuals within large groups of flies [13]. For these observations, we introduced 25 male and 25 females flies into a 12.7-cm diameter chamber with sloped walls and recorded their movements for 30 min ( Fig. 3; Movie S1). Ctrax requires that the flies remain within a planar arena and not overlap. As described above, chambers designed with sloped walls prevented flies from obscuring each other by moving up the wall or onto the ceiling of the chamber. The glass ceiling on these chambers prevented flies from leaving and also allowed an unobstructed view for recording their behavior. By design, the entire chamber was uniformly backlit, creating high contrast silhouettes of the flies to facilitate the tracking of their movements and classifying their identity and gender. As indicated in Fig. 3, the Ctrax software was particularly robust when analyzing data collected in our slopedwall chambers.

Reduced Variability in Appearance
To compare the variability of a fly's appearance between chambers with sloped and vertical walls, we used movies recorded of single flies moving for the first hour after introducing them into the chambers [15]. After subtracting the corresponding background image, we determined the number of pixels making up a thresholded representation of the fly from each frame for each movie (Fig. 4A). For each fly we determined its median pixel value during the entire length of each 6-hour movie. We used the number of pixels from each frame over the median number of pixels from the entire 6-hour movie as a proxy measure for the deviation in a fly's appearance (Fig. 4B, C). From direct observation of movies, we observed that much of the deviation in appearance in chambers with sloped walls was due to changes in the fly's behavior, including short flights, hops, grooming, various wing movements, and changes in typical walking posture. In addition to the deviation due to these changes in behavior, large deviations resulted from changes in the fly's profile when it moved among the floor, wall, and ceiling in chambers with vertical walls. To illustrate that there was less variability in a fly's appearance in chambers with sloped walls, we compared the deviation in appearance for 26 flies, introducing 13 flies into each chamber (Fig. 4D). The results indicate that variation in pixel area is much lower in the sloped-wall chambers.

Decreased Measurement Errors
CADABRA, a recently developed method for automatically measuring social interactions, bases its classifications for specific behaviors on changes in the relative position between flies [12]. This method then fine-tunes the classifications and determines the detection of specific behaviors by correlating the measured positions to changes in the flies' appearance, i.e., patterns of wing postures or measures of relative body length and width. For such a strategy to work, it is critical that measurements of body orientation and the identity of flies are correct. Here we used the outputs from CADABRA to illustrate that the vertical walls found in conventional chambers increase the number of measurement errors for body orientation and fly identity, undoubtedly contributing to missed and mischaracterized social interactions. We analyzed 36 movies of single males courting single females up to the onset of copulation or up to 20 minutes, whichever came first. Half of these movies were recorded in a new sloped-wall chamber and half were recorded in a conventional chamber with vertical walls. We measured the number of erroneous flips in body orientation by comparing the output of CADABRA to an estimate of body orientation based on a global optimization from all frames of a fly's trajectory from each movie sequence, part of the errorcorrecting capacities of the Ctrax software [13]. This optimization simultaneously finds the head-tail assignment for all frames such  that (1) the change in the orientation between consecutive frames is small and (2) the velocity direction and orientation of a fly match the frames in which the fly is walking. We used the difference between the automatic measurement from CADABRA and the corrected estimate as a metric for the number of erroneous flips in orientation. We also estimated the number of frames containing erroneous swaps in identities between flies, by setting a classification threshold in which both flies had an identical change in the distance of their positions that was greater than 1.5 mm within a single frame. We based this estimation on the changes in their positions between consecutive frames that were also measured automatically with CADABRA. Using these metrics, we compared the number of erroneous flips in body orientation per second for individual flies and the number of frames with identities swapped per second between pairs of flies. We observed that the rate of erroneous orientation and frames containing erroneous identities were significantly less in sloped chambers than in conventional chambers (Orientation: Mann-Whitney U, p,0.0001 { ; Identity: Mann-Whitney U, p,0.0001 {{ ; Fig. 5; Movie S2, Movie S3).
To further illustrate that it was the vertical walls in the conventional chambers that increased the number of measurement errors, we compared body orientations and swaps in identity   Cropped image taken from a movie that included only a small region surrounding the fly, a cropped background image from the same region of the chamber excluding the fly, a differenced image between the cropped image and the cropped background image, and a binerized representation of the difference between the images determined by a threshold. The total number of pixels from the binerized representation of the flies was calculated for each frame. (B, C) Examples using 100-second windows of movie illustrating the lower variability in the total number of pixels extracted from movies of flies recorded within the chambers with sloped walls, as compared to those with vertical walls. The median pixel area was calculated from the entire movie (gray line) and was approximately equal to when the fly was on the floor and stationary in the chambers with sloped walls. (B) Significant deviations from the median pixel area in the chamber with sloped walls corresponded to a hop (arrow) and a period when the fly was grooming (region between dashed lines). (C) Deviations in pixel area in the chamber with vertical walls were due to changes in the fly's appearance as it rotated on the wall between side and head on (astrisk) or moved from the wall onto the ceiling (region between dashed lines). (D) Normalized histogram of deviation in pixel area over the first hour of movie from flies observed in the chambers with sloped (red) and vertical walls (black). Numbers on the x-axis represent the deviation from the median pixel area, where 1 is no deviation and 0.5 and 1.5 are + 50% deviation from the median pixel number. doi:10.1371/journal.pone.0008793.g004 n = 18 pairs of flies for each comparison; Fig. 5D). The classification of a fly's location between the wall and floor was made based on its x, y position. Flies equal to or less than 2 mm from the periphery of the chamber were considered to be residing on the wall. From these results, it is clear that the presence of a vertical wall introduces additional variability in the appearance of flies, increasing the frequency of error in basic measures such as body orientation and identity, and undoubtedly would lead to poorer classifications and detections of behavior observed among interacting flies.

Flies Spend Less Time in Periphery
To quantify and compare the amount of time flies loitered in various regions in the chambers and also to observe if sloped walls might increase the interaction between flies, we introduced pairs of virgin males and virgin females into 7.0-cm diameter chambers. We then monitored their courtship until the onset of copulation or for 20 minutes, whichever came first. Flies introduced into chambers with sloped walls spent less time near the walls than in chambers with vertical walls. This difference was apparent immediately and could be seen in the trajectories of individuals making up the male-female pairs (Fig. 6A-D). This difference was also apparent in the trajectories from individuals making up large groups ( Fig. S1A-C) and in the trajectories of single flies (Fig. S1E-J). We observed that flies moving near the extreme periphery of the chamber, less than or equal to 2 mm from the vertical wall, were nearly always walking on the wall. Moreover, flies moving toward vertical walls nearly always moved onto the walls and were also less often observed returning back to the chamber floor. This resulted in the flies spending the majority of their time on the wall (Fig. 6E).
The specifics of how and when the flies moved onto the wall contributed to the variability in their courtship. When females moved onto the wall first, males did not always immediately follow them, but instead sometimes spent a significant amount of time searching for the females on the chamber floor. Other times both flies moved up and onto the wall, and if this happened, usually the female would slow and stop. Once the female became stationary, typically the male would then find her, court quickly, and copulate. Alternatively, the male might move along the wall in the opposite direction and then spend a significant amount of time moving back and forth on the wall until he found her again. In several of the trials, the male would then not find the female within the observation period. In contrast, courtship was fairly uniform in chambers with sloped walls. Upon locating a potential mate, the male would court her without distraction from the geometry of the chamber until successful copulation (Movie S4). Consequently, courting pairs of flies in chambers with sloped walls were, on average, closer to each other as compared to flies in chambers with vertical walls (Fig. 6F; *Mann-Whitney U, p = 0.038, 1-tailed). However, mean + s.e.m. courtship latency, i.e., the time

Discussion
We have developed a general-purpose experimental chamber that can be used for studying the locomotor behavior of single flies, interactions between pairs of flies, and the complex social interaction of individual flies behaving within large groups. The new chamber design restricts the movement of flies to a planar arena and limits variability in their appearance, without inhibiting the behaviors they typically display within a laboratory setting. The new design does not require the use of a thermal barrier [13] nor a water moat [14]. More importantly, the new design does not require clipping off the flies' wings, a manipulation that consequently inhibits a significant mode of communication during courtship or bouts of aggression. We believe the new chamber design should be complementary to a variety of methodologies designed to analyze movies from an overhead viewing angle. Moreover, the design provides a simple alternative to the more complicated machine vision methodologies that are required if cameras can view flies from difference poses.
The height of the chamber must be within critical range, but within this range, height may be tailored to fit the needs of a particular study. We have tracked the movement of flies in chambers with heights ranging from 1.8 mm to 4.5 mm. The advantage of the shorter chambers was a decrease in the frequency of overlapping flies, thereby limiting the effort required for correcting tracking errors. The trade off was that the shorter chambers restricted the repertoire of behaviors displayed by flies. For example, low chamber heights inhibit copulation [16]. In prior studies, the range of chamber heights that have been used has varied from 3 mm to 6.35 mm for studies of courtship [16][17][18][19] and from 11 mm to 120 mm for studies of aggression [10,12,20,21]. We found chambers with a height of 3.5 mm allowed most, if not all, of the behaviors carried out between flies. (See supplementary movies illustrating various courtship and aggressive behaviors recorded from the new chamber design that may be automatically monitored with current machine vision methodologies: Movies S7-S24.) The 3.5-mm height of the chambers used within this report was optimized for Drosophila melanogaster, but may be easily adjusted for studying smaller and larger species of fruit flies, or even other insects.
The slope of the chamber wall was more critical than its height, but might also be adjusted. Specifically, chamber walls made more shallow than the 11 0 slope used here should further decrease the distance between flies. However, chambers developed with more shallow slopes will also restrict the useable space near the periphery of the chamber. It is worth noting that chambers designed with linear-sloped walls worked as well as the sigmoidlinear sloped walls described here (Fig. S2). Finally, we have tested chambers possessing diameters ranging from 30 mm to 300 mm. There does not seem to be an upper bound on the diameter of the chamber; eventually the size of the chamber will be bounded by the resolution of the camera system used.
The rapidly increasing development of new molecular tools for dissecting the genes and neural circuits regulating the behaviors of these flies has led to a recent surge in the machine vision tools that automatically monitor their complex behavioral phenotypes [8][9][10][11][12][13]. To make progress on the difficult task of automatically quantifying the complex social behavior of these flies, the developers of these new methodologies have focused on tracking, classifying, and quantifying behaviors. Next-generation methodologies that build upon these strategies will bundle together the key components of these methodological advances to provide a powerful tool for quantitative descriptions of the phenotypes of this genetic model organism. By restricting the movements of flies to a planar arena, limiting their profiles to a single viewing pose, and keeping flies from clustering in the periphery of the arena, we believe that the chamber design we have described within this report will make the task of automatically quantifying the complex behavior of flies significantly easier.

Animal Rearing, Housing, and Handling
We performed experiments on 4-to 6-day-old adult fruit flies, Drosophila melanogaster (Meigen), from two laboratory colonies. The first colony descended from a wild-caught population of 200 isofemales and has been used in our laboratory for approximately 15 years. The second colony was from a laboratory stock of Canton-S (CS) from the laboratory of Martin Heisenberg. We used flies from the CS colony for the observations of courtship and aggression and used the natural isolate for all other observations. We maintained fly stocks at 25 0 C and at 40% relative humidity on Lewis food medium in standard 250 mL bottles [22], on a 16 h: 8 h light-dark photoperiod. The light-on phase started at 7AM PST. Transitions between light and dark were immediate. Replicate observations were run at the same time each day over several days, and we ran trials during either the morning or evening activity peak. We collected flies from culture bottles and housed them at a density of 50 flies per vial overnight in standard 10 mL Drosophila vials on food, and observed their behavior the next day. For the observation of individuals from a group of 50 flies, the morning of the day that we were to monitor their behavior, we housed 25 male and 25 female together in standard 10 mL Drosophila vials containing only agar in order to deprive them of food, but not water, for 7 hours prior to their observation. For our observations of courting and fighting pairs, we collected virgins ,7 hours post-eclosion. We isolated males individually and housed 15 females collectively in vials containing food for 4 * 5 days before monitoring their behavior. Each day we wiped down chambers with ethanol and allowed chambers to dry for § 15 min. To help with counting and sorting, we immobilized flies by cooling them to 4 0 C on a Peltier stage (Marlow Industries, Inc., Dallas, Texas, USA). We used a mouth pipette to introduce flies into chambers.

Chamber Design with Sloped Walls
The key feature of the new experimental chamber design is that its walls are not vertical with square corners, as has been typical in past studies, but they were gently sloped (Fig. 7). The gently sloping walls intersected with the ceiling forming an acute interior angle that effectively deterred flies from moving onto the ceiling. Occasionally flies did move onto the ceiling, mostly as a result of jumps and flights. We have found that a ceiling made from glass coated with Sigmacote (Sigma-Aldrich), a silicone paint, provided a clear, but slippery surface that flies had difficultly clinging to. In chambers with a coated ceiling, most flies that did move onto the ceiling slipped off and fell back to floor. We have determined that a gradual slope with an angle of 11 0 , as measured from the horizontal floor, worked well in chambers with a 3.5 mm high ceiling for studying many behaviors (Fig. 7B). To remove the obtuse edge between the floor and the base of the walls, we designed the walls to have a smooth profile. The cross-sectional profile of the walls was made up of two segments, the first half a sigmoid and the second a straight line (Fig. 7C). The piecewise continuous function that specifes the height of the wall as a function of horizontal distance, x, is: where h is the full height of the chamber; h is the angle of slope; I is the distance from the end of where the floor was horizontal to where the sigmoid and the straight segments join, at i, and is halfway up the height of the chamber: and X max is the width of the slope from its base at the floor to where it meets the ceiling of the chamber: The design of the sloped walls removed the discontinuity between the floor and walls, and also eliminated the unused space that was too shallow for flies to enter if the profile of the wall followed the sigmoid Drawing from the side of the experimental chambers, highlighting the sloped wall of the new chamber design (red box) possessing a severely acute interior angle that prevents flies from moving up the wall and onto the ceiling. The ceiling of the chambers was made of glass coated with silicone paint to limit the frequency and duration flies could cling to its surface. (B) Photograph from a cross section wedge of the chamber showing that the height of the chambers provided sufficient room for flies to carry out their normal range of locomotor behaviors. (C) Technical drawing for the profile of the slope that is described within the text. The red line depicts the slope, the blue line represents the profile of the sigmoid curve near the ceiling that was not used in making the slope, and the dashed line denotes the line tangent to the sigmoid that was matched to linear segment of the slope. (D) Drawing from the side illustrating the experimental setup. Chambers were illuminated with standard fluorescent lights projecting through a screen and a cylinder with a lid made of translucent paper. The behavior of the flies was recorded with a camera mounted above the chambers. Chambers were mounted on an aluminum base to help prevent warping and to hold the chamber above lights used for backlighting. doi:10.1371/journal.pone.0008793.g007 to the ceiling. To keep a constant thickness for ideal backlighting, we removed material from the underside of the chamber (Fig. 7A, D). The shape of this undercut followed the curvature of the chamber floor. For the chambers discussed within this study, we machined floors to have a constant thickness of 5 mm. We observed the movement of groups and single flies within 12.7-cm diameter chambers. For the observations of courtship and aggression, we used chambers with a 7.0 cm diameter. Holes providing access to food and water were machined into the floors of chambers and used as needed (Fig. S3). To compare the behavior of flies in chambers with sloped walls to conventional chambers, we machined ''control'' chambers of comparable height and with comparable diameters that had vertical walls. We manufactured chambers from opaque, white Delrin (McMaster-Carr), which is easily machined, has good chemical resistance, and diffuses light, making it ideal for backlighting. We mounted chambers on base plates made from thick aluminum to insure that the chambers maintained their shape.

Experimental Setup
To provide a visual stimulus, we surrounded the chamber described above with a paper cylinder (Fig. 7D). This paper was printed with a random checkerboard pattern with 50% black squares and 50% white squares. We capped the cylinder with an annulus cut from plain white paper so the camera lens could peer through. The cylinder and lid were backlit by an array of fluorescent lights (GE helical 26W 120 VAC 60 Hz 370 mA) and standard fluorescent room lights with a 120 Hz flicker, both shining through a projection screen (Gerriets International OPERA creamy white). The result was diffuse light creating a luminance of 75 lux at the center of the chamber. We used the visual stimulus only for observing the groups of 50 flies. Without the visual stimulus, the luminance was 500 lux. We used a 12612-inch array of 850 nm LEDs (12612 850 nm IR lighting unit, Illumination Control, Inc., Quincy, MA) mounted underneath the chambers for backlighting. We recorded the movements of the flies with a camera mounted from above [15]. The movements of the group of 50 flies were recorded at 20 frames per second (fps) using a 128061024-pixel firewire camera (Basler A622f), equipped with an 8 mm lens (Pentax). The single flies were recorded at 15 fps using a 128061024-pixel firewire camera (PointGray IEEE-1394), equipped with a 12 mm lens (Pentax). An infrared pass filter was placed in front of the camera to block stray light. For observing pairs of courting and aggressive flies, we used a (Sony DCR-HC38) camcorder and recorded the behavior at 30 fps as was done previously [12]. In these recordings, we backlit the chamber with visible light (Cold-cathode fluorescent backlight J58-332 8612, Edmund Optics, Barrington, NJ).

Machine Vision Methodologies
For the analysis of the behavior of individuals from groups of flies, we used Ctrx [13], a general-purpose system designed for tracking the individual positions and orientations of a large number of flies simultaneously. This system can be adapted to different laboratory setups and comes with software for detecting a suite of typical behavior exhibited by flies. For tracking and measuring the changes in the appearance of single flies over long durations, we used additional software developed in our laboratory. Flytrax [15] records a spatially cropped image that includes only a small region surrounding a single fly, its x,y position, and orientation from each frame. With this software, we reconstructed a high spatial and temporal representation of a fly's locomotor movement that cross-indexed each frame to its original movie. From the cropped images, we extracted the measures of the fly's appearance with custom code written in Matlab (Mathworks, Natick, MA). For monitoring and analyzing the interactions between male-female pairs, we used measurements of x, y locations, change in position, and body heading using the CADABRA system [12].

Data and Statistical Analysis
All output measurements from the various machine vision methodologies were analyzed with custom software in Matlab. Statistical analyses were carried out using SPSS (SPSS, Inc., Chicago, IL).

Supplementary Movies
We have included short digital movies of typical behaviors displayed by males during courtship and aggression that we believe could readily be classified from a single, top down viewing angle (Movies S7, S8, S9, S10, S11, S12, S13, S14, S15, S16, S17, S18, S19, S20, S21, S22, S23, and S24). All of these movies were recorded at 30 fps from chambers designed with sloped walls. The examples of aggression come from five 30-minute movies recording the behaviors displayed by pairs of males around a patch of food, as in [12]. The height of the ceiling for these chambers was 3.5 mm and the diameter was 7.0 cm. Frame numbers (red) are shown for all movies and can be used to determine if and when the movie was slowed down or sped up by a factor of 4, a step we took to help illustrate the behaviors. Movie S1 Annotated 2-minute movie clip emphasizing the encounters made by a focal male as it moves within a group of 50 flies. The first 10 seconds of the movie show 50 un-annotated flies moving throughout the new chamber described within the body of the manuscript. The next 20 seconds show the classified identities for the same 50 flies. The following 10 seconds show the flies classified by gender (males in blue; females in red). At 40 seconds into the movie the identity and movement of the focal male is highlighted (green) within the full field image and the corresponding enlarged, spatially cropped image (center). Soon thereafter, the first fly of five encounters is highlighted (top). The movie then continues emphasizing each encounter by slowing down and highlighting the encounters within the enlarged images (clockwise from top to bottom); the encounters are color-coded within the full-field and enlarged images (with females in magenta; with males in cyan). Movie S6 Two-minute movie showing the typically more erratic behavior of a male courting a female leading to the onset of copulation within the conventional chamber with vertical walls described in the body of the manuscript.