-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPP_submit_sbatch_rrot_2.sh
executable file
·96 lines (57 loc) · 1.67 KB
/
PP_submit_sbatch_rrot_2.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
87
#!/bin/bash
# written by Nathan Muncy on 8/11/17
workDir=~/compute/PreProc_Methods
slurmDir=${workDir}/Slurm_out
tempDir=${workDir}/Template
scriptDir=${workDir}/Scripts
time=`date '+%Y_%m_%d-%H_%M_%S'`
outDir=${slurmDir}/acpc_$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
origDir=${runDir}/${j}/orig
acpcDir=${runDir}/${j}/acpc
cp ${origDir}/struct_orig.nii.gz $acpcDir
cd $acpcDir
if [ ! -f struct_acpc.nii.gz ]; then
sbatch \
-o ${outDir}/output_${i}_${j}_acpc.txt \
-e ${outDir}/error_${i}_${j}_acpc.txt \
${scriptDir}/sbatch_acpc_2.sh $acpcDir $tempDir
sleep 1
fi
cd $runDir
else
subjDir=${runDir}/${j}
cd $j
for k in ${scanList[@]}; do
getDir=${subjDir}/orig/$k
putDir=${subjDir}/acpc/$k
cp ${getDir}/struct_orig.nii.gz $putDir
cd $putDir
if [ ! -f struct_acpc.nii.gz ]; then
sbatch \
-o ${outDir}/output_${i}_${j}_${k}_acpc.txt \
-e ${outDir}/error_${i}_${j}_${k}_acpc.txt \
${scriptDir}/sbatch_acpc_2.sh $putDir $tempDir
sleep 1
fi
cd $subjDir
done
cd $runDir
fi
done
cd $workDir
done