Kinovea tracking guide and distance calculation R script

Simon Benmaamar

Published: 2021-11-14 DOI: 10.17504/protocols.io.bz3ip8ke

Abstract

This protocol can be used to determine the travelled distances of larvae on a black-stained agar plate. For this purpose, videos of the moving animals are recorded, the movement is then tracked using the Kinovea program and the resulting files are evaluated using an R script.

Steps

Kinovea tracking guide

1.

Start Kinovea program.1. Import video by clicking on File -> Open Video File.

  1. Set time format: Options -> Time markers format -> Total milliseconds.
  2. To express distance in real life units add a line with the diagonal length of the black agar, then right click on the line -> Calibrate measure -> Change Real size of the segment to 8.5 cm (diameter of the agar plate).
  3. For tracking the object: Right click in the middle of the larva -> Track path.
  4. Start tracking by clicking on play.
  5. If the tracking was misplaced go to the image corresponding to the misplaced point, then right click the path -> Restart Path Edition and adjust the point location. After editing the tracking, click on End Path Edition.
  6. Safe trajectories by clicking on File -> Export to Spreadsheet -> Trajectories to simple text

More information about the program can be obtained at the Kinovea website (https://www.kinovea.org/help/en/109.html).

R script guide

2.

Analyse larval movement of a single group (Calculate_Distance.R)

  1. Safe your text files from the Kinovea tracking program in folders referring to the Experiment and Fly Group (for example “Starved” -> “ForR”).

  2. Open the Calculate_Distance.R script in R studio.

  3. Make sure the required libraries are installed.

  4. Set working directory by changing setwd to the file path where your folders are stored.

  5. Change Experiment to the name of the experiment (= name of the Experiment folder, for example “Starved”) and Group to the fly group (= name of Group folder in the Experiment folder, for example “ForR”) you want to evaluate. If you have no subfolders in the Experiment-folder you need to adjust the code.

  6. Run the script -> A csv-file is generated containing information about the name of the Experiment and Group, the distances in cm of each larva and the time of the first movement of each larva. To adjust where this file should be stored change setwd above the write.csv function to your desired file path.

  7. The plotted trajectories containing information about the name of the text file and the calculated distance can now be checked for each file.

  8. You can also check the bar plots of mean distance and mean time of first movement.

3.

Compare larval movement data of different groups (Compare_Distances.R)

  1. Store the csv-files from the previous script in a folder where the same experimental groups are in the same folder (for example “Starved” folder contains the csv files of “Starved_ForR” and “Starved_ForS”).
  2. Open the Compare_Distances.R script in R studio
  3. Make sure the required libraries are installed.
  4. Set working directory by changing setwd to the file path where your folder containing the different experimental groups is stored
  5. Run the script.

Both R scripts are available at “https://github.com/SimonBnm/Kinovea-Trajectories-Evaluation”.

推荐阅读

Nature Protocols
Protocols IO
Current Protocols
扫码咨询