Sep 02, 2024

Public workspaceTardigrade videography, tracking, and step analysis

  • 1Ithaca College
  • Tardigrade Gait
Icon indicating open access to content
QR code linking to this content
Protocol CitationIan Woods 2024. Tardigrade videography, tracking, and step analysis. protocols.io https://dx.doi.org/10.17504/protocols.io.kxygxy8nwl8j/v1
License: This is an open access protocol distributed under the terms of the Creative Commons Attribution License,  which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited
Protocol status: Working
We use this protocol and it's working
Created: September 01, 2024
Last Modified: September 02, 2024
Protocol Integer ID: 106808
Keywords: tardigrade, gait analysis, computer vision, automated tracking, videotracking, tardigrades,
Abstract
Protocols for tardigrade handling, preparation for videography, video acquisition, path tracking, step timing quantification, and analysis. Descriptions of Python scripts used in the analysis pipeline.
Gel-bottomed dishes
Gel-bottomed dishes
Tardigrades will not generally walk in glass or plastic Petri dishes, because they need something to grip with their claws. Hypsibius exemplaris individuals reliably walk if they are able to grasp the surface with all eight claws. We use plastic Petri dishes lined with 2% agar or agarose (in Poland Spring water). Agarose is preferable when using inverted microscopes, because agar tends to have more debris which can obscure the tardigrade and interfere with automated tracking.
Tardigrade Wrangling
Tardigrade Wrangling
Tardigrades are sensitive to heat; exposure to warm lights (e.g. in the base of dissecting microscopes) can be mitigated by placing the tardigrade dish on top of an inverted Petri dish or a lid. We transfer tardigrades via glass capillaries. Because tardigrades are so small, they are easily lost; when possible, the tardigrade should be watched under the microscope throughout the entire transfer procedure.
To capture a tardigrade, gently knock it off its feet, and apply gentle suction to the capillary.
Lift the capillary out of the water, hold it in place under the microscope, and position the new container below the capillary.
Expel the tardigrade onto the surface of the agar or agarose in a small volume of water.
Confirm that the tardigrade has been transferred successfully, and use the glass capillary to clean out debris and reduce the volume of water in the drop. As the volume of water decreases, the tardigrade will be able to grip the surface.
If necessary, the tardigrade can be gently rolled onto its feet with a small flexible wire or an "Irwin Loop" (Schram and Davison 2012). Once the tardigrade establishes a grip, it will begin walking.

Videos of tardigrade locomotion
Videos of tardigrade locomotion
Prepare 35 mm Petri dishes by adding approximately 500 µL of molten 2% agarose (e.g. 200 mg agarose in 10 mL Poland Spring water) to the bottom of each dish.
Prepare your compound scope for video capture: launch the camera software, take a micrometer image under the 10X objective, and make a folder to save your videos. Locating and following a tardigrade under the scope can be stressful; you want to minimize any other distractions and things to do.
From stock dishes, select a large tardigrade, preferably a green-bellied one without eggs. Under a dissecting microscope, transfer the tardigrade into the center of the agarose-bottomed Petri dish. To prevent loss of the tardigrade, it is highly recommended to keep the tardigrade in view under the microscope.

