-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathseqfailr
executable file
·217 lines (188 loc) · 6.45 KB
/
seqfailr
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
#!/bin/bash
# === === === PARAMETERS === === ===
#
# You can modify the following values to adapt threshold used in analyses.
# Details of what these variables refer to, are available on github documentation
# - - - Error rate depending on quality scores - - -
err_qual_window_length=100
err_qual_max_aln_nb=200
err_qual_min_occ_read=2 #10
err_qual_min_occ_window=1000
# - - - Quality scores along raw reads - - -
qual_read_end_length=100
# - - - Relative coverage depending on GC content of reads - - -
cov_gc_window_size=100
cov_gc_min_bases=100
cov_gc_max_bases=10000
# - - - Error rate depending on GC content of reads - - -
err_gc_nb_max_aln=500
err_gc_min_occ_to_plot=100
# - - - Homopolymers - - -
homopolymer_min_length=2
homopolymer_max_length=12
homopolymer_nb_max_aln=-1
# - - - Heteropolymers - - -
heteropolymer_min_length=4
heteropolymer_max_length=14
# - - - Trinucleotides - - -
trinucleotides_min_length=6
trinucleotides_max_length=12
trinucleotides_threshold_occ=100
trinucleotides_nb_max_aln=100000
# === === === END OF PARAMETERS ZONE === === ===
# Parse command-line options
function show_usage (){
echo "Usage $0 <Mode> [Grouping_mode]"
echo ""
echo "Modes:"
echo "-h|--help, display this help"
echo "-i|--init, initialize: download needed extra algorithms, get data information for future analyses"
echo "-m|--map, align reads against their reference genome"
echo "-l|--low_complexity, analyses errors on low complextiy regions: hoompolymers, heteropolymers and trinucleotides"
echo " --homopolymers, analyses errors on homopolymeric regions"
echo " --heteropolymers, analyses errors for heteropolymer patterns"
echo " --trinucleotides, analyses errors for trinucleotides patterns"
echo "-q|--quality, computes quality scores along reads and errors rates depending on quality score"
echo "-g|--gc, computes coverage and error rates of reads depending on their GC content"
echo "-a|--all, run all these scripts"
echo ""
echo "Grouping modes (optionnal). Will only affect --init and --all Modes"
echo "--no_group, do not merge species and output distinct results for each species [default]"
echo "--group_all, merge all species in one single group"
echo "--group, to define custom groups"
return 0
}
if [[ $# -eq 0 ]];then
show_usage
exit 1
fi
if [[ $# -gt 2 ]];then
echo "WARNING: only one or two argument(s) expected, so only the two first ones will be processed"
echo "If you want to run run all analysis, please use '$0 --all' or '$0 -a'"
echo ""
fi
case "$1" in
-h | --help )
show_usage
;;
-i | --init )
mode=init
;;
-m | --map )
mode=mapping
;;
-l | --low_complexity )
mode=low_complexity
;;
--homopolymers )
mode=homopolymers
;;
--heteropolymers )
mode=heteropolymers
;;
--trinucleotides )
mode=trinucleotides
;;
-q | --quality )
mode=quality
;;
-g | --gc )
mode=gc
;;
-a | --all )
mode=all
;;
"")
show_usage
;;
*)
echo "Incorrect input provided"
show_usage
exit 1
;;
esac
case $2 in
--group_all )
group_mode=all
;;
--no_group )
group_mode=no
;;
--group )
group_mode=custom
;;
"" )
group_mode=no
;;
*)
echo "Incorrect input provided"
echo "Secondary argument must be either '--group_all', '--no_group' or '--group'."
show_usage
exit 1
;;
esac
# Some scripts are written in Python, the following lines ensures python is sourced, and of compatible version
python_version=$(python3 -V 2>&1)
if [ ! $? -eq 0 ]; then
echo "ERROR: No version of python3 could be found."
exit 1
fi
python_parsed_version=$(echo $python_version | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/')
if [[ "$python_parsed_version" -lt "36" ]] ; then
echo "Error: python version > 3.6 required"
exit 1
fi
# Run appropriate scripts
case $mode in
init )
./Scripts/initialize.sh $group_mode
;;
mapping )
./Scripts/map.sh
./Scripts/alignment_explicit.sh
./Scripts/substitution_errors.sh
./Scripts/error_rates_along_genome.sh
./Scripts/get_depthSeq_readMeanLen.sh
;;
quality )
./Scripts/error_rate_quality_score.sh $err_qual_window_length $err_qual_max_aln_nb $err_qual_min_occ_read $err_qual_min_occ_window
./Scripts/quality_along_raw_reads.sh $qual_read_end_length
;;
gc )
./Scripts/coverage_gc_content.sh $cov_gc_window_size $cov_gc_min_bases $cov_gc_max_bases
./Scripts/error_rates_gc_read.sh $err_gc_nb_max_aln $err_gc_min_occ_to_plot
;;
low_complexity )
./Scripts/homopolymer_errors.sh $homopolymer_min_length $homopolymer_max_length $homopolymer_nb_max_aln
./Scripts/heteropolymer_errors.sh $heteropolymer_min_length $heteropolymer_max_length
./Scripts/trinucleotides.sh $trinucleotides_min_length $trinucleotides_max_length $trinucleotides_threshold_occ $trinucleotides_nb_max_aln
;;
homopolymers )
./Scripts/homopolymer_errors.sh $homopolymer_min_length $homopolymer_max_length $homopolymer_nb_max_aln
;;
heteropolymers )
./Scripts/heteropolymer_errors.sh $heteropolymer_min_length $heteropolymer_max_length
;;
trinucleotides )
./Scripts/trinucleotides.sh $trinucleotides_min_length $trinucleotides_max_length $trinucleotides_threshold_occ $trinucleotides_nb_max_aln
;;
all )
./Scripts/initialize.sh $group_mode
./Scripts/map.sh
./Scripts/alignment_explicit.sh
./Scripts/substitution_errors.sh
./Scripts/error_rates_along_genome.sh
./Scripts/get_depthSeq_readMeanLen.sh
./Scripts/error_rate_quality_score.sh $err_qual_window_length $err_qual_max_aln_nb $err_qual_min_occ_read $err_qual_min_occ_window
./Scripts/quality_along_raw_reads.sh $qual_read_end_length
./Scripts/coverage_gc_content.sh $cov_gc_window_size $cov_gc_min_bases $cov_gc_max_bases
./Scripts/error_rates_gc_read.sh $err_gc_nb_max_aln $err_gc_min_occ_to_plot
./Scripts/homopolymer_errors.sh $homopolymer_min_length $homopolymer_max_length $homopolymer_nb_max_aln
./Scripts/heteropolymer_errors.sh $heteropolymer_min_length $heteropolymer_max_length
./Scripts/trinucleotides.sh $trinucleotides_min_length $trinucleotides_max_length $trinucleotides_threshold_occ $trinucleotides_nb_max_aln
;;
* )
echo "Not recognized"
exit 1
;;
esac