Main content

Home

Menu

Loading wiki pages...

View
Wiki Version:
# Automated analysis of behavior in the platform-mediated avoidance procedure ## DeepLabCut First, you need a good working DeepLabCut (DLC) model. Follow the [protocol paper](https://www.nature.com/articles/s41596-019-0176-0) and [their documentation](https://deeplabcut.github.io/DeepLabCut/README.html). You can check our DLC model of platform-mediated avoidance videos [here](https://osf.io/ptd6u/). You can find some details of our settings (i.e., body parts, frames labeled) in the methods section of our paper (link once available) or in our configuration file from the shared DLC model. ## simBA Once you have analyzed your videos with DLC, you need to create a simBA project. You can check our settings by reading our methods section (add link paper) or by checking our configuration file of our SimBA project (add link). Note: if using our SimBA project copy-paste the videos from the DLC folder to the SimBA project. We wanted to avoid uploading them twice due to OSF project size constraints. You can follow instructions of simBA developers to get a working project [here](https://github.com/sgoldenlab/simba?tab=readme-ov-file). You can also try out our own freezing classifier (you can find it [here](https://osf.io/ptd6u/files/osfstorage/66e84d53ff2a434d524c0107)) with your data if you follow this [tutorial](https://github.com/sgoldenlab/simba/blob/master/docs/Scenario2.md). You will probably need some tweaking due to differences in setups and cameras. Follow the [ROI tutorial](https://github.com/sgoldenlab/simba/blob/master/docs/ROI_tutorial_new.md) to have an ROI of the platform and of the cue-light and also follow the cue light add-on [tutorial](https://github.com/sgoldenlab/simba/blob/master/docs/cue_light_tutorial.md). Note: we skip outlier correction because we feel that our pose estimation results are good enough (i.e., not jittery and not jumpy) and we obtained better results skipping it, but that may depend on your own data. Once you have the simBA project working correctly (check visualizations of your videos to confirm that avoidance and freezing measurements make sense), load your own project and you will need to obtain the following output files to run our code: - **Avoidance**: Click on ROI -\> Analyze ROI data: Aggregates. Use these settings: - Select number of animals: 1 - Body-part 1: centroid (i.e. center of the animal) - Probability theshold: 0.0 - Tick save detailed ROI bout data. Important as this is the file we will use. - Click run Note: in our case we choose the center of the animal as we have a top view of the rat and in our manual labeling, avoidance was defined as at least two paws and the center of mass of the animal on the platform. - Copy the Detailed_ROI_data_date.csv file in the logs folder of simBA in your R working directory. - **Darting:** Click on ROI -\> Other analyses/visualizations: Analyze distances/velocity: Time-bins. Use these settings: - Select number of animals: 1 - Body-part 1: centroid - Time-bin size (s): 1 s Note: you could choose another body part if you wanted, for us the nose often is occluded when the rat has the head in the magazine so we wanted to avoid that. - Copy the Time_bins_1.0s_movement_results_date.csv file in the logs folder of simBA in your R working directory (not the entry data). - **Freezing**: Click on Run machine model -\> Model settings - Select your own classifier (.sav) file, your desired discrimination threshold and minimum bout length and click on set model. We use 0.65 as threshold and 500 ms as minimum bout. - Click on Run Models. - In your simBA project folder, go to csv folder, then to the machine results folder and copy all the files into your R working directory inside a folder named "classifications". - After that, go to add-ons, click on cue light analysis. Select 1 as number of cue lights, and the ROI corresponding to your cue light. Click on analyze cue light data. - In your simBA project folder, go to csv folder, then to the cue_lights folder and copy all the files into your R working directory inside a folder named "cues". Now you have all the files needed to use our code. ## Running our code We shared our own data used to calculate ICC for avoidance and freezing behavior in OSF so you can try it out first with our files if you wish, but it should work with your own files as well. It is very important to have the same folder structure than ours, including the .R files and data files in the correct folders to make the code work correctly without further edits. ![enter image description here][1] 1. Download the "Merge data" folder, there you will find the cues and classification folders with our own data (put yours there if you use your own files). 2. Run the code in Merge_cues_freezing.R file to obtain the output files. This code just merges the machine_results and cue_light results. This is important for us because with the cues we can identify when a CS starts. Note: we have different onsets of the CS depending on the training date so they do not come at the same exact minute and second, thus, the cue lights setting is important for this experiment. Soon we will share an alternative approach that does not need the cue light add-on. 3. Copy the files in the output folder of "Merge data" to the input folder of "Intervals". 4. Run the freezing_intervals.R code from "Intervals" folder. Note: this code is important to find out where the CSs took place in the video. In our case, a time interval is detected as a CS if the light column has a value of 1 for 59 to 61 frames in a row. This is because we programmed our operant boxes to shine cue light to for 2 s upon CS onset. The cue-light add-on in simBA has the limitation that if the rat goes in front of the cue light ROI it will be detected as if the light would be on due to the pixel change. In our case setting this constraint already helps a lot with the false positives. We also identify 1 minute before the CS as preCS and 1 minute postCS as postCS. After this, you obtain an excel file named Trial_freezing.csv. It is important to inspect this file in case false-positives could arise (10 CS instead of 9 CS), in our case we double check with the videos in case of doubts. 5. You will have obtained a Trial_freezing.csv file. Here you have extracted the freezing data during CS, preCS and postCS. Now you have a clean dataset to perform statistical analyses of freezing. 6. Using Trial_freezing.csv will be useful to further analyze avoidance and darting data. Copy the Trial_freezing.csv file to the folder were you have Detailed_ROI_data_date.csv file obtained from simBA. In that same folder, run the Avoidance_processing.R script. It uses the information of the intervals that we extracted previously and checks for overlaps with the detailed ROI data and finally produces a similar csv file but with the avoidance information. 7. Run the Darting_processing.R file in the same folder where Time_bins_1.0s_movement_results_date.csv and Trials_freezing.csv are located, since we will use the later to detect the CS. After running the code, it checks for overlaps between the time bins (in this case is the same as seconds as we set them to 1) and the CS start and end. Afterwards you have a clean dataset where you can analyze darting behavior. We thank Mathijs Franssen for assistance in writing freezing_interval.R script. If you have questions, feel free to reach out at: albalopezmoraga\@gmail.com. [1]: http://mfr.osf.io/export?url=https://osf.io/download/pt3we/?direct=&mode=render&format=2400x2400.jpeg
OSF does not support the use of Internet Explorer. For optimal performance, please switch to another browser.
Accept
This website relies on cookies to help provide a better user experience. By clicking Accept or continuing to use the site, you agree. For more information, see our Privacy Policy and information on cookie use.
Accept
×

Start managing your projects on the OSF today.

Free and easy to use, the Open Science Framework supports the entire research lifecycle: planning, execution, reporting, archiving, and discovery.