-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChromOptimise.sh
172 lines (144 loc) · 5.24 KB
/
ChromOptimise.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
## ========= ##
## SETUP ##
## ========= ##
usage() {
cat << EOF
================================================================================
$(basename "$0")
================================================================================
Purpose: Runs the ChromOptimise pipeline using the specified configuration files
Author: Sam Fletcher
Contact: s.o.fletcher@exeter.ac.uk
Inputs:
\$1 -> Full/relative file path for configuation file directory
================================================================================
EOF
exit 0
}
if [[ $# -ne 1 ]]; then usage; fi
configuration_directory=$1
source "${configuration_directory}/Config.txt" || \
{ echo "The configuration file does not exist in the specified location: \
${configuration_directory}/Config.txt"; exit 1; }
# We need an associative array to store the job ids for each SLURM job
# that are submitted. This is so that we can use these job ids as dependencies.
# Dependencies allow us to queue up job submissions and run certain scripts
# in parallel whenever required
declare -A jobID
## ===================== ##
## RUN CHROMOPTIMISE ##
## ===================== ##
## ------------------------------------------------------------------------- ##
if [[ "${STARTING_SCRIPT}" -eq 1 ]]; then
jobID[binarization]=$( \
sbatch \
--time="${MAXTIME_1}" \
"${JOBSUBMISSION_DIR}/1_BinarizeFiles.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 1_BinarizeFiles.sh under job ID:"
echo "${jobID[binarization]}"
fi
## ------------------------------------------------------------------------- ##
## ------------------------------------------------------------------------- ##
if [[ "${STARTING_SCRIPT}" -eq 2 ]]; then
jobID[Model_Learning]=$( \
sbatch \
--time="${MAXTIME_2}" \
--array=1-"${MODEL_LEARNING_ARRAY_SIZE}" \
--mem=$((MODEL_LEARNING_ARRAY_SIZE * 4))G \
"${JOBSUBMISSION_DIR}/2_batch_CreateIncrementalModels.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 2_batch_CreateIncrementalModels.sh under job ID:"
echo "${jobID[Model_Learning]}"
elif [[ "${STARTING_SCRIPT}" -lt 2 ]]; then
jobID[Model_Learning]=$( \
sbatch \
--time="${MAXTIME_2}" \
--array=1-"${MODEL_LEARNING_ARRAY_SIZE}" \
--mem=$((MODEL_LEARNING_ARRAY_SIZE * 4))G \
--dependency=afterok:"${jobID[binarization]}" \
"${JOBSUBMISSION_DIR}/2_batch_CreateIncrementalModels.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 2_batch_CreateIncrementalModels.sh under job ID:"
echo "${jobID[Model_Learning]}"
fi
## ------------------------------------------------------------------------- ##
## ------------------------------------------------------------------------- ##
if [[ "${STARTING_SCRIPT}" -eq 3 ]]; then
jobID[Optimal_States]=$( \
sbatch \
--time="${MAXTIME_3}" \
"${JOBSUBMISSION_DIR}/3_OptimalNumberOfStates.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 3_OptimalNumberOfStates.sh under job ID:"
echo "${jobID[Optimal_States]}"
elif [[ "${STARTING_SCRIPT}" -lt 3 ]]; then
jobID[Optimal_States]=$( \
sbatch \
--time="${MAXTIME_3}" \
--dependency=afterok:"${jobID[Model_Learning]}" \
"${JOBSUBMISSION_DIR}/3_OptimalNumberOfStates.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 3_OptimalNumberOfStates.sh under job ID:"
echo "${jobID[Optimal_States]}"
fi
## ------------------------------------------------------------------------- ##
## ------------------------------------------------------------------------- ##
if [[ "${STARTING_SCRIPT}" -eq 4 ]]; then
jobID[LDSC]=$( \
sbatch \
--time="${MAXTIME_4}" \
"${JOBSUBMISSION_DIR}/4_ReferenceLDSCore.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 4_ReferenceLDSCore.sh under job ID:"
echo "${jobID[LDSC]}"
elif [[ "${STARTING_SCRIPT}" -lt 4 ]]; then
jobID[LDSC]=$( \
sbatch \
--time="${MAXTIME_4}" \
--dependency=afterok:"${jobID[Optimal_States]}" \
"${JOBSUBMISSION_DIR}/4_ReferenceLDSCore.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 4_ReferenceLDSCore.sh under job ID:"
echo "${jobID[LDSC]}"
fi
## ------------------------------------------------------------------------- ##
## ------------------------------------------------------------------------- ##
if [[ "${STARTING_SCRIPT}" -eq 5 ]]; then
jobID[Heritability]=$( \
sbatch \
--time="${MAXTIME_5}" \
"${JOBSUBMISSION_DIR}/5_PartitionedHeritability.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 5_PartitionedHeritability.sh under job ID:"
echo "${jobID[Heritability]}"
elif [[ "${STARTING_SCRIPT}" -lt 5 ]]; then
jobID[Heritability]=$( \
sbatch \
--time="${MAXTIME_5}" \
--dependency=afterok:"${jobID[LDSC]}" \
"${JOBSUBMISSION_DIR}/5_PartitionedHeritability.sh" \
"${configuration_directory}" | \
awk '{print $4}' \
)
echo "Submitted 5_PartitionedHeritability.sh under job ID:"
echo "${jobID[Heritability]}"
fi
## ------------------------------------------------------------------------- ##