Analysis Module - DeNardoLab/BehaviorDEPOT GitHub Wiki
The BehaviorDEPOT Analysis Module reads in behavior footage and pose-tracking information and outputs structures containing information about a variety of metrics (e.g. velocity, point-point distances, angle info) as well as bout-wise and vectorized representations of any behaviors tracked. The Analysis Module can also perform analysis for particular behavioral tasks, such as Elevated Plus Maze and Open Field tasks. Additional ROIs can be added and analyzed as needed. Optional time-locked cue information can also be incorporated into the analysis.
For an extended description of the Analysis Module methodology, please our pre-print: https://www.biorxiv.org/content/10.1101/2021.06.20.449150v2
Using the Analysis Module
Formatting Data
The basic input for an analysis session is a video recording and a pose-tracking file.
Single session
Using the BehaviorDEPOT GUI, you can select any combination or tracking and pose files located anywhere on your computer.
Batch session
Individual sessions (Pose + Video sets) should be placed in individual folders and all placed into a single folder for analysis.
Pose Estimation Format (DLC Output)
Pose-tracking files should be generated from DeepLabCut (or similar software) and saved as either CSV (best) or H5 files.
Video Format
Video formats currently supported are MP4 and AVI.
Using the BehaviorDEPOT GUI
The BehaviorDEPOT GUI allows you to select classifiers to use, customize smoothing options, add spatial/temporal filters, and run single or batch analysis sessions with various plotting options. The GUI also gives easy access to BehaviorDEPOT's support functions including:
-Converting human annotations into BehaviorDEPOT (hB) format -Save/load settings in GUI -Open folder containing classifier files (useful when customizing or adding classifiers) -Inter-Rater Module -Data Exploration Module -Classifier Optimization Module -Classifier Validation Module
Running an Analysis Session
This section will demonstrate how to run a session in the Analysis Module:
-
After installation, launch BehaviorDEPOT from the App tab within Matlab.
-
Select which classifiers to use:
- Select classifiers by checking the 'Run' box beside each classifier.
- Certain classifiers have adjustable parameters. Select the 'Edit' checkbox to adjust those parameters before analysis.
- Default values for classifiers can be set in the 'P_' file corresponding to each classifier.
-
Set distance calibration (under 'Options')
- Calibration should be measured in pixels/centimeter and can be calculated using ImageJ. Open a frame from a video and measure out the pixel distance of a known dimension (e.g. arena length). Use that to calculate the pixel-to-centimeter ratio.
-
Select smoothing parameters (under 'Options')
- Tracking cutoff threshold: minimum likelihood value (from DLC pose estimation) to keep in analysis; frames with tracking likelihood below the selected threshold will be removed and interpolated.
- Smoothing method: method for smoothing pose-estimation data; lowess produces best results but slows analysis; 'moving' is a good alternative when speed is important.
- Smoothing span: integer representing the number of frames to use in smoothing window.
- Apply Hampel Correction: applies a basic hampel outlier correction to data before smoothing
-
(Optional) Enter number of custom ROIs to draw (in addition to classifier-based ROIs, e.g. Elevated Plus Maze, Open Field Test)
-
(Optional) Choose whether or not to filter based on frame-locked events
- Input for these is required to be a spreadsheet file (.csv, .xlsx), with each event as a row, the start frame in the first column, and the end frame in the second column.
- BATCH: cue files must be placed in folders along with pose-estimation and video files and include 'cue' in the filename.
-
Select plotting preferences
- ‘View Spatial Trajectory’ plots all the positions of the animal across the session.
- ‘View spatiotemporal trajectory’ plots position across time, color coding the location points.
- ‘View behavior location’ overlays a marker on the locations where behavior(s) of interest occurred.
-
Select single session or batch process
- Single session for analyzing one paired DLC output and video file.
- Batch process for analyzing multiple files with the same parameters.
-
Hit Start.
-
Follow the onscreen prompts to enter and customize your data. Depending on your settings:
- If doing ‘single session’, you will be prompted to use the directory browser to select the spreadsheet and video files for analysis.
- If doing ‘batch process’, you will be prompted to select the folder containing directories for analysis (see batch process instructions for data organization)
- You may be prompted by the GUI to draw and name ROIs or parts of the arena, depending on your settings.
- You will be prompted to select the body part corresponding to your custom named part.
- You may be prompted to select timestamp files containing the start and stop frames of temporal events, and then name those events.
-
Results will be saved in a new folder in the same directory as the data.
Batch Analysis
The required input structure for batch processing:
- Grandparent folder, which is selected for analysis.
- Parent folder 1 (Containing exclusively a single, matching pair of spreadsheet and video files)
- Parent folder 2 (same as above)
- Parent folder n (same as above)
A single event file can also be included, and must be indicated with ‘cue’ in the filename (eg myevents_cue.csv)