unravel.utilities.prepend_conditions module#

Use utils_prepend from UNRAVEL to prepend conditions to filenames based on a CSV key.

Note

  • This command renames files in the current directory based on the conditions specified in the CSV file.

  • The sample_key.csv should have two columns: ‘dir_name’ and ‘condition’.

  • The command will prepend the ‘condition’ to the filenames matching the ‘dir_name’ prefix.

  • If needed, files and/or folders can be renamed with utils_rename.

For example, if the CSV contains the following rows:

dir_name,condition sample01,control sample02,treatment

Files will be renamed as follows:

‘sample01_file.csv’ –> ‘control_sample01_file.csv’ ‘sample02_file.csv’ –> ‘treatment_sample02_file.csv’.

Next commands for voxel-wise stats:
  • Check images in FSLeyes and run vstats to perform voxel-wise stats.

Usage for files:#

utils_prepend -sk <path/sample_key.csv> -f [–recursive] [-v]

Usage for directories:#

utils_prepend -sk <path/sample_key.csv> -d [–recursive] [-v]

unravel.utilities.prepend_conditions.parse_args()[source]#
unravel.utilities.prepend_conditions.rename_items(base_path, dir_name, condition, rename_files, rename_dirs, recursive)[source]#
unravel.utilities.prepend_conditions.prepend_conditions(base_path, csv_file, rename_files, rename_dirs, recursive)[source]#
unravel.utilities.prepend_conditions.main()[source]#