To run a local gyrification index (LGI) for several runs in parallel


 * 1) !/bin/bash

mkdir $USER_SCRATCH/jobs
 * 1) Make a jobs directory in your scratch space to store all the job scripts and results

jobs=$USER_SCRATCH/jobs sub=PATH_TO_SUBJECTS_DIRECTORY
 * 1) Define some variables to be used later

for patient in `ls -1 $sub` do

SUBJECTS_DIR=PATH_TO_SUBJECTS_DIRECTORY

echo "#!/bin/bash
 * 1) $ -S /bin/bash
 * 2) $ -cwd
 * 3) $ -N recon-all-$patient
 * 4) Set the hard and soft run time limits (ex: 1hour/58 min)
 * 5) $ -l h_rt=36:00:00,s_rt=30:55:00,vf=3000M
 * 6) $ -j y
 * 7) $ -M YOUR_EMAIL_ADDRESS
 * 8) $ -m eas
 * 1) $ -m eas

module load matlab/R2012a module load freesurfer/freesurfer-5.3.0 SUBJECTS_DIR=PATH_TO_SUBJECTS_DIRECTORY recon-all -s $patient -localGI" >> $patient.job

qsub $patient.job done

You can copy the above script in your Jobs Directory in the scratch space and put appropriate value in place of YOUR_EMAIL_ADDRESS and PATH_TO_SUBJECTS_DIRECTORY

NOTE: For PATH_TO_SUBJECTS_DIRECTORY, give the full path.