CoBrALab / cobra-nmf

Collection of scripts for formatting vertex and/or voxel data into matrix format
5 stars 3 forks source link

Add args for user-specified metric input file name strings, variables to residualize splits for #15

Closed alyssadai closed 2 years ago

alyssadai commented 2 years ago

Added optional --output_suffix argument in extract_metrics.py (accepts a string) and --residfor argument in define_splits.py (accepts a list).

Users now have more flexibility in naming the single-metric input files (addresses #14), and can run stability analyses where the vertex input in splits are residualized for specified variables from the demographics sheet.

raihaan commented 2 years ago

Thanks for the changes. In https://github.com/CoBrALab/cobra-nmf/pull/15/commits/7da36ae70342e9b57ab5bf9e9182b727f294af2f, can you walk me through whats happening in line 147?

resid_vars_a = resid_vars[Asplits_indices[str(split)],:]; resid_vars_b = resid_vars[Bsplits_indices[str(split)],:]

following the code i thought resid_vars is, at this point, a list containing the variables to residualize for, but its being indexed above more like it contains data for each subject? Assuming i'm missing something, lemme know.

alyssadai commented 2 years ago

Nope, you're right, that's an error on my part. I had the names of residualized variables hard coded in my original copy of the script, and accidentally got rid of the variable storing the corresponding columns from the demographics file when switching to the command-line argument. Should be fixed in https://github.com/CoBrALab/cobra-nmf/pull/15/commits/99c9110ae8baa168cba87dea8655a6dfb1629e28. Thanks for catching that!