Chapter 22 Modified TBSS using ENGIMA
Non-FA ROI Analysis

22.1 Job Script

On the remote computer create script.

vi ~/scripts/ACAP/ENIMGA-tbss-nonFAroi.sh

Copy and paste.

#!/bin/bash

#SBATCH --time=02:00:00   # walltime
#SBATCH --ntasks=1   # number of processor cores (i.e. tasks)
#SBATCH --nodes=1   # number of nodes
#SBATCH --mem-per-cpu=12G  # memory per CPU core

# LOAD ENVIRONMENTAL VARIABLES
username=`id -un`
module load lib/openblas/0.2.20-gnu
module load fsl/6.0.0
export ANTSPATH=/home/${username}/apps/ants/bin/
PATH=${ANTSPATH}:${PATH}

# INSERT CODE, AND RUN YOUR PROGRAMS HERE
TBSS_DIR=/work/ashley.ware/data/ACAP/enigma/tbss/
 
for DIFF in MD AD RD
do
  mkdir -p ${TBSS_DIR}/ROI/part1/${DIFF}
  dir01=${TBSS_DIR}/ROI/part1/${DIFF}/
 
  mkdir -p ${TBSS_DIR}/ROI/part2/${DIFF}
  dir02=${TBSS_DIR}/ROI/part2/${DIFF}/
  
  for subjid in $(ls /work/ashley.ware/data/ACAP/enigma/tbss/FA-individ/); do
    
    ~/apps/ROIextraction_info/singleSubjROI_exe \
    ~/apps/ROIextraction_info/ENIGMA_look_up_table.txt \
    ~/apps/ROIextraction_info/mean_FA_skeleton.nii.gz \
    ~/apps/ROIextraction_info/JHU-WhiteMatter-labels-1mm.nii.gz \
    ${dir01}/${subjid}_ROIout \
    ${TBSS_DIR}/${DIFF}-individ/${subjid}/stats/${subjid}_masked_${DIFF}skel.nii.gz
  
    ~/apps/ROIextraction_info/averageSubjectTracts_exe \
    ${dir01}/${subjid}_ROIout.csv \
    ${dir02}/${subjid}_ROIout_avg.csv
  
    echo ${subjid},${dir02}/${subjid}_ROIout_avg.csv >> ${TBSS_DIR}/subjectList-${DIFF}.csv
  done

  cd ${TBSS_DIR}/${DIFF}/
  table=/work/ashley.ware/data/ACAP/enigma/tbss/table.csv
  subjectIDcol=participant_id
  subjectList=${TBSS_DIR}/subjectList-${DIFF}.csv
  outTable=${TBSS_DIR}/ROI/${DIFF}.csv
  Ncov=0
    covariates=""
    Nroi="all"
    rois="all"
 
  module load r
  R --no-save --slave --args ${table} ${subjectIDcol} ${subjectList} ${outTable} ${Ncov} ${covariates} ${Nroi} ${rois} <  ~/apps/ROIextraction_info/combine_subject_tables.R  
done

Submit script:

curTime=`date +"%Y%m%d-%H%M%S"`
mkdir -p ~/logfiles/ACAP/$curTime
sbatch \
-o ~/logfiles/ACAP/${curTime}/output.txt \
-e ~/logfiles/ACAP/${curTime}/error.txt \
~/scripts/ACAP/ENIMGA-tbss-nonFAroi.sh

22.2 Sync Data

rsync -rauv \
ashley.ware@arc.ucalgary.ca:/work/ashley.ware/data/ACAP/enigma/tbss/ \
/Volumes/bobo/data/ACAP/enigma/tbss/

Your results are located at /Volumes/bobo/data/ACAP/enigma/tbss/ROI/.