-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq2pipe_fullauto.sh
executable file
·264 lines (232 loc) · 7.72 KB
/
q2pipe_fullauto.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#!/bin/bash
################################
# #
# Qiime 2 Pipeline #
# By: Patrick Gagne (NRCan) #
# "Full Auto" mode #
# October 21, 2021 #
# #
################################
# This script is designed to launch a full analysis without any user interaction
exit_on_error(){
echo "Step error detected"
echo "Exiting program"
exit 1
}
optionfile=$1
override_value=$2
if [ ! $override_value ]
then
override_value=0
fi
if [ ! $optionfile ] || [ ! -e $optionfile ] || [ ! -r $optionfile ]
then
echo "ERROR: you must specify a valid, accessible qiime2 optionfile"
exit 1
fi
source $optionfile
if [ $TEMPORARY_DIRECTORY ]
then
echo "Overriding default temporary directory to $TEMPORARY_DIRECTORY"
if [ ! -d $TEMPORARY_DIRECTORY ] || [ ! -w $TEMPORARY_DIRECTORY ]
then
echo "ERROR: $TEMPORARY_DIRECTORY does not exist or is read only"
exit 2
fi
export TMPDIR=$TEMPORARY_DIRECTORY
fi
if [ ! $Q2P ]
then
echo "WARNING: Q2P environment variable not set"
echo "The fullauto mode requires this variable to work"
echo "Setting temporary Q2P variable"
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
export Q2P=$SCRIPT_DIR
fi
echo "Installation path: $Q2P"
invalid_next=0
if [ $override_value -gt 0 ]
then
invalid_next=1
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step1.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 1 ]
then
echo "Launching Step 1"
if [ -e $ANALYSIS_NAME.q2pipe_step1.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step1.DONE
fi
$Q2P/q2pipe_step1_import.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step1.DONE
invalid_next=1
else
echo "Step 1 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step2.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 2 ]
then
echo "Launching Step 2"
if [ -e $ANALYSIS_NAME.q2pipe_step2.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step2.DONE
fi
$Q2P/q2pipe_step2_denoise.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step2.DONE
invalid_next=1
else
echo "Step 2 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step2.5.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 2 ]
then
echo "Launching Step 2.5"
if [ -e $ANALYSIS_NAME.q2pipe_step2..5.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step2.5.DONE
fi
if [ -d $ANALYSIS_NAME.mergecheck ]
then
rm $ANALYSIS_NAME.mergecheck -rf
fi
$Q2P/q2pipe_step2.5_run_merging.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step2.5.DONE
invalid_next=1
else
echo "Step 2.5 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step3.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 3 ]
then
echo "Launching Step 3"
if [ -e $ANALYSIS_NAME.q2pipe_step3.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step3.DONE
fi
$Q2P/q2pipe_step3_feature_filtering.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step3.DONE
invalid_next=1
else
echo "Step 3 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step4.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 4 ]
then
echo "Launching Step 4"
if [ -e $ANALYSIS_NAME.q2pipe_step4.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step4.DONE
fi
$Q2P/q2pipe_step4_denovo_clustering.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step4.DONE
invalid_next=1
else
echo "Step 4 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step5.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 5 ]
then
echo "Launching Step 5"
if [ -e $ANALYSIS_NAME.q2pipe_step5.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step5.DONE
fi
$Q2P/q2pipe_step5_classifier_training.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step5.DONE
invalid_next=1
else
echo "Step 5 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step6.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 6 ]
then
echo "Launching Step 6"
if [ -e $ANALYSIS_NAME.q2pipe_step6.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step6.DONE
fi
$Q2P/q2pipe_step6_classification.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step6.DONE
invalid_next=1
else
echo "Step 6 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step7.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 7 ]
then
echo "Launching Step 7"
if [ -e $ANALYSIS_NAME.q2pipe_step7.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step7.DONE
fi
$Q2P/q2pipe_step7_taxa_filtering.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step7.DONE
invalid_next=1
else
echo "Step 7 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step8.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 8 ]
then
echo "Launching Step 8"
if [ -e $ANALYSIS_NAME.q2pipe_step8.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step8.DONE
fi
$Q2P/q2pipe_step8_rarefaction_curve.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step8.DONE
invalid_next=1
else
echo "Step 8 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step9.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 9 ]
then
echo "Launching Step 9"
if [ -e $ANALYSIS_NAME.q2pipe_step9.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step9.DONE
fi
$Q2P/q2pipe_step9_rarefy.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step9.DONE
invalid_next=1
else
echo "Step 9 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step10.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 10 ]
then
echo "Launching Step 10"
if [ -e $ANALYSIS_NAME.q2pipe_step10.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step10.DONE
fi
if [ -d "$ANALYSIS_NAME.metrics_norarefaction_dn$p_perc_identity" ] && [ "$SKIP_RAREFACTION" == "true" ] || [ "$SKIP_RAREFACTION" == "both" ]
then
rm "$ANALYSIS_NAME.metrics_norarefaction_dn$p_perc_identity" -rf
fi
if [ -d "$ANALYSIS_NAME.metrics_rarefied_"$p_sampling_depth"_dn"$p_perc_identity"" ] && [ "$SKIP_RAREFACTION" == "false" ] || [ "$SKIP_RAREFACTION" == "both" ]
then
rm "$ANALYSIS_NAME.metrics_rarefied_"$p_sampling_depth"_dn"$p_perc_identity"" -rf
fi
$Q2P/q2pipe_step10_metrics.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step10.DONE
invalid_next=1
else
echo "Step 10 checkpoint detected...skipping"
fi
if [ ! -e $ANALYSIS_NAME.q2pipe_step11.DONE ] || [ $invalid_next -eq 1 ] && [ $override_value -le 11 ]
then
echo "Launching Step 11"
if [ -e $ANALYSIS_NAME.q2pipe_step11.DONE ]
then
echo "Invalid checkpoint detected. Deleting..."
rm $ANALYSIS_NAME.q2pipe_step11.DONE
fi
$Q2P/q2pipe_step11_export.sh $optionfile || exit_on_error
touch $ANALYSIS_NAME.q2pipe_step11.DONE
invalid_next=1
else
echo "Step 11 checkpoint detected...skipping"
fi
echo "PROGRAM DONE"