run_shell_script#

qx_utilities.processing.simple.run_shell_script(sinfo, options, overwrite=False, thread=0)#

run_shell_script [... processing options]

Run the specified script on every selected session from batch.txt file.

Parameters

--script (str):

The path to the script to be executed.

--batchfile (str, default ''):

The batch.txt file with all the sessions information.

--sessions (str, default ''):

A list of sessions to process.

--sessionsfolder (str, default '.'):

The path to the study/sessions folder.

--parsessions (int, default 1):

How many sessions to run in parallel.

--overwrite (str, default 'no'):

Whether to overwrite existing outputs (yes) or not (no).

--logfolder (str, default ''):

The path to the folder where runlogs and comlogs are to be stored, if other than default.

Notes

run_shell_script runs the specified script on every selected session from batch.txt file. It places the specified session specific information before running the script. The information to be added is to be referenced in the script using double curly braces: {{<key>}}. Specifically, the function loops through all the session specific information as well as all the processing parameters and places them into the script. If the information is not provided, the {{<key>}} will remain as is.

Example:

If batch.txt contains among others:

---
id: OP578
subject: OP578
dicom: /data/qx_study/sessions/OP578/dicom
raw_data: /data/qx_study/sessions/OP578/nii
hcp: /data/qx_study/sessions/OP578/hcp
group: control

If script.sh contains among others:

ls -l {{hcp}}/{{id}}/MNINonLinear
if [ "{{group}}" = "control" ]; then
    mkdir /data/tmp/{{id}}
    cp {{raw_data}}/*.nii.gz /data/tmp/{{id}}
fi
echo "{{nothing}}"

Before running the function will change that part of the script to:

ls -l /data/qx_study/sessions/OP578/hcp/OP578/MNINonLinear
if [ "control" = "control" ]; then
    mkdir /data/tmp/OP578
    cp /data/qx_study/sessions/OP578/nii/*.nii.gz /data/tmp/OP578
fi
echo "{{nothing}}"

Examples

qunex run_shell_script sessions=fcMRI/session_hcp.txt sessionsfolder=sessions \
      overwrite=no script=fcMRI/processdata.sh