Nov 14, 2021

Public workspaceKinovea tracking guide and distance calculation R script V.1

  • 1Universität Regensburg
  • Brembs Lab
Icon indicating open access to content
QR code linking to this content
Protocol CitationSimon Benmaamar 2021. Kinovea tracking guide and distance calculation R script. protocols.io https://dx.doi.org/10.17504/protocols.io.bz3ip8ke
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: November 14, 2021
Last Modified: November 14, 2021
Protocol Integer ID: 55114
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.
Kinovea tracking guide
Kinovea tracking guide
  1. Start Kinovea program.
  2. Import video by clicking on File -> Open Video File.
  3. Set time format: Options -> Time markers format -> Total milliseconds.
  4. 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).
  5. For tracking the object: Right click in the middle of the larva -> Track path.
  6. Start tracking by clicking on play.
  7. 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.
  8. 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
R script guide
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”).
  1. Open the Calculate_Distance.R script in R studio.
  2. Make sure the required libraries are installed.
  3. Set working directory by changing setwd to the file path where your folders are stored.
  4. 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.
  5. 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.
  6. The plotted trajectories containing information about the name of the text file and the calculated distance can now be checked for each file.
  7. You can also check the bar plots of mean distance and mean time of first movement.
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”.