Skip to content

flex_wrapper

Ekarin Eric Pongpipat edited this page Sep 12, 2024 · 4 revisions

Function that loops over a set of scripts and set of ids.

You will need to have a scripts text file and an IDs text file.

Example

1. Create scripts text file

/path/to/code/scripts.txt:

/path/to/pipeline-1/step-1.sh
/path/to/pipeline-1/step-2.sh
/path/to/pipeline-2/step-1.sh
/path/to/pipeline-2/step-2.sh

Note: One line for each script

2. Create an IDs csv file

/path/to/code/ids.csv:

study,sub,ses
ds001,001,01
ds001,001,02
ds001,002,01
ds001,002,02
ds001,003,01
ds001,003,02

Note: One line for each ID. Note that is is flexible and can work with any columns

Usage

You can run all of the scripts for each subject

flex_wrapper --in-scripts /path/to/code/scripts.txt --in-ids /path/to/code/ids.csv --scripts-idx all --ids-idx all

You can also run a subset of either the scripts or IDs by indexing the row to run, respectively

flex_wrapper --in-scripts /path/to/code/scripts.txt --in-ids /path/to/code/ids.csv --scripts-idx 1:2 --ids-idx 1,5

You can also use parallel engines

flex_wrapper --in-scripts /path/to/code/scripts.txt --in-ids /path/to/code/ids.csv --scripts-idx all --ids-idx all --pe slurm
Clone this wiki locally