Skip to content

Commit

Permalink
adding more test
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaspe committed Aug 30, 2024
1 parent 91205bb commit d3e73ad
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 18 deletions.
11 changes: 6 additions & 5 deletions src/bcftools/bcftools_concat/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,12 @@ argument_groups:
and includes indels with POS at the end of a region, which are technically outside the region);
or set to 'variant' or '2' to include only true overlapping variation (compare the full VCF representation "TA>T-" vs the true sequence variation "A>-").
- name: --verbose
alternatives: -v
type: integer
choices: [0, 1]
description: Set verbosity level.
#PS: Verbose seems to be broken in this version of bcftools
# - name: --verbose
# alternatives: -v
# type: integer
# choices: [0, 1]
# description: Set verbosity level.

resources:
- type: bash_script
Expand Down
1 change: 0 additions & 1 deletion src/bcftools/bcftools_concat/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ bcftools concat \
${par_regions_file:+-R "$par_regions_file"} \
${par_regions_overlap:+--regions-overlap "$par_regions_overlap"} \
${meta_cpus:+--threads "$meta_cpus"} \
${par_verbose:+-v "$par_verbose"} \
-o $par_output \
${par_file_list:+-f "$par_file_list"} \
${input[@]} \
102 changes: 90 additions & 12 deletions src/bcftools/bcftools_concat/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ cat <<EOF > "$TMPDIR/example.vcf"
##fileformat=VCFv4.1
##contig=<ID=1,length=249250621,assembly=b37>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE1
1 752567 llama G C,A . . . . 1/2
1 752752 . G A,AAA . . . . ./.
1 752567 llama G C,A 15 . . . 1/2
1 752752 . G A,AAA 20 . . . ./.
EOF

bgzip -c $TMPDIR/example.vcf > $TMPDIR/example.vcf.gz
Expand All @@ -49,8 +49,8 @@ cat <<EOF > "$TMPDIR/example_2.vcf"
##fileformat=VCFv4.1
##contig=<ID=1,length=249250621,assembly=b37>
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT SAMPLE1
1 752569 cat G C,A . . . . 1/2
1 752739 . G A,AAA . . . . ./.
1 752569 cat G C,A 15 . . . 1/2
1 752739 . G A,AAA 20 . . . ./.
EOF

bgzip -c $TMPDIR/example_2.vcf > $TMPDIR/example_2.vcf.gz
Expand All @@ -69,8 +69,7 @@ echo "> Run bcftools_concat default test"
--input "../example.vcf" \
--input "../example_2.vcf" \
--output "concatenated.vcf" \

# &> /dev/null
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
Expand All @@ -90,7 +89,7 @@ echo "> Run bcftools_concat test with allow overlaps, and remove duplicates"
--output "concatenated.vcf" \
--allow_overlaps \
--remove_duplicates 'none' \
# &> /dev/null
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
Expand All @@ -111,7 +110,7 @@ echo "> Run bcftools_concat test with ligate, ligate force and ligate warn"
--output "concatenated.vcf" \
--ligate \
--compact_PS \
# &> /dev/null
&> /dev/null


# checks
Expand All @@ -130,7 +129,7 @@ echo "> Run bcftools_concat test with file list, ligate force and ligate warn"
--file_list "../file_list.txt" \
--output "concatenated.vcf" \
--ligate_force \
# &> /dev/null
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
Expand All @@ -140,10 +139,89 @@ echo "- test4 succeeded -"

popd > /dev/null

# Test 5: ligate warn and naive
mkdir "$TMPDIR/test5" && pushd "$TMPDIR/test5" > /dev/null

echo "> Run bcftools_concat test with ligate warn and naive"
"$meta_executable" \
--input "../example.vcf.gz" \
--input "../example_2.vcf.gz" \
--output "concatenated.vcf.gz" \
--ligate_warn \
--naive \
&> /dev/null

bgzip -d concatenated.vcf.gz

# checks
assert_file_exists "concatenated.vcf"
assert_file_not_empty "concatenated.vcf"
assert_file_contains "concatenated.vcf" "##fileformat=VCFv4.1"
echo "- test5 succeeded -"

popd > /dev/null

# Test 6: minimal PQ
mkdir "$TMPDIR/test6" && pushd "$TMPDIR/test6" > /dev/null

echo "> Run bcftools_concat test with minimal PQ"
"$meta_executable" \
--input "../example.vcf.gz" \
--input "../example_2.vcf.gz" \
--output "concatenated.vcf" \
--min_PQ 20 \
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
assert_file_not_empty "concatenated.vcf"
assert_file_contains "concatenated.vcf" "concat -q 20 -o concatenated.vcf ../example.vcf.gz ../example_2.vcf.gz"
echo "- test6 succeeded -"

popd > /dev/null

# Test 7: regions
mkdir "$TMPDIR/test7" && pushd "$TMPDIR/test7" > /dev/null

echo "> Run bcftools_concat test with regions"
"$meta_executable" \
--input "../example.vcf.gz" \
--input "../example_2.vcf.gz" \
--output "concatenated.vcf" \
--allow_overlaps \
--regions "1:752569-752739" \
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
assert_file_not_empty "concatenated.vcf"
assert_file_contains "concatenated.vcf" "concat -a -r 1:752569-752739 -o concatenated.vcf ../example.vcf.gz ../example_2.vcf.gz"
echo "- test7 succeeded -"

popd > /dev/null

# Test 8: regions overlap
mkdir "$TMPDIR/test8" && pushd "$TMPDIR/test8" > /dev/null

echo "> Run bcftools_concat test with regions overlap"
"$meta_executable" \
--input "../example.vcf.gz" \
--input "../example_2.vcf.gz" \
--output "concatenated.vcf" \
--allow_overlaps \
--regions_overlap 'pos' \
&> /dev/null

# checks
assert_file_exists "concatenated.vcf"
assert_file_not_empty "concatenated.vcf"
assert_file_contains "concatenated.vcf" "concat -a --regions-overlap pos -o concatenated.vcf ../example.vcf.gz ../example_2.vcf.gz"
echo "- test8 succeeded -"

popd > /dev/null

echo "---- All tests succeeded! ----"
exit 0

echo
cat concatenated.vcf
echo


0 comments on commit d3e73ad

Please sign in to comment.