<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>High-resolution, high-throughput analysis of &lt;i&gt;Drosophila&lt;/i&gt; geotactic behavior</title></titleStmt>
			<publicationStmt>
				<publisher>The Company of Biologists</publisher>
				<date>02/15/2025</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10592642</idno>
					<idno type="doi">10.1242/jeb.248029</idno>
					<title level='j'>Journal of Experimental Biology</title>
<idno>0022-0949</idno>
<biblScope unit="volume">228</biblScope>
<biblScope unit="issue">4</biblScope>					

					<author>Tijana Canic</author><author>Juan Lopez</author><author>Natalie Ortiz-Vega</author><author>R Grace Zhai</author><author>Sheyum Syed</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[<title>ABSTRACT</title> <p>Drosophila’s innate response to gravity, geotaxis, has been used to assess the impact of aging and disease on motor performance. Despite its rich history, fly geotaxis continues to be largely measured manually and assessed through simplistic metrics, limiting analytic insights into the behavior. Here, we have constructed a fully programmable apparatus and developed a multi-object tracking software capable of following sub-second movements of individual flies, thus allowing quantitative analysis of geotaxis. The apparatus monitors 10 fly cohorts simultaneously, with each cohort consisting of up to 7 flies. The software tracks single flies during the entire run with ∼97% accuracy, yielding detailed climbing curve, speed and movement direction with 1/30s resolution. Our tracking permits the construction of multi-variable metrics and the detection of transitory movement phenotypes, such as slips and falls. The platform is therefore poised to advance Drosophila geotaxis assay into a comprehensive assessment of locomotor behavior.</p>]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>INTRODUCTION</head><p>Earth's gravity regulates the shape and size of organisms during development and continues to affect their function throughout life <ref type="bibr">(Narayanan, 2023;</ref><ref type="bibr">Takahashi et al., 2021)</ref>. Animals use gravity primarily for navigation and orientation, allowing them to locate food and suitable habitat. When startled, the fruit fly Drosophila melanogaster displays a natural tendency to move against gravity, resembling an escape response. Flies sense and orient themselves against gravity primarily through Johnston's organ in the antenna along with other sensory structures <ref type="bibr">(Armstrong et al., 2006;</ref><ref type="bibr">Bender and Frye, 2009;</ref><ref type="bibr">Kamikouchi et al., 2009;</ref><ref type="bibr">Kladt and Reiser, 2023 preprint)</ref>. This innate movement against gravity is called negative geotaxis and is elicited in the laboratory typically by tapping flies to the bottom of a vial and monitoring their subsequent vertical climb. The climbing assay dates back over 60 years and has been coupled with sophisticated genetic tools available in Drosophila to elucidate aging and general decline of motor output in disease states <ref type="bibr">(Hirsch and Erlenmeyer-Kimling, 1961;</ref><ref type="bibr">Zhu et al., 2022)</ref>.</p><p>Despite their widespread utility, current platforms for geotactic experiments have several limitations that can be broadly divided into those related to hardware for initiating movements and those related to software for tracking. Traditionally, the climbing behavior is visually monitored or video recorded and the number of flies reaching a certain height at the end of &#8764;10 s is the measure of their negative geotaxis. Though this approach provides a simple and rapid measure of geotactic response sufficient for detecting gross differences between groups, manual tapping of vials introduces inconsistencies into experiments. To reduce variability, specially designed rigs with automated and uniform force delivery have been demonstrated <ref type="bibr">(Cao et al., 2017;</ref><ref type="bibr">Gargano et al., 2005;</ref><ref type="bibr">Podratz et al., 2013;</ref><ref type="bibr">Spierer et al., 2021)</ref>. Data from these experiments are either scored manually or quantified using computer programs. Although more reliable than manual scoring, computer programs employed to track geotactic activity generally report population or experimentwide average metrics such as speed and final percentage of successful climbers <ref type="bibr">(Kohlhoff et al., 2011;</ref><ref type="bibr">Podratz et al., 2013;</ref><ref type="bibr">Spierer et al., 2021)</ref>. While such analysis can be valuable, it overlooks individual behavioral attributes that can offer critical insights into understanding geotaxis.</p><p>Here, we present a new platform for measuring and interpreting Drosophila geotaxis at a single-fly, sub-second resolution, addressing most issues with currently available methods. The platform combines the strengths of a fully automated apparatus with a powerful computer vision tracking algorithm, enabling generation of data that are reproducible within the natural variations in fly behavior, while tracking provides detailed locomotor trajectories of single flies with &#8764;97% accuracy and a 1/30 s temporal resolution. We leverage the high-resolution tracking data to go beyond population-averaged quantities and construct multivariable analytics gleaned from individual flies and video frames to help explain geotactic behavioral differences seen in several wildtype laboratory strains.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>MATERIALS AND METHODS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Drosophila husbandry</head><p>We utilized three laboratory strains in these studies: white (w 1118 ), Canton-S (CS) and yellow, white ( yw). Virgin females were separated and maintained at 25&#176;C on standard lab food on a 12 h:12 h light:dark (LD) cycle for 5 or 6 days. The flies were then briefly anesthetized with CO 2 and loaded into experimental vials. Experiments were conducted after flies acclimated for an hour at 25&#176;C and 75% relative humidity.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Hardware and video recording</head><p>We used a custom-designed acrylic vial mount that holds 10 plastic vials (Uline, Pleasant Prairie, WI, USA; model S-21972) and has an opaque plastic backing connected to a plastic rod. A metal lever, connected to a programmable stepper motor <ref type="bibr">(Trinamic, model PD86-3-12978)</ref>, lifts the mounted vials &#8764;6.5 cm by pushing up on the acrylic rod during half a rotation then lets the vials fall for the second half. A mechanical sensor (Omron Electronics Inc.-EMC Div, model SS-10GL2T) at the bottom of the lever rotation sets the start and stop positions of the motor. By default, the vials are vertically moved 4 times in 3 s, but this setting can be changed by reprogramming the motor. Each vial is normally loaded with up to 7 flies, which we found allows for high throughput as well as accurate tracking. We have tested up to 10 flies per vial with acceptable accuracy but found that in general having more than 7 flies decreases individual tracking accuracy.</p><p>White light-emitting diodes (LEDs, JOYLIT model A2835-240-60K-V24-NWP) are mounted to a metal plate 4.5 cm behind the mounted vials. Two sheets of diffuser (Rosco model R3000) are placed over the LEDs. A digital camera (ImagingSource LLC, model DMK23U445) is placed on a separate table 38 cm from the center of the opaque plastic backing. The camera is adjusted using the focus knobs until the edges of the mounted vials are at the edge of the frame. Both the camera and the motor are connected to the computer via MATLAB packages (Computer Vision, Image Acquisition, Image Processing, Instrument Control and Statistics and Machine Learning Toolboxes; third-party Instrument Control Toolbox Support Package for Keysight IO Libraries and VISA Interface).</p><p>The user initiates an experiment from the MATLAB command line by specifying the number of successive videos/trials (default, 10), duration of each video (13 s), rate of video capture (30 Hz), wait time between videos (15 s) and video names ('exp1_'). The default values used in our experiments are included in parentheses.</p><p>Once a new experiment is started, the computer engages the motor, waits 3 s for the fly vials to come to a complete stop, then begins recording the first video. Once complete, the program saves the video as an '.mp4' with the appended video number, then waits the specified time to start the next trial.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Video processing</head><p>Processing of the video recordings starts with defining the rectangular regions of interest (ROI) around the vials for each individual video. The ROI is saved in the working folder and can be utilized for recursive video processing. The saved videos are subsequently pushed through a sequence of steps that utilize the calibration data to localize, label and track each fly over time (Movie 3). Finally, the tracked fly coordinate data are used for assessing geotaxis through several analytic outputs. This pipeline of simultaneously measuring multiple groups and interpreting each group video separately offers flexibility for meta and comparative studies across trials, number of flies, treatments and genotypes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Calibration</head><p>The calibration step is recommended whenever a fly of significantly different size or morphology is first used, a new camera is introduced or the platform-camera distance is altered. The calibration program (Fig. <ref type="figure">S2B</ref>) presents a video frame in which boxes have been drawn around individual 'objects' and asks user to classify each object as 'Is one fly', 'Multiple flies' (two or more flies together) or 'Not one fly' (noise). The program saves two pieces of information for every classified object: pixel area and major/minor axis lengths (Fig. <ref type="figure">S2B</ref>, enlarged panel). Axis lengths are defined as the shortest and longest lines, respectively, that can be drawn from one side of an object to another. The area characterizes the size of the objects that the tracking function will look for while the axis lengths together characterize the shape of the objects. For every video recording loaded, the program automatically presents to the user every 15th frame for assessment. The calibration table helps discriminate against objects with shape or size outside the bounds of those expected for fly strains in use. Because it informs the program about the general physical characteristics of the objects of interest, calibration also adds to the versatility of our algorithm. Simply by creating a new set of calibration data, a user can examine insect strains of drastically different characteristics or under different apparatus set ups.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Manual accuracy assessment</head><p>The tracked ROI videos and the associated coordinate matrices are used to check whether the same fly is associated with the correct track number over time. For every 15th frame, each fly is manually assessed as correct if the fly is within the appropriate bounding box. If correct, the button 'correct' is clicked and will add the instance to a tally. If incorrect, the button 'incorrect' is clicked and the program waits for the mouse click with the accurate fly location from which the Euclidean distance to the saved track is calculated and reported in a spreadsheet file.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Calculation of metrics</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Climbing curves</head><p>Climbing curves are constructed for a population by noting the time of the first instance each fly crosses a given height (e.g. 10 cm above vial bottom). The cumulative sum of these data generates step-like patterns with a step size of 1 when counting individuals in a single trial (e.g. Fig. <ref type="figure">3C</ref>, left) or a step size of 1/N trials when counting average number of individuals from N trials (e.g. Fig. <ref type="figure">3C</ref>, right). A fly that has crossed above a target height (maximum target=14 cm from vial bottom) is counted as having climbed to the height even if the fly displays positive geotaxis later on and goes below the target.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Speed and angle</head><p>We calculate the Euclidean distance moved by a fly between frames i and i+1 according to:</p><p>where (x i , y i ) and (x i+1 , y i+1 ) are the position coordinates in the two corresponding frames. The related speed s i is defined as &#916;r i /&#916;t, where, throughout this work &#916;t=1/30 s. &#916;r i &#8805;4 mm are excluded, as they are considered abnormally large frame-frame locomotion. This cut-off in frame-frame displacement values prevents artifactual jumps in position, slips, falls and occasional flight within the vial from being considered in the speed-angle analysis. It is because of this constraint that our fly speed data have an upper limit of &#8764;100 mm s -1 . The movement direction between frames i and i+1 is calculated according to:</p><p>Taking the absolute value of &#916;x makes a rightward movement indistinguishable from a leftward movement, keeping the focus on whether a movement is in the +y or -y direction. &#952; i is undefined if a fly is stationary between two video frames; that is, if &#916;r i =0 between frames i and i+1. By counting the number of non-zero angular changes &#916;&#952;&#8800;0, the &#952; i can also yield a trajectory turning rate for a cohort. For example, we find that a w 1118 fly makes &#8764;24 turns s -1 , a CS fly makes &#8764;22 turns s -1 and a yw fly makes &#8764;20 turns s -1 . It is important to note, however, that the turning rate calculated this way relates to changes in the track direction and not necessarily the heading direction. Finally, the average speed and angle are calculated from the frame-frame s i and &#952; i , respectively. The average metrics also readily lend themselves to other quantities as well. For instance, the average speed multiplied by the duration of video gives the distance traveled while the average angle provides a rough snapshot of a cohort's net travel direction.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Bootstrapping speed-angle correlations</head><p>To estimate the mean and standard error of correlations between instantaneous speed and movement angle, we followed the basic bootstrapping procedure of randomly sampling with replacement speed-angle pairs. Each sample size, N sample , was set equal to the size of the data. For instance, N sample =41,330 for CS flies. Speedangle pairs within each random sample set were separated in terms of &#952;&lt;0 and &#952;&gt;0 and the corresponding Spearman correlation coefficients &#961; -and &#961; + and their ratio &#961; + /&#961; -were calculated. This procedure was repeated 1000 times, yielding a bootstrapped probability distribution of &#961; + /&#961; -, as shown in Fig. <ref type="figure">4C</ref> (right). The distribution mean and standard deviation are the ratio mean and error.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Extraction of analytics</head><p>Detailed guidelines on analysis of tracked videos are provided with the code library at <ref type="url">https://github.com/sheyums/Insect-Geotaxis</ref>.</p><p>Some basic familiarity with the Matlab command line is required. Briefly, the function 'Geotaxis_analytics' uses fly location results from tracking to calculate the metrics discussed above. The output of Geotaxis_analytics is a structure with one field -Groupitself a structure containing user-provided names and all associated data of input datasets. For example, from the analysis of four groups of data, the user can access the name and the climbing data of the 3rd group by typing 'output.Group(3).Names' and 'output.Groups(3).ClimbCurves', respectively, at the command line. Entering 'output.Group(1).Fly_no(2).AveSpeed' will return the average speed of the 2nd fly in the 1st group. Other results, for example the paired frame-frame speed and angular movement data of fly#19 in the 4th group, can be accessed by typing 'output.Group(4).Fly_no( <ref type="formula">19</ref>).SpdAngle'. For additional quantification, such as determination of the number of turns made by fly#19 in group#4, the indexing feature in Matlab can again be utilized to calculate the number of non-zero angle changes between successive frames.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>RESULTS</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Mechanical design</head><p>To reduce commonly found systematic errors in manual assessment of fly geotaxis, we built an apparatus (Fig. <ref type="figure">1A</ref>) that delivers a fixed number of taps of identical force over the same duration across experiments. The core of the apparatus consists of a custom-designed acrylic vial mount (VM) that holds up to 10 plastic vials with slots on the side that allow it to slide vertically along metal guides (VM guides). When the motor is activated, a metal lever connected to it contacts the VM post, lifting the VM for the first half of the lever's rotation and allowing the VM to fall during the second half. A mechanical sensor (Fig. <ref type="figure">1A</ref>, bottom panel) detects lever motion and provides an appropriate signal to initiate or terminate motor control. Normally, the VM is vertically moved 4 times in 3 s, ensuring all flies are at the bottom of their respective vials before video recording starts. A panel of LEDs provides diffuse illumination from behind the VM.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Video recording and image processing</head><p>A CCD camera acquires grayscale images at a rate of 30 Hz once the vial mount comes to rest. A 10 s recording (Movie 1) constitutes one trial. The process of mechanical fly perturbation and subsequent movement recording is usually repeated 10 times per experiment (Fig. <ref type="figure">1B</ref>). Each video is cropped by ROI and saved as separate videos (Fig. <ref type="figure">1B</ref>; Movie 2). A subset of ROI videos can be used for calibration, where the user manually classifies detections into categories of single and multiple flies in different orientations and distances from the camera. The calibration step is critical as it yields shape and size distributions of flies as imaged by the CCD and helps the tracking algorithm (see Materials and Methods) reject any nonfly objects captured.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Tracking summary</head><p>Tracking individual flies (Movie 3) over time is the most challenging task for our method and we delve into its details over the next three figures. In brief, the first step in our tracking is the creation of a background frame (Fig. <ref type="figure">1C</ref>). Objects are found by thresholding background-subtracted individual frames. Among detected objects, only those falling within shape and size distributions from calibration data are accepted as flies. A series of specialized algorithms next predicts the flies' locations and assigns each a track. These steps of prediction and updated assignment are repeated for each CCD frame and the position information is saved in a matrix.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Tracking errors</head><p>The relatively unconstrained movement of flies produces four major types of tracking errors (Fig. <ref type="figure">S1</ref>) which the algorithm must rectify to achieve high accuracy.</p><p>(1) Occlusion by another fly or temporary immobility can cause a fly to become invisible to tracking only to reappear frames later (Fig. <ref type="figure">S1A</ref>). This 'lost and found error' is addressed by updating the unassigned track with the last known coordinates and utilizing the assignment algorithm to reconnect the correct fly with its existing track once it reappears. (2) Two or more flies can appear as a single detected object by virtue of proximity. In this type of 'grouping error' (Fig. <ref type="figure">S1B</ref>), the enlarged size of the detected object combined with the multiple fly characteristics from calibration would be used to create overlapping tracks from a single detection.</p><p>(3) Overlap of multiple flies can also lead to switching of individual assignments (Movie 3). To estimate the frequency of this error, we analyzed 79,800 video frames each with 7 flies and detected 2762 instances of fly collisions (3.5% or &#8764;7 overlaps per 200 frames). But as swapping of labels in a collision is a random event, we assume about half of collisions lead to identity switching.</p><p>In other words, we incur an identity switch in &lt;2% of video frames (&lt;6 switches per 300 frame video). Importantly, identity switch does not cause loss of single-fly resolution. Because our analyses rely on anonymized single-fly data, the less than 0.6% error (&lt;12 incorrect values within a 7&#215;300 location matrix) contributed by these events is negligible in the inherently heterogeneous behavioral metrics we compute. (4) Another source of assignment-related error is aberrant movementstationarity and unexpected movement direction. For instance, two flies that are separate from each other can erroneously exchange their assignments (Fig. <ref type="figure">S1C</ref>), or preference is incorrectly given to an aberration in illumination instead of a fly, if the aberrant object is more mobile than the fly (Fig. <ref type="figure">S1D</ref>). However, the large unphysical jumps in positions can be used to correct both types of error.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Background subtraction and detection calibration</head><p>Detection of flies in each image frame can be broadly divided into three steps (Fig. <ref type="figure">2A</ref>): (a) background subtraction, (b) applying size and shape discrimination to identify true flies among detected objects, and (c) determining whether one or more flies comprise each detection. A background frame is generated for each vial by calculating the median pixel value from all frames. Each frame is subtracted from the background and thresholded by setting pixel values &#8804;0.06 to 0 and the rest to 1 (Fig. <ref type="figure">S2A</ref>). Because several flies are moving in three dimensions through an imperfectly illuminated space, the detections after background subtraction can include single and multiple flies and noise objects such as shadows and streaks. To correctly account for all flies, the user can opt to go through calibration (see Materials and Methods). Fig. <ref type="figure">2B</ref>,C shows calibration data for a set of several commonly used wildtype strains (w 1118 , CS, yw) as examples. Objects with areas larger than the maximum of the multi-fly areas and smaller than the lowest 16% of single-fly areas are classified as noise in our algorithm (Fig. <ref type="figure">2B</ref>, shaded regions). There is some overlap between the single-and multi-fly area distributions and to remove ambiguity we define the maximum single-fly area to be the threshold for multiple flies (Fig. <ref type="figure">2B</ref>, dashed vertical line). Therefore, objects are accepted as multiple fly detections if their areas are larger than this threshold and smaller than the maximum multi-fly area. We arrived at these cut-offs through trial and error aimed at maximizing fly identification accuracy. However, the extreme cut-offs alone do not eliminate all false positives as the left tail end of the single-fly distribution can still have some overlap with noise. Shape information, specifically the ratio of minimum and maximum axis lengths, is used to eliminate remaining incorrect detections (Fig. <ref type="figure">2C</ref>). Objects with axis-length ratios not corresponding to single or multi-fly objects (Fig. <ref type="figure">2C</ref>, shaded regions) are marked as noise detections and removed from further analysis.</p><p>The detections that remain after size-and shape-based discrimination are highly likely to be only flies. To account for the total number of flies, we determine the number of individual flies in the multi-fly classifications by dividing each multi-fly area by the maximum single-fly area found in calibration then rounding to the bigger whole number. Individuals found in a multi-fly object are given a common set of coordinates and appended to the list of detections. Though these steps do not guarantee every fly in the frame is detected, they do ensure that every detection is an individual fly.</p><p>As our goal is not limited to detecting flies but also involves following them over time, the algorithm next associates the detected fly locations in one frame with fly locations from the previous frame. The association is done by assigning each detection to the most likely track, through a scheme called the Hungarian matching algorithm <ref type="bibr">(Munkres, 1957)</ref>. In our method, we complete the detection-to-track matching in three steps (Fig. <ref type="figure">2D</ref>). The first task is constructing the cost matrix (Fig. <ref type="figure">S3</ref>) whose columns represent locations in the current frame (Detections) and whose rows represent locations from the previous frame (Tracks). For each element of the cost matrix, the Euclidean distance between a current detection and its predicted location is calculated, d pred . For predictions, we use the constant velocity Kalman filter. The filter first makes an initial guess about the future location of a fly using default inputs and updates the guess after comparing it with the final assigned location. However, we found that a cost matrix relying only on Kalman filter predictions is unreliable for our experiments because of idiosyncrasies in fly movement. We therefore define matrix elements as:</p><p>where d prev is the Euclidean distance between current and previous detection coordinates. As detection relies on motion, stationary individuals could be lost, or it may take several frames to recognize a fly. The solution for either is the creation of 'phantom' tracks and detections within the cost matrix to allow for lost or new flies (Fig. <ref type="figure">S3</ref>, tracks 1 and 3).</p><p>In creating phantom tracks, the cost matrix is padded with an experimentally determined value called the cost of non-assignment (CON). The CON is a threshold value that determines whether assigning a detection to a track is too costly. If the CON is too low, it will not assign detections to tracks, resulting in missing coordinates or 'lost and found errors' and if the CON is too high, it will assign detections to the wrong tracks, resulting in swap and jump errors. To visualize the effect of the CON, we recorded the number of missing coordinates and the number of abnormally large jumps in coordinates recorded, as we ran the tracking algorithm on a set of 50 videos at 17 different CON settings (Fig. <ref type="figure">2E</ref>). As expected, increasing CON minimizes the number of missing coordinates but increases bias towards detection of large location jumps. The optimal CON produces a minimum in their average. As large jumps included in this estimation do not distinguish between actual falls and erroneous jumps in location, we calculated a weighted average by assigning the missing coordinates error twice the weight of the large jumps error. The weighted error gave us a narrow range of &#8764;6-13 to optimize the CON (Fig. <ref type="figure">2E</ref>). Using a set of 50 videos tracked at 7 different CON, we manually assessed errors within each individual track (Fig. <ref type="figure">2F</ref>). An entire track was considered incorrect if any significant error was found, regardless of how accurate the rest of the track was. For ease of comparison across groups, we normalized the error to the number of total tracks assessed. These studies found a clear minimum for CON=11, which we used as the default in our tracking algorithm.</p><p>If the number of tracks in a frame is found to exceed the number of flies after completion of the detection-track assignments, we recheck the distance between the detected coordinates and the previous coordinates of the unassigned tracks and remove the detection with the maximum distance. Though this accounting method is somewhat arbitrary, extra tracks are rare and do not lead to major information loss. If the number of tracks is less than the known number of flies, nothing is done as some flies remain stationary. At the end of the tracking, a random coordinate at the bottom of the vial is selected and appended to the final coordinate matrix to account for the missing fly.</p><p>To gauge the overall accuracy of our algorithm, two individuals separately evaluated tracking results of each fly in a set of 50 videos. If a tracking result was deemed inaccurate, the individual clicked on the actual fly coordinate and the distance between the actual location and the tracked location was recorded. These assessments showed that our algorithm correctly tracks flies &#8764;97% of the time (Fig. <ref type="figure">2G</ref>, inset) with a positional error of &lt;9.7 pixels&#8776;2 mm (Fig. <ref type="figure">2G</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Introduction of new metrics</head><p>Traditionally, geotaxis experiments report the percentage of flies that successfully pass a threshold height after a specified time. In an experiment with w 1118 flies, simple counting at t=10 s shows that in 70% of trials, six or more flies are past the 7 cm mark, half of the full vial height (Fig. <ref type="figure">3A</ref>). Our detailed tracking provides a more comprehensive picture of the events that led up to the end of one trial (Fig. <ref type="figure">3B-F</ref>). Select video frames from one trial shows fly #1 ( purple trajectory) reaching the top by t=8 s but falling to &#8764;2/3 of the vial height thereafter, while fly #6 (cyan trajectory) reaches &lt;1/3 of the vial height by the end (Fig. <ref type="figure">3B</ref>). Manual analysis would incorrectly exclude fly #1 from having displayed robust negative geotaxis before falling. Our method avoids such errors by monitoring fly positions throughout the experiment. We can construct a climbing curve for each trial with discrete steps representing the passage of single flies for a height of 7 cm (Fig. <ref type="figure">3C</ref>, <ref type="figure">left</ref>). These data show that 100% of trials ended with 6 or 7 flies successfully passing the 7 cm height threshold, in notable contrast to traditional assessment (Fig. <ref type="figure">3A</ref>). This discrepancy underscores a critical shortcoming of assessing climbing from the final video frame. Without knowledge of entire trajectories, recorded behavior is susceptible to brief events such as falls that can introduce significant errors. Our results show that detailed automatic tracking not only is convenient but also leads to more accurate assessment of climbing behavior.</p><p>The single-fly resolution of the staircase data also highlights individual variability generally disregarded in existing analysis methods. Although all trials ended with similar fly numbers (6 or 7) above threshold, each took a distinct path largely owing to behavioral variability in individuals. To assess the degree of variability, we averaged staircase data for three different heights across 10 trials (Fig. <ref type="figure">3C</ref>, <ref type="figure">right</ref>). We found that the mean variation is 13%, 18% and 28% for climbing to 1/3, 2/3 and the full 14 cm height, respectively. The between-trial variability increases with height because fewer flies climb to greater heights. To assess whether there are any general trends in performance, such as degradation in climbing ability due to fatigue <ref type="bibr">(Bazzell et al., 2013;</ref><ref type="bibr">Damschroder et al., 2018)</ref>, we next examined the average speed and angular direction of the group in each trial (Fig. <ref type="figure">3D</ref>). These data, which include movements in all directions, show no particular trend from the first to the last trial, indicating that fly movement kinetics do not change dramatically over the course of an experiment. We measured the angle of movement &#952; relative to the horizontal direction (&#177;x) where &#952; is considered positive if it is in the upper quadrants and negative if it is in the lower quadrants (Fig. <ref type="figure">3E</ref>, <ref type="figure">top)</ref>.</p><p>While useful for learning about overall trends in geotactic kinetics, population averages can mask short time-scale dynamics and the relationship between speed and angle between consecutive frames (Fig. <ref type="figure">3E</ref>). For the experiments on w 1118 flies, we found &#8764;89% of events have &#952;&gt;0 (Fig. <ref type="figure">3E</ref>, top histogram, orange) with an associated speed of 21.9&#177;12.7 mm s -1 (mean&#177;s.d.). For the remaining &#8764;11% of movements with &#952;&lt;0, the associated speed distribution has a smaller average and a larger variance, 19.2 &#177;17.8 mm s -1 (Fig. <ref type="figure">3E</ref>, right histogram). Though they yield similar mean values, speed histograms in the two directions assume different shapesa peaked distribution for &#952;&gt;0 and a relatively even distribution for &#952;&lt;0. Differences in distribution shapes suggest the possibility of differences in how movement speed and angle are correlated, with the narrower distribution in the +y direction implying a bias towards negative geotaxis, consistent with the strong climbing behavior displayed by these flies (Fig. <ref type="figure">3C</ref>). Calculation of the Spearman correlation further supports the idea of a directional bias, with a correlation coefficient of &#961; + =0.145 (P&lt;10 -60 ) in the +y direction and a correlation coefficient of &#961; -=0.039 (P=0.09) in the -y direction. Robustness of negative geotaxis can depend on such directional bias in movement, and these analyses indicate we can use the ratio &#961; + /&#961; -as a new metric to assess the behavior.</p><p>Close examination of videos revealed that flies can occasionally lose traction and consequently slip or fall ('drop') during climbing. How often and how far they drop can impact their geotactic performance. To better characterize these disruptions in climbing, we defined a vertical drop -&#916;y between two consecutive frames of more than a body length and up to three body lengths (4.5 mm&#8804;-&#916;y&#8804;12 mm) as a slip. A larger vertical drop, -&#916;y&gt;12 mm, is defined as a fall. In the w 1118 cohort, we detected a total of 41 slips and 52 falls in 10 trials, indicating that &lt;0.5% of movements involved these large drops in height. Both slips and falls occurred at various heights, with a higher incidence rate above a height of &#8764;8 cm (Fig. <ref type="figure">3F</ref>). The increase in the incidence of slips and falls with height is consistent with the idea that the longer flies are engaged in climbing, the greater their chances of losing traction. Importantly, these data suggest that similar to the ratio &#961; + /&#961; -, slip and fall characterization can be used as an independent measure of locomotor coordination in geotaxis.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Comparison of genotypes</head><p>To further exploit the analytic capabilities of our platform, we next compare geotaxis of three widely used laboratory strains w 1118 , CS and yw. Each genotype was measured in three independent experiments (Fig. <ref type="figure">S4</ref>). Our experiments showed that the strains differ in their geotactic performance, with w 1118 on average showing the best and yw the worst climbing ability (Fig. <ref type="figure">4A</ref>). We wondered whether our analyses could reveal kinetic details behind these differences. Speed distributions (Fig. <ref type="figure">4B</ref>, top) show that w 1118 flies have a significantly higher probability (P=0.31) of moving at speeds &gt;20 mm s -1 compared with CS (P=0.09) and yw (P=0.03) flies. While CS and yw distributions roughly overlap for speeds &lt;20 mm s -1 , CS flies are more likely than yw flies to move at higher speeds. These speed data yield median values of 16.3, 7.8 and 5.2 mm s -1 for w 1118 , CS and yw, respectively, in accordance with their relative ranking in climbing rates. Movement angle distributions (Fig. <ref type="figure">4B</ref>, bottom) showed that all three genotypes generally move in the +y direction (P&#8805;0.81). However, yw flies have a slightly higher tendency to display positive geotaxis, as their probability for all movement angles &#952;&#8804;0 is consistently higher than that of the other two genotypes. In addition to speed, the number of turns during walking can serve as an alternative window into locomotor activity (see Materials and Methods).</p><p>Data on speed-angle correlations indicate that w 1118 flies have the largest bias in the +y direction with a mean &#961; + /&#961; -of 6.6, followed by yw flies with a &#961; + /&#961; -of 3.7 and, lastly, CS with a &#961; + /&#961; -of 1.7 (Fig. <ref type="figure">4C</ref>). The large correlation bias for w 1118 flies is consistent with their superior climbing rate. But a larger yw bias compared with CS flies is surprising, as yw flies perform poorly in overall climbing. The CS-yw difference suggests that a poor &#961; + /&#961; -ratio is not a major impediment to climbing ability in CS relative to yw. We also compared the incidence rate of slips and falls in the three groups. The slips and falls data show that yw flies have the lowest rate, &#8764;11 per 100 tracks on average, compared with &#8764;117 per 100 tracks in w 1118 flies and &#8764;200 per 100 tracks in CS flies (Fig. <ref type="figure">4D</ref>, top). Thus, based solely on the drop rates, yw flies would be expected to be the best climbers and CS or w 1118 flies the worst. Examination of the drop locations and magnitudes provides additional insights (Fig. <ref type="figure">4D</ref>, bottom). These data show that the majority of w 1118 drops occur &gt;110 mm above the bottom, while the majority of CS and yw drops occur below &#8764;50 mm from the bottom. As w 1118 flies drop from greater heights, it is reasonable to expect the size of their drops to be larger. Yet, we find that w 1118 and yw flies have on average the same drop size of &#8764;20 mm while those of CS flies are statistically smaller, &#8764;12.6 mm (Fig. <ref type="figure">S5A</ref>). When the size of a drop is compared with the maximum possible size of the drop (this ratio is 1 along the curved dashed line in Fig. <ref type="figure">4D</ref>), we find that it is 0.22, 0.53 and 0.62 for w 1118 , CS and yw flies, respectively; that is, a larger fraction of yw drops bring the flies to the bottom of their vial (Fig. <ref type="figure">S5B</ref>).</p><p>In short, we find that the two best predictors of w 1118 , CS and yw relative climbing performance are speed and the size of drop compared with its maximum possible size. The other metrics we introducedsuch as movement angle, &#961; + /&#961; -ratio and the frequency of dropsonly partially capture relative geotaxis ability of the three strains. For instance, &#961; + /&#961; -results correctly predict that w 1118 flies are the best climbers but incorrectly predict that yw flies are superior to CS flies. The incongruent conclusions drawn from the different metrics indicate that they capture different features of locomotion and are, at least partly, independent of each other. Having several independent metrics is a powerful analytic resource whose potential for uncovering geotactic aberrations will become clearer through future quantitative studies <ref type="bibr">(Lobato et al., 2024)</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>DISCUSSION</head><p>The custom tracking and analyses programs and detailed instructions on how to use them are freely available from GitHub (<ref type="url">https://github.com/sheyums/Insect-Geotaxis</ref>). This work joins several recent efforts to develop platforms for robust examination of fruit fly geotactic behavior. Our new apparatus builds upon prior experimental procedures by incorporating mostly off-the-shelf components in an intuitive design that allows stable, highthroughput and reproducible measurements. Computer control of the apparatus permits changes in experimental parameters. We have shown that single-fly trajectory reconstructions yield both accurate climbing curves and a wealth of kinetic metrics, enabling a deeper understanding of geotactic behavior than what has been possible thus far.</p><p>Tracking multiple freely moving flies over time is the most challenging part of single-fly trajectory reconstructions. We addressed the challenge with the application of two noteworthy computer vision tools. One is a predictive algorithm, called the Kalman filter, which provides an estimate of the most likely match between a new detection with existing tracks. We use the Kalman estimate together with a separate estimate based on previous detection coordinates. The joint estimate provides a key input for the second important computer vision algorithm, called the Hungarian method, that optimizes detection-to-track association.</p><p>The number of flies that climb to a given height within an allotted time is the most used measure of geotaxis. Current platforms with limited tracking ability report final fly count, low time resolution intermediate counts or climbing curves for only single flies per vial <ref type="bibr">(Gargano et al., 2005;</ref><ref type="bibr">Podratz et al., 2013;</ref><ref type="bibr">Willenbrink et al., 2016)</ref>. Other methods with ostensibly better tracking still do not present climbing curves but instead rely on other population-wide metrics <ref type="bibr">(Cao et al., 2017;</ref><ref type="bibr">Damschroder et al., 2018;</ref><ref type="bibr">Kohlhoff et al., 2011;</ref><ref type="bibr">Spierer et al., 2021)</ref>. Our algorithm can track multiple flies simultaneously &#8764;97% of the time with millimeter accuracy. The climbing curves in our studies provide a dynamic picture, revealing single-fly movements with a 1/30 s temporal resolution. The high-resolution tracking allows us to dissect geotactic behavior at the level of single video frames, demonstrated by quantifying instantaneous movement angle and speed and by conducting metaanalysis on their correlations across three different laboratory strains. Flies are known to lose traction occasionally during climbing, but prior Drosophila studies overlooked these events. Quantification of such falls is critical, especially in fly disease models <ref type="bibr">(Chaudhuri et al., 2007;</ref><ref type="bibr">Zhu et al., 2019)</ref>, as several human neurological disorders associated with loss of balance show an increased frequency of falls <ref type="bibr">(Bloem et al., 2001;</ref><ref type="bibr">Stolze et al., 2004)</ref>. We demonstrate that accounting for these rare events can uncover the nature of movement deficiencies underlying defective geotaxis.     Movie 1. An example of a typical experimental trial video. A forward-facing 12 second recording of the vial mount from the automated apparatus showcasing 10 wild type cohorts. Vials 1-3 contain yw females (N=7 flies/vial), vial 4 contains CS females (N=6), vial 5 contains w 1118 females (N=3), vial 6 contains w 1118 males (N=5), vial 7 contains CS males (N=5), vials 8-10 contain yw males (N=4,6,5 respectively). Movie 2. An example of a ROI video after video processing. From the original trial video (Movie 1), the user defined Region of Interest (ROI) is used to cut the 12 second video into individual vial videos. This example is vial 2, female yw flies (N = 7). Movie 3. A real time visual representation of the output from the tracking algorithm. Using the same ROI video from Movie 2 (vial 2, yw females, N=7), per frame each fly is detected, shown by the yellow bounding boxes, and assigned a corresponding number attached by yellow flags. The centers of the bounding boxes in each video frame correspond to the coordinates saved in the algorithms output matrix. The video shows several collisions between flies. Analysis of a larger dataset of 79800 frames (266 flies x 10 seconds x 30 frames s -1 ) detected 2762 collisions, amounting to ~ 3.5% of possible instances. Not every collision leads to switching in identities. As an upper estimate, track label swapping occurs in &lt; 2% of the time.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" xml:id="foot_0"><p>METHODS &amp; TECHNIQUESJournal of ExperimentalBiology (2025Biology ( ) 228, jeb248029. doi:10.1242/jeb.248029  /jeb.248029   </p></note>
		</body>
		</text>
</TEI>
