-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_tests.sh
executable file
·361 lines (301 loc) · 16.7 KB
/
run_tests.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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#!/bin/bash
#USAGE: ./run_tests.sh [0|1|2] [last_test_number]
#First argument is a debug value. 1 adds --debug to htseq2multx.pl commands to
#cause the script to echo the fastq-multx command. 2 also causes the script to
#stop upon the end of the first failed test. 3 echoes all the test script's
#commands
TEST_DATA=test_data
TEST_OUTPUT=test_output
BARCODE_SPLITTER=../htseq2multx.pl
DEBUG=0
DEBUG_OPT=""
if [ $# -ne 0 ] && [ $1 -ne 0 ]; then
DEBUG=$1
DEBUG_OPT="--debug"
fi
LAST_TEST=""
if [ $# -gt 1 ]; then
LAST_TEST="test_$2"
fi
rm -rf "${TEST_OUTPUT}"
mkdir -p "${TEST_OUTPUT}"
#Perl code to allow fastq-multx debug message to not cause a "difference"
PERL_DEBUG_FILTER='$c=0;$d="";while(<STDIN>){if($_ !~ /#.*fastq-multx|^1d0$/){print;$c++}elsif(/#.*fastq-multx/){$d.=$_}}if($c && $ARGV[0]){$d =~ s/< #/#/g;print "\033[1;94m$d\033[0m"}exit($c)'
EXIT_STATUS=0
function check_test_results() {
if [ $EXIT_CODE -ne $EXPECTED_EXIT_CODE ];then
EXIT_STATUS=1
echo -e "\033[1;31mFAILED ${TEST} EXIT($EXIT_CODE) != EXPECTED($EXPECTED_EXIT_CODE)\033[0m"
else
echo -e "\033[1;32mPASSED\033[0m ${TEST} EXIT($EXIT_CODE)"
fi
for OUTPUT in $OUTPUTS; do
filename=$(basename "$OUTPUT")
extension="${filename##*.}"
op=''
if [[ $extension == 'gz' ]]; then
diff <(gzip -dc "$TEST_OUTPUT/${TEST}_${OUTPUT}") <(gzip -dc "${TEST_DATA}/${TEST}_${OUTPUT}") | perl -e "$PERL_DEBUG_FILTER" $DEBUG
else
diff "${TEST_OUTPUT}/${TEST}_${OUTPUT}" "${TEST_DATA}/${TEST}_${OUTPUT}" | perl -e "$PERL_DEBUG_FILTER" $DEBUG
fi
if [ $? -ne 0 ]; then
EXIT_STATUS=1
echo -e "\033[1;31mFAILED ${TEST}_${OUTPUT}\033[0m"
else
echo -e "\033[1;32mPASSED\033[0m ${TEST}_${OUTPUT}"
fi
done
for NOT_OUTPUT in $NOT_OUTPUTS; do
if [ -f "$NOT_OUTPUT" ]
then
EXIT_STATUS=1
echo -e "\033[1;31mFAILED ${TEST}_${NOT_OUTPUT}\033[0m"
else
echo -e "\033[1;32mPASSED\033[0m ${TEST}_${NOT_OUTPUT}"
fi
done
if [ $DEBUG -gt 1 ] && [ $EXIT_STATUS -gt 0 ]; then
exit 1
fi
if [ "$LAST_TEST" == "$TEST" ]; then
exit 0
fi
}
NOT_OUTPUTS=""
if [ $DEBUG -gt 2 ]; then
set -x
fi
# Test split file output
TEST=test_1
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test separate index file
TEST=test_2
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out BC1-read-2.out BC2-read-2.out BC3-read-2.out BC4-read-2.out unmatched-read-2.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test special characters in sample names (utf-8)
TEST=test_3
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC_1-read-1.out BC_2-read-1.out BC_3-read-1.out BC_4-read-1.out unmatched-read-1.out BC_1-read-2.out BC_2-read-2.out BC_3-read-2.out BC_4-read-2.out unmatched-read-2.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes_odd_sample_names.txt" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test variable length barcodes
TEST=test_4
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes_vary_length.txt" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test gzip input and output
TEST=test_5
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out.gz BC2-read-1.out.gz BC3-read-1.out.gz BC4-read-1.out.gz unmatched-read-1.out.gz summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq.gz" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --gzipout --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test dual barcodes
TEST=test_6
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.fastq BC1-read-2.fastq BC1-read-3.fastq BC2-read-1.fastq BC2-read-2.fastq BC2-read-3.fastq BC3-read-1.fastq BC3-read-2.fastq BC3-read-3.fastq BC4-read-1.fastq BC4-read-2.fastq BC4-read-3.fastq error.out summary.out unmatched-read-1.fastq unmatched-read-2.fastq unmatched-read-3.fastq"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --bcfile "${TEST_DATA}/barcode_splitter_barcodes_dual.txt" --prefix "${TEST_OUTPUT}/${TEST}_" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" "${TEST_DATA}/barcode_splitter_index_2.fastq" --idxread 2 3 --mismatches 1 --split_all $DEBUG_OPT 1> "${TEST_OUTPUT}/${TEST}_summary.out" 2> "${TEST_OUTPUT}/${TEST}_error.out"
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test old Illumina style fastq ids
TEST=test_7
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out BC1-read-2.out BC2-read-2.out BC3-read-2.out BC4-read-2.out unmatched-read-2.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1_oldstyle_ids.fastq" "${TEST_DATA}/barcode_splitter_index_oldstyle_ids.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test new Illumina style fastq ids
TEST=test_8
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out BC1-read-2.out BC2-read-2.out BC3-read-2.out BC4-read-2.out unmatched-read-2.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1_newstyle_ids.fastq" "${TEST_DATA}/barcode_splitter_index_newstyle_ids.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test no splitting of index file by default
TEST=test_9
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out summary.out error.out"
NOT_OUTPUTS="BC1-read-2.out BC2-read-2.out BC3-read-2.out BC4-read-2.out unmatched-read-2.out"
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 2 $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test split all files by default when all are index files
TEST=test_10
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test that sequences shorter than barcodes are treated as unmatched
TEST=test_11
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 0 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1_short.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test output sequence file does not exist
TEST=test_12
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "baddir/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=1
check_test_results
# Test input sequence file does not exist
TEST=test_13
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "baddir/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=10
check_test_results
# Test input barcode file does not exist
TEST=test_14
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "baddir/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=5
check_test_results
# Test output unmatched file exists
TEST=test_15
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
touch ${TEST_OUTPUT}/${TEST}_unmatched-read-1.out
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=9
check_test_results
# Test output sample file exists
TEST=test_16
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
touch ${TEST_OUTPUT}/${TEST}_BC1-read-1.out
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=9
check_test_results
# Test gzipped output sequence file does not exist
TEST=test_17
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "baddir/${TEST}_" --suffix .out --idxread 1 --split_all --gzipout $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=1
check_test_results
# Test gzipped input sequence file does not exist
TEST=test_18
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
# NOTE: Skipping check of error.out since gzip messages can differ bewteen systems
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "baddir/barcode_splitter1.fastq.gz" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=10
check_test_results
# Test gzipped output unmatched file exists
TEST=test_19
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
touch ${TEST_OUTPUT}/${TEST}_unmatched-read-1.out.gz
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all --gzipout $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=9
check_test_results
# Test gzipped output sample file exists
TEST=test_20
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS=""
touch ${TEST_OUTPUT}/${TEST}_BC1-read-1.out.gz
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/barcode_splitter1.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all --gzipout $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=9
check_test_results
# Test error for special characters in sample names (utf-8)
TEST=test_21
echo -e "\033[1;33mSKIPPING\033[0m $TEST"
# Test that version in barcode splitter and setup are the same (and that thus,
# single source versioning is working)
TEST=test_22
echo -e "\033[1;33mSKIPPING\033[0m $TEST"
# Test split file output
TEST=test_23
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out summary.out error.out"
NOT_OUTPUTS=""
mkfifo "${TEST_DATA}/${TEST}_read1_fifo.fastq"
cat "${TEST_DATA}/barcode_splitter1.fastq" > "${TEST_DATA}/${TEST}_read1_fifo.fastq" &
$BARCODE_SPLITTER --mismatches 2 --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" "${TEST_DATA}/${TEST}_read1_fifo.fastq" --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
rm "${TEST_DATA}/${TEST}_read1_fifo.fastq"
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
# Test duplicate barcode rows
TEST=test_24
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="summary.out error.out"
NOT_OUTPUTS="BC1-read-1.out BC2-read-1.out BC3-read-1.out BC4-read-1.out unmatched-read-1.out"
$BARCODE_SPLITTER --bcfile "${TEST_DATA}/barcode_splitter_barcodes_dupes.txt" --prefix "${TEST_OUTPUT}/${TEST}_" "${TEST_DATA}/barcode_splitter1.fastq" "${TEST_DATA}/barcode_splitter_index.fastq" "${TEST_DATA}/barcode_splitter_index_2.fastq" --idxread 2 3 $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=12
check_test_results
# Test gzip input and output bash process substitution
TEST=test_25
rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
OUTPUTS="BC1-read-1.out.gz BC2-read-1.out.gz BC3-read-1.out.gz BC4-read-1.out.gz unmatched-read-1.out.gz summary.out error.out"
NOT_OUTPUTS=""
$BARCODE_SPLITTER --mismatches 2 --gzipin --gzipout --bcfile "${TEST_DATA}/barcode_splitter_barcodes.txt" <(cat "${TEST_DATA}/barcode_splitter1.fastq.gz") --prefix "${TEST_OUTPUT}/${TEST}_" --suffix .out --idxread 1 --split_all $DEBUG_OPT 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
EXIT_CODE=$?
EXPECTED_EXIT_CODE=0
check_test_results
###This demonstrates a bug in fastq-multx and/or its call to gzip, which
#complains of a broken stdout pipe, yet seemingly outputs all gzip data without
#a problem.
## Test the fastq-multx executable itself and its handling of gzip data
#TEST=test_26
#rm -f ${TEST_OUTPUT}/${TEST}_* 2> /dev/null
#OUTPUTS="BC1-read-1.out.gz BC2-read-1.out.gz BC3-read-1.out.gz BC4-read-1.out.gz unmatched-read-1.out.gz summary.out error.out"
#NOT_OUTPUTS=""
#fastq-multx -x -d 1 -B "${TEST_DATA}/barcode_splitter_barcodes_fqmx.txt" -m 2 -M 2 -b "${TEST_DATA}/barcode_splitter1.fastq.gz" -o "${TEST_OUTPUT}/${TEST}_%-read-1.out.gz" 2> ${TEST_OUTPUT}/${TEST}_error.out 1> ${TEST_OUTPUT}/${TEST}_summary.out
#EXIT_CODE=$?
#EXPECTED_EXIT_CODE=0
#check_test_results
exit $EXIT_STATUS