-
Notifications
You must be signed in to change notification settings - Fork 1
/
PP_submit_sbatch_n4bc_3.sh
executable file
·95 lines (56 loc) · 1.63 KB
/
PP_submit_sbatch_n4bc_3.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# written by Nathan Muncy on 8/11/17
workDir=~/compute/PreProc_Methods
slurmDir=${workDir}/Slurm_out
scriptDir=${workDir}/Scripts
time=`date '+%Y_%m_%d-%H_%M_%S'`
outDir=${slurmDir}/n4bc_$time
mkdir -p $outDir
c=0; for i in Run{1..5}; do
runList[$c]=$i
let c=$[$c+1]
done
c=0; for i in scan{1..3}; do
scanList[$c]=$i
let c=$[$c+1]
done
cd $workDir
for i in ${runList[@]}; do
runDir=${workDir}/$i
cd $i
for j in s*; do
if [ $i != Run1 ]; then
acpcDir=${runDir}/${j}/acpc
n4bcDir=${runDir}/${j}/n4bc
cp ${acpcDir}/struct_acpc.nii.gz $n4bcDir
cd $n4bcDir
if [ ! -f struct_n4bc.nii.gz ]; then
sbatch \
-o ${outDir}/output_${i}_${j}_n4bc.txt \
-e ${outDir}/error_${i}_${j}_n4bc.txt \
${scriptDir}/sbatch_n4bc_3.sh $n4bcDir
sleep 1
fi
cd $runDir
else
subjDir=${runDir}/${j}
cd $j
for k in ${scanList[@]}; do
getDir=${subjDir}/acpc/$k
putDir=${subjDir}/n4bc/$k
cp ${getDir}/struct_acpc.nii.gz $putDir
cd $putDir
if [ ! -f struct_n4bc.nii.gz ]; then
sbatch \
-o ${outDir}/output_${i}_${j}_${k}_n4bc.txt \
-e ${outDir}/error_${i}_${j}_${k}_n4bc.txt \
${scriptDir}/sbatch_n4bc_3.sh $putDir
sleep 1
fi
cd $subjDir
done
cd $runDir
fi
done
cd $workDir
done