forked from viash-hub/biobox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update changelog, add tests, fix argument naming errors, add test data
- Loading branch information
1 parent
cd118b7
commit 790a466
Showing
9 changed files
with
149 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,96 @@ | ||
#!/bin/bash | ||
|
||
test_dir="${meta_resources_dir}/test_data" | ||
out_dir="${meta_resources_dir}/tmp" | ||
out_dir="${meta_resources_dir}/out_data" | ||
|
||
############################################################################################ | ||
|
||
## example 1: samtools fastq -0 /dev/null in_name.bam > all_reads.fq | ||
## example 2: samtools fastq -0 /dev/null -s single.fq -N in_name.bam > paired.fq | ||
## example 3: samtools fastq with fasta output?? | ||
## example 4: samtools fastq with compressed input? | ||
## example 5: samtools fastq with no suffix? | ||
echo ">>> Test 1: Convert all reads from a bam file to fastq format" | ||
"$meta_executable" \ | ||
--input "$test_dir/a.bam" \ | ||
--output "$out_dir/a.fq" | ||
|
||
echo ">>> Check if output file exists" | ||
[ ! -f "$out_dir/a.fq" ] && echo "Output file a.fq does not exist" && exit 1 | ||
|
||
echo ">>> Check if output is empty" | ||
[ ! -s "$out_dir/a.fq" ] && echo "Output file a.fq is empty" && exit 1 | ||
|
||
echo ">>> Check if output matches expected output" | ||
diff "$out_dir/a.fq" "$test_dir/a.fq" || | ||
(echo "Output file a.fq does not match expected output" && exit 1) | ||
|
||
echo ">>> Test 1: Sorting a BAM file" | ||
rm "$out_dir/a.fq" | ||
|
||
############################################################################################ | ||
|
||
echo ">>> Test 2: Convert all reads from a sam file to fastq format" | ||
"$meta_executable" \ | ||
--input "$test_dir/a.bam" \ | ||
--output "$test_dir/a.sorted.bam" | ||
--input "$test_dir/a.sam" \ | ||
--output "$out_dir/a.fq" | ||
|
||
echo ">>> Check if output file exists" | ||
[ ] \ | ||
&& echo "Output file a.sorted.bam does not exist" && exit 1 | ||
[ ! -f "$out_dir/a.fq" ] && echo "Output file a.fq does not exist" && exit 1 | ||
|
||
echo ">>> Check if output is empty" | ||
[ ! -s "$out_dir/a.fq" ] && echo "Output file a.fq is empty" && exit 1 | ||
|
||
echo ">>> Check if output matches expected output" | ||
diff "$out_dir/a.fq" "$test_dir/a.fq" || | ||
(echo "Output file a.fq does not match expected output" && exit 1) | ||
|
||
rm "$out_dir/a.fq" | ||
|
||
############################################################################################ | ||
|
||
echo ">>> Test 3: Output reads from bam file to separate files" | ||
|
||
"$meta_executable" \ | ||
--input "$test_dir/a.bam" \ | ||
--read1 "$out_dir/a.1.fq" \ | ||
--read2 "$out_dir/a.2.fq" \ | ||
--output "$out_dir/a.fq" | ||
|
||
echo ">>> Check if output files exist" | ||
[ ! -f "$out_dir/a.1.fq" ] && echo "Output file a.1.fq does not exist" && exit 1 | ||
[ ! -f "$out_dir/a.2.fq" ] && echo "Output file a.2.fq does not exist" && exit 1 | ||
[ ! -f "$out_dir/a.fq" ] && echo "Output file a.fq does not exist" && exit 1 | ||
|
||
echo ">>> Check if output files are empty" | ||
[ ! -s "$out_dir/a.1.fq" ] && echo "Output file a.1.fq is empty" && exit 1 | ||
[ ! -s "$out_dir/a.2.fq" ] && echo "Output file a.2.fq is empty" && exit 1 | ||
# output should be empty since input has no singleton reads | ||
|
||
echo ">>> Check if output files match expected output" | ||
diff "$out_dir/a.1.fq" "$test_dir/a.1.fq" || | ||
(echo "Output file a.1.fq does not match expected output" && exit 1) | ||
diff "$out_dir/a.2.fq" "$test_dir/a.2.fq" || | ||
(echo "Output file a.2.fq does not match expected output" && exit 1) | ||
|
||
rm "$out_dir/a.1.fq" "$out_dir/a.2.fq" "$out_dir/a.fq" | ||
|
||
############################################################################################ | ||
|
||
echo ">>> Test 4: Output only forward reads from bam file to fastq format" | ||
|
||
"$meta_executable" \ | ||
--input "$test_dir/a.sam" \ | ||
--excl_flags "0x80" \ | ||
--output "$out_dir/half.fq" | ||
|
||
echo ">>> Check if output file exists" | ||
[ ! -f "$out_dir/half.fq" ] && echo "Output file half.fq does not exist" && exit 1 | ||
|
||
echo ">>> Check if output is empty" | ||
[ ! -s "$out_dir/half.fq" ] && echo "Output file half.fq is empty" && exit 1 | ||
|
||
echo ">>> Check if output matches expected output" | ||
diff "$out_dir/half.fq" "$test_dir/half.fq" || | ||
(echo "Output file half.fq does not match expected output" && exit 1) | ||
|
||
rm "$out_dir/half.fq" | ||
|
||
############################################################################################ | ||
|
||
echo "All tests succeeded!" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@a1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@b1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@c1 | ||
AAAAAAAAAA | ||
+ | ||
********** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@a1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@b1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@c1 | ||
AAAAAAAAAA | ||
+ | ||
********** |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
@a1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@b1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@c1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@a1/2 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@b1/2 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@c1/2 | ||
AAAAAAAAAA | ||
+ | ||
********** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@a1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@b1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** | ||
@c1/1 | ||
AAAAAAAAAA | ||
+ | ||
********** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters