User Tools

Site Tools


biac:cluster:examples:runfree

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
biac:cluster:examples:runfree [2011/03/31 14:49]
127.0.0.1 external edit
biac:cluster:examples:runfree [2011/09/07 13:54]
petty [submitting runFREE.sh]
Line 7: Line 7:
 Example usage: Example usage:
 <code> <code>
-[user@head ~]$ qsub -v EXPERIMENT=Dummy.01 runFREE.sh 20071031_12345 300+[user@head ~]$ qsub -v EXPERIMENT=Dummy.01 RunFree.sh 20071031_12345 Data/Anat/20071031_12345/series300
 </code> </code>
  
- +<code bash RunFree.sh>
-Copy and edit script below: +
-<code bash>+
 #!/bin/sh #!/bin/sh
-  + 
-# This is a BIAC template script for jobs on the cluster +# This is a BIAC template script for running FreeSurfer reconstruction on the cluster 
-# You have to provide the Experiment on command line   +# You can use this script with no modification by entering the following command on 
-when you submit the job the cluster.+# the cluster head-node:
 # #
-# >  qsub -v EXPERIMENT=Dummy.01  script.sh args+# >  qsub -v EXPERIMENT=MyExperiment RunFree.sh SubjID SeriesDir 
 +# where: 
 +#     MyExperiment is your BIAC experiment name (eg. Expt.02) 
 +#     SubjID is the name you want to assign for this subject reconstruction 
 +#         (eg. 1234 or subj21) 
 +#     SeriesDir is the directory path to get to your anatomical DICOM images for the 
 +#        subject you want to reconstruct, within your MyExperiment directory 
 +#        (eg.  Data/Anat/20110101_12345/series300 )
 # #
-There are 2 USER sections +The job will create an output directory for this subject, within your MyExperiment 
 +#  directory  at: 
 +#        Analysis/freesurfer/SubjID 
 +
 +# 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 #  1. USER DIRECTIVE: If you want mail notifications when
-#     your job is completed or fails you need to set the +#     your job is completed or fails you need to set the
 #     correct email address. #     correct email address.
-                 +#
 #  2. USER SCRIPT: Add the user script in this section. #  2. USER SCRIPT: Add the user script in this section.
-#     Within this section you can access your experiment +#     Within this section you can access your experiment
 #     folder using $EXPERIMENT. All paths are relative to this variable #     folder using $EXPERIMENT. All paths are relative to this variable
 #     eg: $EXPERIMENT/Data $EXPERIMENT/Analysis #     eg: $EXPERIMENT/Data $EXPERIMENT/Analysis
Line 34: Line 46:
 #     To change this path, set the OUTDIR variable in this section #     To change this path, set the OUTDIR variable in this section
 #     to another location under your experiment folder #     to another location under your experiment folder
-#     eg: OUTDIR=$EXPERIMENT/Analysis/GridOut +#     eg: OUTDIR=$EXPERIMENT/Analysis/GridOut
 #     By default on successful completion the job will return 0 #     By default on successful completion the job will return 0
 #     If you need to set another return code, set the RETURNCODE #     If you need to set another return code, set the RETURNCODE
-#     variable in this section. To avoid conflict with system return +#     variable in this section. To avoid conflict with system return
 #     codes, set a RETURNCODE higher than 100. #     codes, set a RETURNCODE higher than 100.
 #     eg: RETURNCODE=110 #     eg: RETURNCODE=110
Line 44: Line 56:
 # The remaining sections are setup related and don't require # The remaining sections are setup related and don't require
 # modifications for most scripts. They are critical for access # modifications for most scripts. They are critical for access
-# to your data            +# to your data 
-  + 
-# --- BEGIN GLOBAL DIRECTIVE -- +# --- BEGIN GLOBAL DIRECTIVE --
 #$ -S /bin/sh #$ -S /bin/sh
 #$ -o $HOME/$JOB_NAME.$JOB_ID.out #$ -o $HOME/$JOB_NAME.$JOB_ID.out
 #$ -e $HOME/$JOB_NAME.$JOB_ID.out #$ -e $HOME/$JOB_NAME.$JOB_ID.out
 #$ -m ea #$ -m ea
-# -- END GLOBAL DIRECTIVE --  +# -- END GLOBAL DIRECTIVE -- 
- +
 # -- BEGIN PRE-USER -- # -- BEGIN PRE-USER --
