An automated system for measuring parameters of nematode sinusoidal movement
© Cronin et al. 2005
Received: 19 August 2004
Accepted: 07 February 2005
Published: 07 February 2005
Skip to main content
© Cronin et al. 2005
Received: 19 August 2004
Accepted: 07 February 2005
Published: 07 February 2005
Nematode sinusoidal movement has been used as a phenotype in many studies of C. elegans development, behavior and physiology. A thorough understanding of the ways in which genes control these aspects of biology depends, in part, on the accuracy of phenotypic analysis. While worms that move poorly are relatively easy to describe, description of hyperactive movement and movement modulation presents more of a challenge. An enhanced capability to analyze all the complexities of nematode movement will thus help our understanding of how genes control behavior.
We have developed a user-friendly system to analyze nematode movement in an automated and quantitative manner. In this system nematodes are automatically recognized and a computer-controlled microscope stage ensures that the nematode is kept within the camera field of view while video images from the camera are stored on videotape. In a second step, the images from the videotapes are processed to recognize the worm and to extract its changing position and posture over time. From this information, a variety of movement parameters are calculated. These parameters include the velocity of the worm's centroid, the velocity of the worm along its track, the extent and frequency of body bending, the amplitude and wavelength of the sinusoidal movement, and the propagation of the contraction wave along the body. The length of the worm is also determined and used to normalize the amplitude and wavelength measurements.
To demonstrate the utility of this system, we report here a comparison of movement parameters for a small set of mutants affecting the Go/Gq mediated signaling network that controls acetylcholine release at the neuromuscular junction. The system allows comparison of distinct genotypes that affect movement similarly (activation of Gq-alpha versus loss of Go-alpha function), as well as of different mutant alleles at a single locus (null and dominant negative alleles of the goa-1 gene, which encodes Go-alpha). We also demonstrate the use of this system for analyzing the effects of toxic agents. Concentration-response curves for the toxicants arsenite and aldicarb, both of which affect motility, were determined for wild-type and several mutant strains, identifying P-glycoprotein mutants as not significantly more sensitive to either compound, while cat-4 mutants are more sensitive to arsenite but not aldicarb.
Automated analysis of nematode movement facilitates a broad spectrum of experiments. Detailed genetic analysis of multiple alleles and of distinct genes in a regulatory network is now possible. These studies will facilitate quantitative modeling of C. elegans movement, as well as a comparison of gene function. Concentration-response curves will allow rigorous analysis of toxic agents as well as of pharmacological agents. This type of system thus represents a powerful analytical tool that can be readily coupled with the molecular genetics of nematodes.
A major motivation for establishing C. elegans as an experimental molecular genetic system was to understand how genes control behavior, especially locomotion, since the uncoordinated (Unc) mutants were discovered early in the history of C. elegans genetics [1, 2]. While studies of hundreds of genes involved in this behavior have led to many insights into processes such as axonal guidance (unc-5, unc-6 and unc-40; [3, 4]), synaptic transmission (unc-13, unc-18; [5–7]), myosin assembly (unc-54 ), regulation of G protein signaling [9–16]), neuropeptide function  among many others, there has been no general understanding of how C. elegans moves. Starting with Brenner C. elegans researchers have identified several hundred genes with effects on movement. Recently, RNAi screens have identified 1371 of 27,574 experiments (approximately 800 genes) that confer abnormal movement . Normal nematode movement is indicative of a toxicant-free environment, and of youthful vigorous worms. Drugs and toxins affect worm movement [19–21], and locomotory defects are a hallmark of aging worms . Models for C. elegans movement (e.g. [23–25]) would be enhanced by additional quantitative data.
Descriptions of movement phenotypes, particularly hyperactive locomotion, have been partial and to some extent anecdotal. For example, mutations in a number of genes result in activation of the EGL-30 (Gαq) signaling pathway and cause an increase in the frequency of body bends [7, 9, 10, 12, 15, 17, 26–30]. Overexpression of or gain-of-function mutations in egl-30 also cause animals to move with exaggerated body bends [28, 29], but the presence or absence of this phenotype has only been reported for a few of the Gαq pathway activators [15, 17, 26]. The rate of locomotion has often been determined by manually counting body bends per minute (e.g., [30–32]). Amplitude of body waves has also been determined manually [17, 26]. Keating et al.  used visual inspection or manual quantification to screen for movement defects caused by RNAi depletion of neuropeptide receptors. These approaches, while useful, are labor intensive and provide only a partial description of the movement of a particular genotype.
We therefore developed a system to analyze the body posture of C. elegans hermaphrodites over time and extract quantitative information concerning their movement. Here we describe a functional system, metrics, analysis tools, and example applications for distinguishing closely related C. elegans mutants and establishing concentration-response relationships for toxic agents.
There have been other developments of automated systems. For example, Williams and Dusenbery  tracked the centroids of multiple worms simultaneously. Several other studies have also used automatic tracking of centroids to analyze velocity, dispersal and turning rate [35–41]. Hirose et al.,  have recently described a system to automatically measure body length, using image processing similar to that described here. At the time we developed the prototype of the system described here (1999–2000), there were no systems available. Here we describe a set of metrics that allow intuitive use of an automated system, and show the utility of these metrics for genetic studies and studies of toxic agents. During preparation of this paper, we have implemented a combined system that uses the metrics and some algorithms described here with components of a related system developed by Schafer and colleagues [43, 44]. The hardware and software for the hybrid system is described by ; the metrics and applications are described here in relation to our system.
Our system analyzes motion in two phases. First, video and worm posture data are acquired using the system hardware. Second, measures of behavior are extracted by software. Data acquisition is a two-step process: videotaping and data extraction.
The behavior of individual worms is examined on Petri plates with fresh, uniform bacterial lawns (see Methods), conditions that favor continued forward movement of the worms.
Our Tracker program grabs images (frames) from the video stream from the camera looking for differences between successive frames that indicate a moving worm. Tracker identifies the changed regions as either newly occupied or newly vacated. If a changed region falls outside of a 240 × 160 pixel bounding box (within the 320 × 240 pixel image) Tracker sends a command to the motorized microscope stage controller to shift the stage half of a screen width and/or height to relocate the itinerant worm back to the middle of the camera's view field. With the computer re-positioning the worm as necessary, the video stream from the camera is recorded onto VHS tape for use in the data extraction step.
Tracker was designed to move the microscope stage in rapid, discrete shifts, allowing the worm to crawl to the edge of the view field before being reined back to the center of our camera's view field. We chose this protocol to eliminate the need for position feedback sensors and stage position data storage.
Our Data Extraction apparatus consists of a personal computer with our Recognizer2.1 software package, a Matrox Meteor-II/Standard video frame grabber, a Panasonic model AG-5710P VHS video cassette recorder (which has an RS-232 connection for computer control and feedback of VCR operation), and an optional Sony video monitor (Figure 1B).
We use our Recognizer2.1 program to extract worm position and posture data from the video recording made in the previous step. Recognizer2.1 commands the VCR to play back segments of the worm videotape made previously and, using a double-buffering paradigm, grabs and processes images (frames) from the video stream at the rate of ~6 Hz. (Processing rate is a function of available computing bandwidth.) During extraction, Recognizer2.1 displays the grabbed/annotated images in its GUI window (Figure 2B).
Recognizer2.1 locates the worm in each 640 × 480 pixel image using contrast thresholding, identifies the worm's boundary curve, and uses the boundary curve to calculate the worm's "spine." The program mathematically distributes points along the length of the "spine" and records the X-Y position of the points in an output file. (n points define n-1 body segments, between which there are n-2 articulation points, or "bends", whose angles we calculate.) We typically set Recognizer2.1 to distribute 13 points (13 points: 12 body segments: 11 articulation points) along the worm's spine, but the program can be easily user-customized to apply as many or as few points as desired if, for example, a longer worm is analyzed.
The result of running Recognizer2.1 is a set of folders saved to hard disk, each containing a file called "points" containing the table of X-Y coordinates for the 13 points on the worm spine in each grabbed image, and a set of bitmap worm images. The X-Y coordinate table's rows are the data for each image, with the first pair of rows containing the coordinate data from the first image grabbed, and the last pair of rows containing the data from the last image. The table's columns are the data for each of the points distributed along the worm's spine, but since Recognizer2.1 does not identify head versus tail, the saved coordinate data simply represents the posture and screen position of the worm in each processed image without regard to head-tail orientation. Data "orientation" is performed as part of the data processing phase.
Data processing and analysis is performed using a suite of programs we developed in Matlab (from The MathWorks) comprised of three applications: "Wormproc" (worm processing), "Metrics", and "Histograms." Data processing proceeds in several steps.
The researcher runs the "Wormproc" program for each worm to convert the X-Y data into a usable format. First, Wormproc loads into RAM the X-Y coordinate data and images captured and saved to disk by Recognizer2.1. Since Recognizer2.1 does not distinguish between head and tail, Wormproc orients spines by selecting the spine orientations (either oriented "as recorded" or "reversed") that are minimally different from each preceding spine. Further, Wormproc flags spines with lengths that are outside of a calculated "normal" range (asserting that they are invalid or missing data), and identifies the end of the worm that moves the most as the head-end (based on typical C. elegans foraging behavior). Disjointed data segments, for example before and after an omega bend, are treated as separate data segments; Wormproc identifies head position before and after such breaks.
Next, Wormproc mathematically removes the microscope stage shifts from the X-Y data; the program recognizes stage shifts by a velocity spike (a very large displacement between two consecutive frames) uncharacteristic of a nematode. The program offsets the X-Y coordinate data after each stage shift to continue the worm's path of locomotion, interpolating over any single missing frames. Occasionally Recognizer2.1 will have grabbed a worm image while the microscope stage is moving. In these instances Recognizer2.1 either will not be able to identify any worm in the image or, because of the interlaced video and contrast, will only be able to recognize a tiny area of the smeared image as worm. In either case the X-Y data for these frames will have been automatically rejected for being outside of the normal length range for the worm.
Finally, Wormproc provides a GUI (Figure 2C) that allows the user to verify (and modify, if necessary) the computer's assertions on valid/invalid data, and worm head/tail orientations via an animation of the subject worm's movements with still images presented in a second window for reference. When the user is satisfied, the program saves the oriented and verified data to hard disk.
One set of attributes concerns the speed of worm movement. We calculate the instantaneous speed of the animal's centroid (its 'centroid velocity' or VELC). We define the centroid as the mean position of points 5–13 (approximately the posterior two-thirds of the body), and the instantaneous centroid velocity as the change in centroid position over time. Likewise, we calculate the instantaneous velocities of all 13 points along the spine as they move over time (the point velocity, or PTVEL). We define the means of the point velocities for points 5–13 as the worm's 'velocity' (VEL). Instantaneous velocity, point velocity and centroid velocity are identified as 'forward' (positive) or 'backward' (negative) reflecting the direction the animal is moving. The MODE lists the instantaneous movement direction with 1's (forward) or -1's (backward). MODE is determined automatically in Metrics by evaluating whether the majority of points 5–12 are moving closer to their anterior or to their posterior neighbors through successive frames. Due to signal noise, MODE cannot at present be set to "no movement". THETA is the instantaneous velocity (VEL) vector direction.
A second set of attributes concerns propagation of the contractile wave. The flex (FLEX) is the difference between maximum positive and negative bend angles in a sliding time window for each of the articulation points. The bending frequencies (FRE) are the time-windowed bending frequencies at each of the worm's articulation points. Time delay (PHS) is a matrix containing the time delay required for an articulation point to reach the same angle as its next anterior neighbor; this metric describes the rate of wave propagation along the worm.
A third set of attributes describes the worm's waveform. The track amplitude (AMPT) is the instantaneous worm track waveform amplitude, specifically the width of a best-fit bounding box aligned with the worm's instantaneous velocity vector. Wavelength (WAVELNTH) is a measure of the instantaneous physical wavelength of the worm's sinusoidal body posture.
Another attribute describes morphology. The worm's length (LEN) is the sum of the distances between the points along the worm's "spine."
We developed several data visualization routines to display and compare the movement attributes of worms.
The most common program we use is "Histograms" which displays a set of histograms for comparing locomotory parameters for populations of nematodes. The standard attributes displayed are: Centroid Velocity, (Mean Point) Velocity (velocity of the worm along its sinusoidal track), Flex (for several articulation points), Bending Frequency (for several articulation points), Time Delay (for several articulation points), Track Wavelength, and Track Amplitude (both in millimeters and normalized as a percent of mean worm body length).
In addition to comparing populations of worms, it is often useful to compare individual worms within a population, for which we developed "iHistograms." This application produces the same charts as "Histograms," but displays the data for individual worms instead of populations.
Using the flexibility of the Matlab programming environment we have developed a multitude of specialty analysis tools, ranging from toxicant concentration-response curves, to speed decay as a function of time, to animation routines to visualize wave propagation, to reversal frequency. With a bit of creativity, output can be customized to a broad range of experiments. To demonstrate the general applicability of this type of system to nematode biology, we provide a few salient examples: genetics and toxicology.
One common problem in behavioral studies on C. elegans is day-to-day variability. To test whether data obtained on different days could be pooled, we analyzed the movement of small numbers of wild-type individuals on different days. We then compared the means for each movement parameter of each daily group to those for the pooled total. Specifically, we compared seven groups comprising four-twelve individuals to the total data set of 58 individuals. Two groups, with five animals each, had means for more than one parameter that were significantly different from the pooled total and were eliminated from our analysis. For the remaining groups, the p values for all parameters except FLEX ranged from 0.07 to 0.99. For two of the included groups, mean values for FLEX for the more posterior articulation points were significantly different from the pooled total. We therefore report FLEX measurements for a more anterior articulation point (bend 5) only. Comparison of the daily groups to the pooled total is displayed in Figure 4, which shows types of graphical representation available in our system.
Our movement analysis system is thus able to discriminate between the effects of different mutations that affect the same parameters of movement.
To test the utility of our system for analyzing the effects of toxicants, we focused on the neurotoxin aldicarb and the metabolic inhibitor arsenite. We first established baseline conditions for these toxins. We then tested whether existing mutations would increase the sensitivity to these compounds. We focused on mutations that affect cuticle and P-glycoprotein transporters.
We tested three candidate hypersensitive mutant C. elegans strains for movement in response to increasing doses of aldicarb and sodium-arsenite.
The cat-4 gene encodes GTP cyclohydrolase I (C. Loer, personal communication; see also ) necessary for biosynthesis of biogenic amines; it is hypersensitive to several disparate agents such as the neurotransmitter serotonin and the detergent SDS, suggesting a weaker or more porous cuticle (C. Loer, pers. comm.). cat-4 mutants are 2.2-fold more sensitive to aldicarb (EC50 = 0.18 mM vs. 0.39 mM; Figure 7A) and 8.1 fold -fold more sensitive to arsenite (EC50 = 1.2 mM vs. 9.7 mM; Figure 7B) than wild-type C. elegans. Only the EC50s of wild type and cat-4 on arsenite are significantly different.
Our system is thus useful for analyzing the effects of toxicants on nematode movement and for examining the effects of genetic background on toxicant sensitivity.
We describe a usable automated system to record and analyze C. elegans locomotion and to display quantitative data. We describe several useful parameters of locomotory behavior. These include automatic determination of the velocity of the worm's centroid, the velocity along its track, the degree of flex of body at various positions along the body axis, the bending frequency between adjacent segments, and the body-length normalized track amplitude and wavelength (Figure 3). Many of these measurements match what C. elegans geneticists have typically observed in describing movement variations such as velocity and body bends per minute. Our system thus provides facile quantification of standard phenotypes. Additionally, our system provides measurements that describe many aspects of movement that relate to underlying neural and mechanical mechanisms of locomotion such as propagation of the contraction wave. We envision that the ability to describe in a quantitative and automatic manner nematode movement will facilitate modeling of C. elegans movement.
We have demonstrated that our system can be used to distinguish between different alleles of the same gene, different genes, and different environmental conditions. It thus provides a rich dataset for analysis of gene function and toxicology. In addition, this system can be adapted to score other phenotypes. For example, the frequency of spontaneous reversals can be easily extracted from the data set. This system gives worm length as well, and thus we can normalize the track wavelength. Measurement of body length has been used to screen for suppressor mutations and to analyze mutations that affect gene expression [47, 54], and thus this system can be used for genetic studies besides behavior.
The basic platform described here might be readily extensible to analysis of other nematode behaviors such as male mating, as well as the behavior of other organisms such as the crawling of insect larvae. Although the system is not high throughput, recording of each individual hermaphrodite takes only seven minutes of largely hands-off time on the part of the researcher. Including processing of the data, a single data set comprising 10–12 individuals can be generated in less than three hours.
There are a number of limitations to our system. We use all relative coordinates, and thus tracking worms with respect to specific locations on the Petri plate, for example a gradient of chemoattractant, is not possible. In addition, the noise inherent in our tracking system, most likely arising from its use of analog video, precludes our detecting a worm that is definitively not moving. Moreover, the throughput of our system is limited by its inability to follow multiple worms simultaneously.
While preparing this manuscript, we compared our system to that of W. Schafer and colleagues [43, 44], and identified useful features of each system. We have begun to develop a joint system taking advantage of the best features of each system to allow further software development to proceed in an efficient manner. A prototype has been described , but the system described here has been used in a number of ongoing studies in our laboratory and is still in continual use.
C. elegans N2 . NL131 pgp-3(pk18)X; goa-1(sy192)I; goa-1(n1134)I. CB1141 cat-4(e1141)V. NL130 pgp-1(pk17)IV; pgp-3(pk18)X. NL152 pgp-1(pk17) IV; pgp-3(pk18) X; mrp-1(pk89)X. Nematode Growth Medium (NGM) is from Brenner .
10 cm NGM recording plates are equilibrated to 20°C for 18–20 hours prior to being spread with bacteria. Approximately one hour before beginning our recordings, 600 μl of fresh OP50 overnight culture is spread onto each plate, rapidly swirling and shaking to achieve a thin, featureless lawn of food across the entire surface. Excess solution is drawn from the edge with a Pipetman. Each food-spread plate is covered with a tissue (Kimwipe), to ensure that the plate remains dust-free as it dries. The food is allowed to dry onto the NGM surface just until the surface exhibits a matte finish (about 45 minutes), at which time the tissues are replaced by the Petri dish lids and the plates are ready for use. The time required for drying is monitored as a crude measure of the relative moisture content of the plates. Plates requiring more than 60 minutes to dry are discarded. Each plate is used within three hours of drying.
L4 hermaphrodites are selected 18–20 hours prior to recording to control for age. Individuals are placed on assay plates and the plate is placed in the holder on the microscope stage. After two minutes the worm is located and recording begins. Each worm is recorded for five minutes and the central four minutes of data are analyzed. Incubations and recordings are done in a constant temperature room at 20°C.
Aldicarb and sodium-arsenite stocks were prepared in H2O (at 55°C for aldicarb), and the appropriate volume added to cooled NGM media prior to pouring plates. The volume of added solution was kept constant. The pH of media containing sodium arsenite was adjusted to 5.8–6.0 (to match NGM without toxicant) with concentrated HCl. This was not necessary for plates containing aldicarb. 10 cm assay plates and 5 cm pre-incubation plates were prepared similarly and stored at 4°C until needed. To insure an ample source of food during pre-incubation, 5 cm plates were seeded with fresh OP50 18–20 hours before use and stored at 37°C until 2 hours prior to the assay when they were placed at 20°C. 10 cm assay plates were equilibrated to 20°C and spread with a thin lawn of OP50 as described above. Hermaphrodites were placed on pre-incubation plates and incubated for 30 minutes for aldicarb and 3 hours for sodium-arsenite prior to recording. Following pre-incubation, individuals were transferred to assay plates and recorded after a 2-minute rest on the microscope stage as described above. All preincubations and assays were performed at 20°C.
Our recordings were made using a Wild M5A stereo dissecting microscope with a 25× objective lens and a 1.25× camera mount.
Tracker and Recognizer2.1 are written in Microsoft Visual C++ (6.0), using Matrox ActiveMIL-Lite libraries for image manipulation from the Matrox Meteor-II frame grabbers.
Tracker is programmed to work with the optics present on our Wild microscope but can be customized to work with other microscopes with minor software changes reflecting the appropriate magnification levels. For our microscope, each stage shift commanded by Tracker to re-center a worm is between 0.362 mm and 0.904 mm depending on the orientation and speed of the worm. Our BioPoint controller is programmed to move the stage with a starting speed of 6.3 mm/sec (= 10,000 pulses/sec with a 0.628 μm/pulse step size), an acceleration rate of 44.8 mm/sec2 (71,400 pulses/sec2), and a maximum run speed of 31.4 mm/sec (50,000 pulses/sec). However, because of the small distances traveled, we expect the stage to reach a maximum velocity of 8.5 mm/sec (13,500 pulses/sec) during a stage shift.
Recognizer2.1 calculates the location of the user-defined number of points (typically 13) along each worm's spine as follows: Recognizer2.1 identifies the center of the darkest portion of the image as its focus of attention and extracts a portion of the image surrounding the center point for further processing. Next, the extracted gray-scale image is turned into a binary image using a segmentation algorithm. The segmentation routine compares the ratio of pixel values resulting after applying two smoothing filters (sum of squared pixel values and square of summed pixel values, both in a typically 15 × 15 pixel neighborhood) against a user defined threshold. Pixels with pixel value ratios less than the threshold are "worm" while the others are "background." Connected regions in the binary image are labeled and Recognizer2.1 then selects the largest-area connected region as the worm in the image. Recognizer2.1 calculates the worm's boundary polygon with a user-defined number of vertices – typically 50 – by interpolating equidistant vertices along the chain of pixels on the perimeter of the worm region. Boundary polygon vertices are passed to Triangle , which generates constrained Delaunay triangulations across the worm boundary polygon. Finally, Recognizer2.1 connects the circumcenters of the resulting triangles to form segments of the worm's spine curve, along which Recognizer2.1 interpolates the 13 equally spaced "spine" points.
Feature extraction tools are written in Matlab and C++. Attributes are calculated as follows, described based on a typical analysis distributing 13 points along a worm's spine:
Centroid velocity is a series of speed values, one for each pair of successive frames, and is calculated as the distance the worm's centroid moves between successive frames divided by the time between successive frames. We define the worm's centroid as the mean position of points 5–13 (approximately the rear two-thirds of the worm).
VELC = (Δ Centroid Position) / (Δ Time)
Sign of VELC describes forward (positive) or backward (negative) movement. Movement of the anterior one-third of the worm is ignored from this calculation (and the VEL calculation below) to minimize the effect of foraging behavior on speed.
Point velocity is a matrix of speed values, one for each of the 13 points for each pair of successive frames, calculated as the distance each point along a worm's spine moves between successive frames divided by the time between successive frames.
PTVEL = (Δ Point Positions [all 13 points]) / (Δ Time)
Signs of PTVEL describe each point's forward (positive) or backward (negative) movement. PTVEL describes the speed with which each point travels along the worm's serpentine path.
Velocity is a series of speed values, one for each pair of successive frames, calculated as the distance each point along a worm's spine moves between successive frames divided by the time between successive frames.
VEL = Mean of PTVEL's 5–13 for each pair of successive frames
Sign of VEL describes forward (positive) or backward (negative) movement. VEL describes mean speed of the worm's body along its sinusoidal path.
MODE is a series of flags indicating the signs of a worm's instantaneous speed attributes (VEL and VELC), that is, whether the worm is moving forward or backward. Mode is calculated automatically at the same time as speed attributes by comparing:
D1: mean of the distances between points 4–11 at time τ and their posterior neighbors, points 5–12 at time τ + 1
D2: mean of the distances between points 6–13 at time τ and their anterior neighbors, points 5–12 at time τ + 1
Forward movement is indicated by D1<D2; backward by D2<D1. The MODE flags can be either 1 (forward) or -1 (backward). (Note that the points distributed along a worm's spine are equidistant, so a non-moving worm would have no difference in the distance between neighboring points over time.)
The instantaneous velocity vector direction is calculated as the direction the worm's centroid moves between successive grabbed frames. (Calculated as:
THETA = arc tangent of the worm's X-Y displacement.)
We calculate the matrix of angles between each segment (that is, at each articulation point) for each frame by:
angle = acos [(V1x*V2x + V1y*V2y) / (|V1|*|V2|)]
V1 = first segment vector and
V2 = second segment vector
We define the FLEX at each articulation point as the maximum angle difference during each possible 32 frame (~6 second) time window; that is, the most positive angle minus the most negative angle.
We apply the spectrogram function ("specgram") from Matlab's Signal Processing Toolbox to the matrix of bend angles calculated for FLEX. Specgram calculates a windowed discrete-time Fourier transform (short-time Fourier transform) for the changing angles for each articulation point using a sliding window 32 frames (~6 seconds) wide. We quote from Matlab's documentation for specgram: "specgram calculates the spectrogram for a given signal as follows: 1. It splits the signal into overlapping sections and applies the window specified by the window parameter to each section. 2. It computes the discrete-time Fourier transform of each section with a length nfft FFT to produce an estimate of the short-term frequency content of the signal; these transforms make up the columns of B. The quantity (length(window) – numoverlap) specifies by how many samples specgram shifts the window. 3. For real input, specgram truncates the spectrogram to the first nfft/2 + 1 points for nfft even and (nfft + 1)/2 for nfft odd." The magnitude of the function indicates the relative energies of the signal's component frequencies. We take the highest magnitude (non-constant) component frequency as the characteristic frequency of that time-window of angles. (If two or more frequencies share the highest magnitude, the lower frequency is identified as the characteristic frequency.)
For the time delay calculation, the program correlates anterior bend angles with posterior bend angles occurring at later time using a Dynamic Time Warping function. The program then uses these correlations to calculate the time required for the posterior bend to reach the same angle as its anterior neighbor.
The program aligns the major axis of a best-fit bounding box with the worm's instantaneous velocity vector. The width of the bounding box (its minor axis) is taken as the instantaneous wormtrack waveform amplitude.
We apply a rotation and translation transform to the spine of the worm from every frame to mathematically align each worm with y = 0 using the instantaneous velocity vector as the worm's centerline:
We create a matrix w containing the XY coordinates of the 13 points for a worm's spine and create a translation transform that we will use to center the worm's midpoint at the XY origin:
We also create a rotation transform to align the instantaneous velocity vector (with angle theta), to y = 0:
We multiply the two matrices to create a convenient combined transform
C = B*A;
and finally multiply our matrix by the combined transform matrix
ww = C*w;
which yields a matrix ww with the rotated and aligned coordinates for the 13 points. We perform a spatial Fast Fourier Transform (FFT, using Matlab's built-in fft function) on the rotated "spine" of each worm, using the varying y-values as the "signal" with their corresponding x-position values defining the signal to be in a spatial (rather than temporal) domain. By working in the spatial domain, the result from our FFT is in cycles per mm. The inverse of this result is the track wavelength, in mm per cycle.
Sum of the distances between the points distributed along the worm's spine with each point-to-point distance calculated by (Δ x2 + Δ y2)0.5
Data Analysis and Comparison tools are written in Matlab. Our most common tool is called Histograms, which produces a set of charts displaying distributions of measures of behavior: Velocity, Centroid Velocity, Bending Frequency, Flex, Time Delay, Track Amplitude, Track Wavelength, Length-Normalized Track Amplitude, and Length-Normalized Track Wavelength.
To create a histogram curve for a given metric, for example a velocity histogram curve, we sort (or 'bin') each worm's velocity data into discrete ranges (or 'bins'). For velocity we use 'bins' that are 0.03333 mm/sec wide, i.e. bins would represent 0 to 0.03333 mm/sec, another 0.03333 to 0.06666 mm/sec, and so on. Bin sizes for each parameter are as follows: Point and Centroid Velocity, 0.03333 mm/sec; Flex, 0.1 radian; Frequency, 0.16665 Hz; Time Delay, 0.075 sec; Track Amplitude, 0.01 mm; Track Wavelength, 0.05 mm; Length-Normalized Track Amplitude, 1% mean body length; Length-Normalized Track Wavelength, 5% mean body length.
Again using our velocity example, the frequency of occurrence for the number of velocity values in each bin is normalized to a percent of velocities observed for that worm, and the normalized velocity distribution is added to a list of the other normalized velocity distributions for that population. (Normalizing each worm's data affords each worm equal mathematical significance.) The final histogram curve for the population is generated by plotting the mean value of each data bin's normalized frequency of occurrence (on the y-axis) versus the bin value (on the x-axis) which shows us the proportion of worms that exhibited each velocity. The same method is used for creating the histogram curves for each metric, naturally selecting bin sizes appropriate for the data in question:
Standard statistical tests were performed using Matlab functions. Each p-value reported was from a one-way analysis of variance (ANOVA) comparing the distribution of mean values (one per individual) from each population of worms against that of each other population; each ANOVA tested the null hypothesis that the mean of the mean values from each populations were the same. Unless otherwise noted, statistical tests were performed on data from worms only when moving forward. For the toxicant concentration-response data, curves were fit by non-linear regression using Prism (GraphPad Software) sigmoidal dose-response equation with variable slope.
Source code is available through a GPL at http://wormlab.caltech.edu/publications/download.html
Documentation of this software is available as a pdf from http://wormlab.caltech.edu/publications/download.html
We thank X. Xu for suggesting length normalization, Jonathan Shewchuk for Triangle, and anonymous reviewers for many helpful suggestions. Supported by grants from the ONR (S.B.), DARPA (R. S.) and Howard Hughes Medical Institute, with which PWS is an Investigator.
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.