An R-based pipeline for analyzing Open Field Test (OFT) behavioral data from DeepLabCut tracking output.
- DLCAnalyzer_Functions_final.R - Core DLCAnalyzer functions (download from ETHZ-INS/DLCAnalyzer)
- OFT_Analysis_Pipeline.R - Main analysis functions
- OFT_Main.R - Configuration and execution script
1. Place `DLCAnalyzer_Functions_final.R` in your R code directory
2. Update file paths in `OFT_Main.R`:
```r
source("path/to/DLCAnalyzer_Functions_final.R")
source("path/to/OFT_Analysis_Pipeline.R")
setwd("path/to/your/data")
Working Directory/
├── filtered_csv/ # DLC output files (*_filtered.csv)
└── Annotation/ # Arena corner annotations
├── Subject1/
│ └── Subject1_annotation.csv
└── Subject2/
└── Subject2_annotation.csv
Working Directory/
├── tracking_csv/ # Merged tracking files
│ └── *_tracking.csv
└── OFT_Results/
├── Results/ # Individual CSV results
├── Plots/ # Trajectory heatmaps
├── Temporal/ # Per-minute analysis
└── Combined_Results.csv
source("OFT_Main.R")
results <- run_analysis()Main output file containing all behavioral metrics:
- Locomotion: Total distance, speed, movement time
- Zone metrics: Time, distance, and transitions for each zone
Density heatmaps showing spatial occupancy with zone boundaries
Per-minute breakdown of distance traveled and zone occupancy
The Combined_Results.csv file contains comprehensive behavioral metrics from the Open Field Test analysis. Each row represents one subject/video file.
- ID: Subject/file identifier (extracted from filename)
- Duration_min: Total recording duration in minutes
- Total_Distance_cm: Total distance traveled during the entire session (cm)
- Distance_Moving_cm: Distance traveled only during movement periods (cm)
- Average_Speed_cm_s: Mean speed across entire session including stationary periods (cm/s)
- Speed_Moving_cm_s: Mean speed calculated only during movement periods (cm/s)
- Time_Moving_s: Total time spent in motion (seconds)
- Time_Stationary_s: Total time spent stationary/immobile (seconds)
- Percent_Moving: Percentage of session time spent moving (%)
The center zone typically represents 36% of the arena area (60% × 60% of dimensions)
- Center_Time_s: Total time spent in the center zone (seconds)
- Center_Distance_cm: Distance traveled within the center zone (cm)
- Center_Transitions: Number of entries into the center zone (count)
- Center_Percent: Percentage of total time spent in center zone (%)
The periphery is the outer ring of the arena, excluding corners
- Periphery_Time_s: Total time spent in the periphery zone (seconds)
- Periphery_Distance_cm: Distance traveled within the periphery zone (cm)
- Periphery_Transitions: Number of entries into the periphery zone (count)
- Periphery_Percent: Percentage of total time spent in periphery zone (%)
The four corner regions of the arena
- Corners_Time_s: Total time spent in all corner zones combined (seconds)
- Corners_Distance_cm: Distance traveled within corner zones (cm)
- Corners_Transitions: Number of entries into corner zones (count)
- Corners_Percent: Percentage of total time spent in corners (%)
- Center_Periphery_Ratio: Ratio of center time to periphery time (higher = less anxious behavior)
- Thigmotaxis_Index: Wall-hugging behavior index; periphery time/(center + periphery time) (0-1 scale; higher = more thigmotactic/anxious behavior)
These metrics are calculated based on your config settings:
- movement_cutoff: Threshold for determining movement vs. stationary (default: 3 cm/s)
- center_scale: Size of center zone (default: 0.6 = 60% of arena width/height)
- periphery_scale: Size of periphery boundary (default: 0.8)
- corner_scale: Size of corner zones (default: 0.25)
- OFT Analysis Pipeline (this repository): MIT License
- Required dependency (DLCAnalyzer): GPL-3.0 License
If you use this pipeline, please cite:
- DeepLabCut: Mathis et al. (2018)
- DLCAnalyzer