This shows you the differences between two versions of the page.
biac:cluster:examples:runfree [2011/09/07 13:53] petty [submitting runFREE.sh] |
biac:cluster:examples:runfree [2023/02/23 18:43] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== runFREE.sh Example Script ====== | ||
- | The example script below will run freesurfer segmentation (using recon-all) on a hi-resolution anatomical series. | ||
- | |||
- | **NOTE**: | ||
- | |||
- | ===== submitting runFREE.sh ===== | ||
- | Example usage: | ||
- | < | ||
- | [user@head ~]$ qsub -v EXPERIMENT=Dummy.01 runFREE.sh 20071031_12345 300 | ||
- | </ | ||
- | |||
- | <code bash RunFree.sh> | ||
- | #!/bin/sh | ||
- | |||
- | # This is a BIAC template script for running FreeSurfer reconstruction on the cluster | ||
- | # You can use this script with no modification by entering the following command on | ||
- | # the cluster head-node: | ||
- | # | ||
- | # > qsub -v EXPERIMENT=MyExperiment RunFree.sh SubjID SeriesDir | ||
- | # where: | ||
- | # | ||
- | # | ||
- | # (eg. 1234 or subj21) | ||
- | # | ||
- | # subject you want to reconstruct, | ||
- | # (eg. Data/ | ||
- | # | ||
- | # The job will create an output directory for this subject, within your MyExperiment | ||
- | # directory | ||
- | # Analysis/ | ||
- | # | ||
- | # Note: The QSUB command will automatically insert your email address to notify you of job | ||
- | # status. | ||
- | # | ||
- | # If you want to modify this template script, there are 2 USER sections: | ||
- | # 1. USER DIRECTIVE: If you want mail notifications when | ||
- | # your job is completed or fails you need to set the | ||
- | # | ||
- | # | ||
- | # 2. USER SCRIPT: Add the user script in this section. | ||
- | # | ||
- | # | ||
- | # eg: $EXPERIMENT/ | ||
- | # By default all terminal output is routed to the " Analysis " | ||
- | # | ||
- | # To change this path, set the OUTDIR variable in this section | ||
- | # to another location under your experiment folder | ||
- | # eg: OUTDIR=$EXPERIMENT/ | ||
- | # By default on successful completion the job will return 0 | ||
- | # If you need to set another return code, set the RETURNCODE | ||
- | # | ||
- | # | ||
- | # eg: RETURNCODE=110 | ||
- | # | ||
- | # | ||
- | # The remaining sections are setup related and don't require | ||
- | # modifications for most scripts. They are critical for access | ||
- | # to your data | ||
- | |||
- | # --- BEGIN GLOBAL DIRECTIVE -- | ||
- | #$ -S /bin/sh | ||
- | #$ -o $HOME/ | ||
- | #$ -e $HOME/ | ||
- | #$ -m ea | ||
- | # -- END GLOBAL DIRECTIVE -- | ||
- | |||
- | # -- BEGIN PRE-USER -- | ||
- | #Name of experiment whose data you want to access | ||
- | EXPERIMENT=${EXPERIMENT:?" | ||
- | |||
- | EXPERIMENT=`findexp $EXPERIMENT` | ||
- | EXPERIMENT=${EXPERIMENT:?" | ||
- | |||
- | if [ $EXPERIMENT = " | ||
- | then | ||
- | exit 32 | ||
- | else | ||
- | #Timestamp | ||
- | echo " | ||
- | # -- END PRE-USER -- | ||
- | # ********************************************************** | ||
- | |||
- | # -- BEGIN USER DIRECTIVE -- | ||
- | # Send notifications to the following address | ||
- | #$ -M user@somewhere.edu | ||
- | |||
- | # -- END USER DIRECTIVE -- | ||
- | |||
- | # -- BEGIN USER SCRIPT -- | ||
- | |||
- | SUBJ=$1 | ||
- | SERIESDIR=$2 | ||
- | RAWDIR=${EXPERIMENT}/ | ||
- | FREEOUT=${EXPERIMENT}/ | ||
- | |||
- | #if out directory doesn' | ||
- | if [ ! -d " | ||
- | mkdir -p $FREEOUT | ||
- | fi | ||
- | |||
- | #if the fsaverage subject doesn' | ||
- | for freedirs in fsaverage lh.EC_average rh.EC_average; | ||
- | if [ ! -d " | ||
- | cp -R $FREESURFER_HOME/ | ||
- | fi | ||
- | done | ||
- | |||
- | export SUBJECTS_DIR=$FREEOUT | ||
- | |||
- | cd $SUBJECTS_DIR | ||
- | recon-all -i $RAWDIR/ | ||
- | |||
- | recon-all -autorecon-all -s $SUBJ | ||
- | |||
- | # -- END USER SCRIPT -- # | ||
- | |||
- | # ********************************************************** | ||
- | # -- BEGIN POST-USER -- | ||
- | echo " | ||
- | OUTDIR=${OUTDIR: | ||
- | mv $HOME/ | ||
- | RETURNCODE=${RETURNCODE: | ||
- | exit $RETURNCODE | ||
- | fi | ||
- | # -- END POST USER-- | ||
- | </ | ||