Using the DeepLabCut pose data, running behavioral analysis with MotionMapper to extract behavior
Make sure you have a virtual environment setup before installing all dependencies. You can do this with either Anaconda(conda) or traditional Python(pip).
The overall analysis is broken up into 3 steps:
- Query trial data from DataJoint
- Run Behavioral Analysis (PostProcessing DLC and MotionMapper inference)
- Store analyzed data into its respective trial .mat files
All the parameters used throughout the process are contained in the config.yaml file. Use template_config.yaml as an example of what parameters to modify and understand what each does. Make a copy of the template_config.yaml file and modify this file instead of the template.
The initial step of the process is gathering all data from DataJoint and saving its contents into a CSV file. Note, this step can only be done on local Windows machines in the lab since we aren't able to open SSH tunnels on any SCC compute nodes.
Important parameters to set in your config file:
processing_folder
datajoint_credentials
only_run_datajoint
animal_list
.
How to run:
- Go to
<repo_directory>
python behavior_inference.py --config_file_name <name of your config file>.yaml
The script will go through each animal in your <animal_list>, create an animal folder for the specific animal in the <processing_folder> and create a CSV file called FOUND_TRIALS.csv with a list of file paths to all trial .mat files that belong to that animal.
The next step is running the behavioral analysis given the list of trials collected by the previous step. For improved speedup, we will use the SCC.
Important parameters to set in your config file:
processing_folder
post_processing_dlc_paths
post_processing_dlc_params
motion_mapper_version
motion_mapper_file_paths
motion_mapper_inference_params
animal_list
How to run on the SCC
- Log in to SCC
- Go to
<repo_directory>/scc
qsub run_behavior_job_array.sh <name of your config file>.yaml
How to run on Windows
- Go to
<repo_directory>
python behavior_inference.py --config_file_name <name of your config file>.yaml
This script will run the behavioral analysis for each animal in <animal_list> and save intermediate files (WAVELETS.mat, HEATMAP.png, etc...) in their respective animal folder throughout the analysis.
The final step is to use all the intermediate files generated to save the contents into each trial's respective .mat file.
Important parameters to set in your config file:
processing_folder
post_processing_dlc_paths
post_processing_dlc_params
motion_mapper_version
motion_mapper_file_paths
motion_mapper_inference_params
animal_list
How to run on the SCC
- Log in to SCC
- Go to
<repo_directory>/scc
qsub store_behavior_job_array.sh <name of your config file>.yaml
How to run on Windows
- Go to
<repo_directory>
python store_behavior_data.py --config_file_name <name of your config file>.yaml