forked from kellyuw/STAR-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subject_setup.sh
68 lines (56 loc) · 1.63 KB
/
subject_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
#SBATCH --output=sub_setup_logs/%x_%j.out
#SBATCH --time=02-00:30:30
#SBATCH -n 1
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=4G
#SBATCH --partition=ncf
#SBATCH --account=mclaughlin_lab
set -axo pipefail
set +eu
module load Anaconda3/2019.10 python/3.7.7-fasrc01
module load centos6/0.0.1-fasrc01 ncf/1.0.0-fasrc01 dcm2niix/2019_09_04-ncf freesurfer/6.0.0-ncf fsl/6.0.2-ncf
CBS_ID=$1
ID=`echo $CBS_ID | awk -F "_" '{print $3$4}'`
SUBJECT=`echo $CBS_ID | awk -F "_" '{print "sub-"$3$4}'`
STAR_DIR="/mnt/stressdevlab/STAR"
STAR_SUB_DIR="${STAR_DIR}/${SUBJECT}"
SOURCE_SUB_DIR="${STAR_DIR}/sourcedata/${SUBJECT}"
cat << EOF
/**********************/
/* /
/* ${CBS_ID}
/*---------------------/
/**********************/
EOF
echo "Downloading and processing data for $SUBJECT"
#Activate py37
source activate star
set -eu
#Get scans from CBSCentral
echo "Downloading data from CBSCentral..."
python ${STAR_DIR}/derivatives/yaxil_dl.py ${CBS_ID}
#Run commands outputted from yaxildl
echo "Running commands generated by yaxil_dl.py..."
pushd ${SOURCE_SUB_DIR}
source ${SUBJECT}_conv_cmds.txt
#Copy files to subject directory
echo "Copying files to ${STAR_SUB_DIR}..."
mkdir -p ${STAR_SUB_DIR}
for d in func dwi anat; do
cp -r ${d}/ ${STAR_SUB_DIR}/
done
#Prep fmap files
echo "Prep fmap files..."
python ${STAR_DIR}/derivatives/prep_fmap.py ${SUBJECT}
#Move fmap files
echo "Moving fmap files..."
while read line ; do
eval $line
done < ${STAR_SUB_DIR}/fmap_cmds.txt
popd
echo "Running scripts in OnsetScripts/"
for pyfile in `ls OnsetScripts/*py`; do
echo "${pyfile} ${ID};"
python ${pyfile} ${ID};
done