Remove algae or other debris, leaving the tardigrade in a small drop of water in the dish. The small droplet of water is helpful in locating the tardigrade when the dish is transferred to a compound scope. To encourage the tardigrade to grasp the surface of the agarose, it may be necessary to remove a bit of water or to gently drag the tardigrade to the edge of the droplet.
Transfer the dish with the tardigrade to a compound scope. We use an inverted microscope, though an upright microscope would also work. Locate the tardigrade under low power, and focus on the claws. Keeping the tardigrade in view, slowly add 1000 µL of Poland Spring water to the dish. If water is added too quickly, the tardigrade may be knocked off its feet and start squirming. If the tardigrade loses contact with the agarose, start again with a new tardigrade, or remove most of the water from the dish, leaving the tardigrade in a small droplet.
Making sure to keep the tardigrade in view, switch to the 10X objective and focus on the claws. Start recording video. Adjust the stage position as needed to follow the tardigrade, but the goal is to keep the background stationary as much as possible. We typically record videos for 2 minutes. Save the video with a standardized filename (e.g. initials_date_treatment_tardigradeNN.mov)
Path tracking
Path tracking
Extract clips from the video, where the tardigrade is walking but the background is stationary. On a Mac, these clips can be extracted using the Trim tool in QuickTime; on a Windows PC, these trimmed clips can be generated via the Photos app. Save each clip with a standardized filename (e.g. initials_date_treatment_tardigradeNN_clipstart-clipend.mov).
To run the tracking scripts, you need to have Python installed, along with numpy, matplotlib, scipy, opencv, and their dependencies. The Anaconda distribution of Python (https://www.anaconda.com/products/distribution) has most of these; opencv needs to be installed after the Anaconda environment is set up (e.g. by pip3 install opencv-python). Download the tracking scripts from GitHub (http://www.github.com/enwudz/gait) and save the scripts in the same folder as your videos (or in a separate location, if you are comfortable providing the directory path when running the scripts).
After dividing each movie into clips with stationary backgrounds, run the scripts below. Navigate in your Terminal (in Mac, or the Anaconda Command Prompt in Windows) to the folder that contains your videos. To run a program, type python [program name] into the Terminal. When you run each program, you will be asked to select which clip you would like to analyze.
Run initializeClip.py, which makes an excel file to record the data in each clip, and extracts information about the video (e.g. frame size, frame rate, duration).
Run autoTracker.py, which identifies the moving object in the video, and records the coordinates of the centroid of the object in each video frame. Adds this data to the excel file created by initializeClip.py.
Run analyzeTrack.py, which smoothes the coordinates of the tracked path, and calculates the speed and direction of travel of the moving object in each video frame. Identifies bouts of sustained forward walking, during which step kinematics and interleg coordination patterns can be measured (below). Adds this data to the excel file created by initializeClip.py.
[Optional]: run plotClip.py, which provides options for plotting aspects of the path of each tracked object.

[Optional]: run demoTracking.py, which takes the output of path tracking done by autoTracker.py, and makes a video of the tracked tardigrade labeled with the center of mass in each video frame, the path of the tardigrade, and the calls of stops and turns. This script is useful for validating the tracking scripts.
Step and gait tracking
Step and gait tracking
After path tracking (above), step timing data can be collected from periods of sustained forward walking in selected clips. In general, we aimed to collect step timing data for 10-20 seconds for each tardigrade, and prioritized periods of sustained forward walking that were around 8 seconds (the typical time it takes for a tardigrade to walk across the field of view under a 10X objective).
To run a program, type python [program name] into the Terminal. When you run each program, you will be asked to select which clip you would like to analyze.
Run cruiseSummaries.py, which reads path tracking data for all the excel files associated with each individual, and summarizes the bouts of sustained forward walking. Output of this script is useful to determine which clips to analyze in frameStepper.py
Run frameStepper.py, which gives an option to create rotated, cropped frames, orienting the animal so that the direction of motion is up in each video frame, and keeping the center of mass in the center of each image frame. Asks which leg to track, and then allows frame-by-frame progression through each video. When the target leg initiates stance or swing, timing can be recorded by keystrokes. All legs can be processed in one session, or the existing leg data can be saved and finished later. Adds timing of leg swings and stances to the excel file produced by initializeClip.py.
Run analyzeSteps.py, which calculates step kinematic data (stance duration, swing duration, duty factor, step period) for each stride of each leg. Calculates averages for these values for each leg. Determines which legs are in swing phase in each frame, and assigns a hexapod ICP and a rear ICP to each frame. Calculates the tetrapod and tripod coordination strength for each bout where these ICPs are evident. Adds this data to the excel file created by initializeClip.py.
[Optional]: Run plotClip.py. Once step data is collected for a clip, plotClip.py script provides options for plotting aspects of step kinematics and interleg coordination for that clip.
Combining data from individual clips
Combining data from individual clips
Data from individual clips can be combined per individual for further analyses or for comparisons between groups (e.g. treatments).
Run combineClips.py, which combines data from all excel files within a folder, grouping each excel file by each individual, calculating averages across the data for that individual, and combines data into a single excel file.
[Optional] Run compareGroups.py: offers options to plot comparisons between groups within the spreadsheet produced by combineClips.py.
Producing the Figures in Anderson et al. 2024
Producing the Figures in Anderson et al. 2024
Figures for this study were produced in jupyter notebook, and the notebooks are named according to the figures. Notebooks can be launched by typing 'jupyter notebook' into the terminal, after navigating to the directory with the notebooks. Jupyter is included in the Anaconda distribution of Python. Input for these figures is the excel file produced by combineClips.py above.
01_Tracking_Overview.ipynb produces Figure 1, S1 Figure, and the 'Exploratory Locomotion' columns in S1 Table.
02_Single_Clip_Quantification.ipynb produces Figure 2.
03_Step_Kinematics_lateral_rear.ipynb produces Figure 3 and the 'Step Kinematics' columns in S1 Table.
04_Phase_Offsets_ICPs.ipynb produces Figure 4, S3 Figure, and the 'Measurements of Interleg Coordination' columns in S1 Table.
05_Speed_Partitions.ipynb produces Figure 5.
06_Rear_leg_coordination.ipynb produces Figure 6.
07a_Adults_vs_Juveniles.ipynb produces the portions of Figure 7 and S2 Table relevant to comparisons between adults and juveniles.
07b_exemplaris_vs_Ramazzottius.ipynb produces the portions of Figure 7 and S2 Table relevant to comparisons between H. exemplaris and Ramazzottius.
07c_Control_vs_disulfiram.ipynb produces the portions of Figure 7 and S2 Table relevant to comparisons between controls and disulfiram-treated tardigrades.
0S2_Example_ICPs.ipynb produces S2 Figure.
0S4_Suppression_release_leg_swings.ipynb produces S4 Figure.
Other scripts in the 'gait' repository
Other scripts in the 'gait' repository
Many of these scripts support the scripts above, are useful in validating output of the scripts above, or were not used in the primary analysis for the Anderson et al. 2024 manuscript.
batchRename.py renames selected file types in a directory.

boxWalker.py makes an animation of swinging and standing legs, in the form of a grid of boxes of different colors, based on step timing data produced by frameStepper.py.
clickerTracker.py has the same functionality as autoTracker.py, but requires the user to mark the center of mass in each video frame.

demoTracking.py takes the output of path tracking done by autoTracker.py, and makes a video of the tracked tardigrade labeled with the center of mass in each video frame, the path of the tardigrade, and the calls of stops and turns. This script is useful for validating the tracking scripts.

gaitFunctions.py contains tracking and analysis code that is used by several of the core analysis scripts.

legAnimator.py makes an animation of swinging and standing legs, in the form of a line-drawn tardigrade (or human, or cat), based on step timing data produced by frameStepper.py.

legacyStepTracking.py updates data collected in the early portion of this project to a format that is consistent with later data collection.

makeMovieFromImages.py creates an .mp4 movie from a folder full of individual image frames.

manualCritterMeasurement.py enables measurement of length and width of an animal from selected video frames. This script is useful in validating the measurements produced by autoTracker.py.

measureImage.py enables measurement of any distance between objects or landmarks on selected video frames. This script is useful in validating the measurements produced by autoTracker.py.

qcStepTracking.py compares timing of stance and swing onset calls from two runs of frameStepper.py. This script is useful in training individuals to do the analysis, and for quality control of step tracking data.

retrack.py enables retracking of a video clip, but leaves existing step timing data intact.

rotaZoomer.py is used by frameStepper.py to produce a new movie from a tracked clip, where the animal is continually oriented in the direction of motion, and the frame is cropped to only show the animal. This script was also used to produce the movies in S2 Movie.
runClip.py enables several of the tracking and step timing analysis steps to be done with one command.
walkaPalooza.py produces an animation simultaneously showing the stepping animal and the step timing data
Drug treatments
Drug treatments
Make 5 mL of control and drug solutions in 1% DMSO in Poland Spring Water.

Make fresh agarose-bottomed (2% w/v, e.g. 200 mg in 10 mL Poland Spring water) 50 mm Petri dishes. From a single stock of tardigrades, add 10-15 tardigrades to each new experimental dish. Selected tardigrades should be consistent in size and walking ability. Avoid tardigrades that are filled with eggs; their bellies often appear brown rather than green.

Fill each dish with 5 mL of control or drug solutions. Add 5 drops of fresh, concentrated Chlorococcus algae to each dish.

Work Cited
Work Cited