This shows you the differences between two versions of the page.
biac:cluster:examples:bet [2017/07/31 18:11] cmp12 |
biac:cluster:examples:bet [2023/02/23 18:43] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== BET Example Cluster Script ====== | ||
- | The script below will run FSL's BET (brain extraction tool) on any MR image, provided it is in an image format that FSL can read. | ||
- | |||
- | ===== qsub_fsl_bet ===== | ||
- | Example usage: | ||
- | < | ||
- | [user@head ~]$ qsub -v EXPERIMENT=Dummy.01 qsub_fsl_bet EXPERIMENT/ | ||
- | | ||
- | </ | ||
- | |||
- | Copy and edit code below: | ||
- | <code bash> | ||
- | #!/bin/sh | ||
- | |||
- | # This is a BIAC template script for jobs on the cluster | ||
- | # You have to provide the Experiment on command line | ||
- | # when you submit the job the cluster. | ||
- | # | ||
- | # > qsub -v EXPERIMENT=Dummy.01 | ||
- | # | ||
- | # 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=`biacmount $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 -- | ||
- | # User script goes here | ||
- | |||
- | # Need to input global EXPERIMENT, and inputs INFILE, OUTDIR, and OUTPRE | ||
- | # INFILE is the file path and name of the file to process | ||
- | # OUTDIR is where the output folder will go | ||
- | # OUTPRE is the output prefix of the file | ||
- | # Example: | ||
- | # EXPERIMENT/ | ||
- | # EXPERIMENT/ | ||
- | |||
- | INFILE=$1 | ||
- | OUTDIR=$2 | ||
- | OUTPRE=$3 | ||
- | |||
- | # In this bash syntax, the preceding string " | ||
- | # from the string $INFILE. | ||
- | # Example: | ||
- | # If INFILE = EXPERIMENT/ | ||
- | # running ${INFILE# | ||
- | # / | ||
- | |||
- | INFILE=${EXPERIMENT}${INFILE# | ||
- | OUTDIR=${EXPERIMENT}${OUTDIR# | ||
- | BETVALUE=0.05 | ||
- | |||
- | mkdir -p $OUTDIR | ||
- | echo "bet $INFILE $OUTDIR/ | ||
- | bet $INFILE $OUTDIR/ | ||
- | |||
- | |||
- | # -- END USER SCRIPT -- # | ||
- | |||
- | # ********************************************************** | ||
- | # -- BEGIN POST-USER -- | ||
- | echo " | ||
- | OUTDIR=${OUTDIR: | ||
- | mv $HOME/ | ||
- | RETURNCODE=${RETURNCODE: | ||
- | exit $RETURNCODE | ||
- | fi | ||
- | # -- END POST USER-- | ||
- | |||
- | </ | ||