-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpipeline_start.sh
200 lines (186 loc) · 4.1 KB
/
pipeline_start.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
#!/bin/bash
njobs=$1
flag=$2
start_script_path="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
apply_filter=0
previous_pwd=$PWD
cd $start_script_path
python3 "construct_parameters_python.py"
source "scripts/HELPERS/paths_for_components.py"
case "$flag" in
--create-reference) stage_index=1
;;
--snp-call) stage_index=2
;;
--peak-annotation) stage_index=3
;;
--bad-call) stage_index=4
;;
--nb-fit) stage_index=5
;;
--pvalue-count) stage_index=6
;;
--aggregate-pvalues) stage_index=7
;;
*)
echo "There is no option $2"
exit 0
;;
esac
if [ "$stage_index" -le 1 ]; then
if ! bash "$scripts_path/create_reference.sh" -RefFolder "$reference_path" -RefGenome "$genome_path"
then
echo 'Create reference failed'
exit 1
fi
if ! adastra badmaps_dict
then
echo 'BADmaps dict failed'
exit 1
fi
if ! adastra sort_cols
then
echo 'Sort columns failed'
exit 1
fi
if ! adastra init_dirs
then
echo 'Create directories failed'
exit 1
fi
if ! adastra aggregation_dict
then
echo 'Aggregation dict failed'
exit 1
fi
fi
if [ "$stage_index" -le 2 ]; then
if ! bash "$scripts_path/"snp_calling.sh "$njobs"
then
echo 'SNPcalling failed'
exit 1
fi
fi
if [ "$stage_index" -le 3 ]; then
if ! bash "$scripts_path/"annotation.sh "$njobs"
then
echo 'Peak annotation failed'
exit 1
fi
fi
if [ "$stage_index" -le 4 ]; then
if ! bash "$scripts_path"/bad_map_est.sh "$njobs" --merge
then
echo 'BAD estimation failed'
exit 1
fi
if ! bash "$scripts_path"/correlation_with_cosmic.sh "$njobs" --annotate
then
echo 'Correlation analysis failed'
exit 1
fi
if [ "$apply_filter" -eq 1 ]; then
if ! adastra create_badmaps_filter
then
echo 'BAD maps filter creation failed'
exit 1
fi
if ! adastra apply_badmaps_filter
then
echo 'BAD maps filter application failed'
exit 1
fi
if ! bash "$scripts_path"/bad_map_est.sh "$njobs" --merge --remake
then
echo 'BAD estimation failed (iteration 2)'
exit 1
fi
if ! bash "$scripts_path"/correlation_with_cosmic.sh "$njobs" --annotate --remake
then
echo 'Correlation analysis failed (iteration 2)'
exit 1
fi
if ! adastra create_badmaps_filter --remake
then
echo 'BAD maps filter creation failed (iteration 2)'
exit 1
fi
if ! adastra apply_badmaps_filter --remake
then
echo 'BAD maps filter application failed (iteration 2)'
exit 1
fi
if ! bash "$scripts_path"/BAD_annotation.sh "$njobs" --remade
then
echo 'BAD annotation failed'
exit 1
fi
else
if ! bash "$scripts_path"/BAD_annotation.sh "$njobs"
then
echo 'BAD annotation failed'
exit 1
fi
fi
fi
if [ "$stage_index" -le 5 ]; then
if [ "$apply_filter" -eq 1 ]; then
if ! adastra collect_ref_bias --remade
then
echo 'Collect statistics failed'
exit 1
fi
else
if ! adastra collect_ref_bias
then
echo 'Collect statistics failed'
exit 1
fi
fi
if ! adastra fit_neg_bin
then
echo 'Fit negative binom failed'
exit 1
fi
fi
if [ "$stage_index" -le 6 ]; then
if [ "$apply_filter" -eq 1 ]; then
if ! bash "$scripts_path"/p_value_count.sh "$njobs" --remade
then
echo 'P-value computation failed'
exit 1
fi
else
if ! bash "$scripts_path"/p_value_count.sh "$njobs"
then
echo 'P-value computation failed'
exit 1
fi
fi
fi
if [ "$stage_index" -le 7 ]; then
if [ "$apply_filter" -eq 1 ]; then
if ! bash "$scripts_path"/aggregation.sh "$njobs" --forTF --remade
then
echo 'TF aggregation failed'
exit 1
fi
if ! bash "$scripts_path"/aggregation.sh "$njobs" --forCL --remade
then
echo 'CL aggregation failed'
exit 1
fi
else
if ! bash "$scripts_path"/aggregation.sh "$njobs" --forTF
then
echo 'TF aggregation failed'
exit 1
fi
if ! bash "$scripts_path"/aggregation.sh "$njobs" --forCL
then
echo 'CL aggregation failed'
exit 1
fi
fi
fi
cd $previous_pwd