-#Name of experiment whose data you want to access +#Name of experiment whose data you want to access
 EXPERIMENT=${EXPERIMENT:?"Experiment not provided"} EXPERIMENT=${EXPERIMENT:?"Experiment not provided"}
-  + 
-source /etc/biac_sge.sh +EXPERIMENT=`findexp $EXPERIMENT`
-  +
-EXPERIMENT=`biacmount $EXPERIMENT`+
 EXPERIMENT=${EXPERIMENT:?"Returned NULL Experiment"} EXPERIMENT=${EXPERIMENT:?"Returned NULL Experiment"}
- +
 if [ $EXPERIMENT = "ERROR" ] if [ $EXPERIMENT = "ERROR" ]
 then then
         exit 32         exit 32
-else +else
 #Timestamp #Timestamp
-echo "----JOB [$JOB_NAME.$JOB_ID] START [`date`] on HOST [$HOSTNAME]----" +echo "----JOB [$JOB_NAME.$JOB_ID] START [`date`] on HOST [$HOSTNAME]----"
 # -- END PRE-USER -- # -- END PRE-USER --
 # ********************************************************** # **********************************************************
- +
 # -- BEGIN USER DIRECTIVE -- # -- BEGIN USER DIRECTIVE --
 # Send notifications to the following address # Send notifications to the following address
 #$ -M user@somewhere.edu #$ -M user@somewhere.edu
- +
 # -- END USER DIRECTIVE -- # -- END USER DIRECTIVE --
- +
 # -- BEGIN USER SCRIPT -- # -- BEGIN USER SCRIPT --
  
 SUBJ=$1 SUBJ=$1
-SERIES=$2 +SERIESDIR=$2 
-RAWDIR=${EXPERIMENT}/Data/Anat/$SUBJ/series${SERIES}+RAWDIR=${EXPERIMENT}/${SERIESDIR}
 FREEOUT=${EXPERIMENT}/Analysis/freesurfer FREEOUT=${EXPERIMENT}/Analysis/freesurfer
-  + 
-mkdir -p $FREEOUT +#if out directory doesn't exist, then make it 
- +if [ ! -d "$FREEOUT" ]; then 
 +        mkdir -p $FREEOUT 
 +fi 
 + 
 +#if the fsaverage subject doesn't exist there, then copy it 
 +for freedirs in fsaverage lh.EC_average rh.EC_average; do 
 +        if [ ! -d "${FREEOUT}/${freedirs}" ]; then 
 +                cp -R $FREESURFER_HOME/subjects/${freedirs} $FREEOUT/ 
 +        fi 
 +done 
 export SUBJECTS_DIR=$FREEOUT export SUBJECTS_DIR=$FREEOUT
-  + 
-cd $SUBJECTS_DIR  +cd $SUBJECTS_DIR 
-recon-all -i $RAWDIR/*${SUBJ}_${SERIES}_01_00001.dcm -s $SUBJ +recon-all -i $RAWDIR/*_00001.dcm -s $SUBJ 
- +
 recon-all -autorecon-all -s $SUBJ recon-all -autorecon-all -s $SUBJ
- +
 # -- END USER SCRIPT -- # # -- END USER SCRIPT -- #
- +
 # ********************************************************** # **********************************************************
-# -- BEGIN POST-USER --  +# -- BEGIN POST-USER -- 
-echo "----JOB [$JOB_NAME.$JOB_ID] STOP [`date`]----" +echo "----JOB [$JOB_NAME.$JOB_ID] STOP [`date`]----"
 OUTDIR=${OUTDIR:-$EXPERIMENT/Analysis} OUTDIR=${OUTDIR:-$EXPERIMENT/Analysis}
-mv $HOME/$JOB_NAME.$JOB_ID.out $OUTDIR/$JOB_NAME.$JOB_ID.out     +mv $HOME/$JOB_NAME.$JOB_ID.out $OUTDIR/$JOB_NAME.$JOB_ID.out
 RETURNCODE=${RETURNCODE:-0} RETURNCODE=${RETURNCODE:-0}
 exit $RETURNCODE exit $RETURNCODE
 fi fi
-# -- END POST USER--  +# -- END POST USER--
 </code> </code>
 +
biac/cluster/examples/runfree.txt · Last modified: 2023/02/23 18:43 (external edit)