From d3e73ad7d902d3e6c61bb1d906e284583d1b2f23 Mon Sep 17 00:00:00 2001 From: tgaspe Date: Fri, 30 Aug 2024 11:37:29 +0200 Subject: [PATCH] adding more test --- src/bcftools/bcftools_concat/config.vsh.yaml | 11 +- src/bcftools/bcftools_concat/script.sh | 1 - src/bcftools/bcftools_concat/test.sh | 102 ++++++++++++++++--- 3 files changed, 96 insertions(+), 18 deletions(-) diff --git a/src/bcftools/bcftools_concat/config.vsh.yaml b/src/bcftools/bcftools_concat/config.vsh.yaml index 601c8417..2bb32f1c 100644 --- a/src/bcftools/bcftools_concat/config.vsh.yaml +++ b/src/bcftools/bcftools_concat/config.vsh.yaml @@ -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 diff --git a/src/bcftools/bcftools_concat/script.sh b/src/bcftools/bcftools_concat/script.sh index bcf6f2c5..5614cd1b 100644 --- a/src/bcftools/bcftools_concat/script.sh +++ b/src/bcftools/bcftools_concat/script.sh @@ -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[@]} \ \ No newline at end of file diff --git a/src/bcftools/bcftools_concat/test.sh b/src/bcftools/bcftools_concat/test.sh index 50f97ada..3c1c7bb6 100644 --- a/src/bcftools/bcftools_concat/test.sh +++ b/src/bcftools/bcftools_concat/test.sh @@ -38,8 +38,8 @@ cat < "$TMPDIR/example.vcf" ##fileformat=VCFv4.1 ##contig= #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 @@ -49,8 +49,8 @@ cat < "$TMPDIR/example_2.vcf" ##fileformat=VCFv4.1 ##contig= #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 @@ -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" @@ -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" @@ -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 @@ -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" @@ -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 +