LINCellularNeuroscience/VAME

vame clustering applied to multiple animals or videos

Wulin-Tan opened this issue · 3 comments

Hi, VAME developers:
How do I apply vame clustering to multiple animals/videos? (assuming one video per animal)
thank you.
Wulin

Hi Wulin-Tan,

Here is a function that converts multi-animal DLC files and saves them as single animal csv's. You can then follow VAME steps as usual:

import pandas as pd
import numpy as np
import os
import glob
from pathlib import Path
def convert_multi_csv_to_individual_csv(csv_files_path):
csvs = sorted(glob.glob(os.path.join(csv_files_path, '.csv')))
for csv in csvs:
fname = pd.read_csv(csv, header=[0,1,2], index_col=0, skiprows=1)
individuals = fname.columns.get_level_values('individuals').unique()
for ind in individuals:
fname_temp = fname[ind]
fname_temp_path = os.path.splitext(csv)[0] + '_' + ind + '.csv'
fname_temp.to_csv(fname_temp_path, index=True, header=True)

@charithaomprakash @pavolbauer
Thanks. That helps a lot. how about multiple animals across conditions? like, 3 animals in test group VS 3 animals in control group.
Since this issue is already closed, I put it to a new one:
#103 (comment)

Wulin