This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
biac:cluster:examples:runfree [2011/03/31 14:49] 127.0.0.1 external edit |
biac:cluster:examples:runfree [2023/02/23 18:43] (current) |
||
---|---|---|---|
Line 7: | Line 7: | ||
Example usage: | Example usage: | ||
< | < | ||
- | [user@head ~]$ qsub -v EXPERIMENT=Dummy.01 | + | [user@head ~]$ qsub -v EXPERIMENT=Dummy.01 |
</ | </ | ||
- | + | <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 |
- | # You have to provide | + | # You can use this script with no modification by entering |
- | # when you submit the job the cluster. | + | # the cluster |
# | # | ||
- | # > qsub -v EXPERIMENT=Dummy.01 | + | # > qsub -v EXPERIMENT=MyExperiment RunFree.sh SubjID SeriesDir |
+ | # where: | ||
+ | # | ||
+ | # | ||
+ | # (eg. 1234 or subj21) | ||
+ | # | ||
+ | # subject you want to reconstruct, | ||
+ | # (eg. Data/ | ||
# | # | ||
- | # There are 2 USER sections | + | # 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 | # 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 |
# | # | ||
- | # | + | # |
# 2. USER SCRIPT: Add the user script in this section. | # 2. USER SCRIPT: Add the user script in this section. | ||
- | # | + | # |
# | # | ||
# eg: $EXPERIMENT/ | # eg: $EXPERIMENT/ | ||
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/ | + | # eg: OUTDIR=$EXPERIMENT/ |
# 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 | ||
- | # | + | # |
# | # | ||
# 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/ | #$ -o $HOME/ | ||
#$ -e $HOME/ | #$ -e $HOME/ | ||
#$ -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=${EXPERIMENT:?" | ||
- | + | ||
- | source / | + | EXPERIMENT=`findexp |
- | + | ||
- | EXPERIMENT=`biacmount | + | |
EXPERIMENT=${EXPERIMENT:?" | EXPERIMENT=${EXPERIMENT:?" | ||
- | + | ||
if [ $EXPERIMENT = " | if [ $EXPERIMENT = " | ||
then | then | ||
exit 32 | exit 32 | ||
- | else | + | else |
#Timestamp | #Timestamp | ||
- | echo " | + | echo " |
# -- 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}/ | + | RAWDIR=${EXPERIMENT}/ |
FREEOUT=${EXPERIMENT}/ | FREEOUT=${EXPERIMENT}/ | ||
- | + | ||
- | mkdir -p $FREEOUT | + | #if out directory doesn' |
- | + | if [ ! -d " | |
+ | | ||
+ | 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 | 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 " | + | echo " |
OUTDIR=${OUTDIR: | OUTDIR=${OUTDIR: | ||
- | mv $HOME/ | + | mv $HOME/ |
RETURNCODE=${RETURNCODE: | RETURNCODE=${RETURNCODE: | ||
exit $RETURNCODE | exit $RETURNCODE | ||
fi | fi | ||
- | # -- END POST USER-- | + | # -- END POST USER-- |
</ | </ | ||
+ |