sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
272 stars 137 forks source link

reciprocal directionality between animals #2 #319

Closed charliev99 closed 5 months ago

charliev99 commented 5 months ago

Hello there! I've read in the previous issue that to analyze reciprocal directionality between animals is possible to utilize the "aggregate boolean conditional statistic". However, it is not possible for me to select the two conditions "animal_1 directs animal_2" and "animal_2 directs animal_1". I am allowed to select just the directionality between one animal and a specific ROI (ex. ROI animal_1 facing). Do I need to do something else before in order to be able to visualize the two conditions? Thanks for your time!!

image
sronilsson commented 5 months ago

Hey @charliev99!

Hi! Gotcha, yes, the columns you can see on the dropdowns, are boolean columns (columns that contain only 0 and 1s) that SimBA has identified in the files within the project_folder/csv/features_extracted directory. My guess is that inside your project, you do not have animal_1 facing animal 2 or animal_2 facing animal 1 columns, that’s why you can’t compute the thing that you want. So before we can compute conditional aggregate boolean statistics, we need to get the directionality data in that folder. There is a few ways to do it on top of my mind.

How to calculate the directionality statistics between animals, is documented HERE. Take a look at the documentation first before reading below so what I say makes sense:

i) You can check the CREATE BOOLEAN TABLES checkbox, which gives you a folder with CSV files in the logs directory, with one CSV file for each file file inside your project_folder/csv/outlier_corrected_movement_location directory. These files will contain the data you’re looking for, with each column representing the relationship between an animal and a body-part belonging to another animal, with a 1 of the body-part is within “line of sight” and 0 if it is not.

ii) Now, we need to get that data into the project_folder/csv/features_extracted directory, so that the conditional calculator can see it. You can do this in two ways.

You can check the APPEND BOOLEAN TABLES TO FEATURES checkbox and it will do it automatically. However, this assumes that you already have files in your project_folder/csv/features_extracted directory. It will also affect the number of features you have in any supervised classifier you may have, so you may not want to append it willy nilly.

Another alternative is to just check the CREATE BOOLEAN TABLES checkbox, then move those output files to the project_folder/csv/features_extracted folder (and move any other files away from that folder temporarily).

(iii) Now you can run the conditional calculator and you should see the directionality data in the dropdown.

Please let me know if any of this doesn’t make sense. Also, I am thinking it may be beneficial to select the input directory in the conditional boolean menu, so you don’t have to move files around and just select the folder in the logs directory immediately. Let me know if you think this could help.

charliev99 commented 5 months ago

It does totally makes sense and also it works! Thank you so much for your time!