From 9e757e5346c495da05f66fb3ffe7c607d29e256c Mon Sep 17 00:00:00 2001 From: tgaspe Date: Wed, 28 Aug 2024 10:57:59 +0200 Subject: [PATCH] bug fixing and adding tests --- .../bcftools_annotate/config.vsh.yaml | 8 +---- src/bcftools/bcftools_annotate/test.sh | 28 ++++++++++++---- .../bcftools_annotate/test_data/example.vcf | 32 ++++++++++++++++++ .../bcftools_annotate/test_data/output.vcf | 33 +++++++++++++++++++ 4 files changed, 87 insertions(+), 14 deletions(-) create mode 100644 src/bcftools/bcftools_annotate/test_data/example.vcf create mode 100644 src/bcftools/bcftools_annotate/test_data/output.vcf diff --git a/src/bcftools/bcftools_annotate/config.vsh.yaml b/src/bcftools/bcftools_annotate/config.vsh.yaml index ec8f4ee4..0e915c77 100644 --- a/src/bcftools/bcftools_annotate/config.vsh.yaml +++ b/src/bcftools/bcftools_annotate/config.vsh.yaml @@ -37,7 +37,7 @@ argument_groups: required: true - name: Options - dexcription: | + description: | For examples on how to use use bcftools annotate see http://samtools.github.io/bcftools/howtos/annotate.html. For more details on the options see https://samtools.github.io/bcftools/bcftools.html#annotate. arguments: @@ -135,12 +135,6 @@ argument_groups: description: | Do not append version and command line information to the output VCF header.. - - name: --samples_file - alternatives: --S - type: file - description: | - File of samples to include. - - name: --output_type alternatives: --O type: string diff --git a/src/bcftools/bcftools_annotate/test.sh b/src/bcftools/bcftools_annotate/test.sh index b13303f8..7e9ffb91 100644 --- a/src/bcftools/bcftools_annotate/test.sh +++ b/src/bcftools/bcftools_annotate/test.sh @@ -69,24 +69,38 @@ cat < "$TMPDIR/example.vcf" 20 1235237 . T . . . . GT 0/0 0|0 ./. EOF - - # Test 1: Default Use mkdir "$TMPDIR/test1" && pushd "$TMPDIR/test1" > /dev/null -echo "> Run bcftools_stats on VCF file" +echo "> Run bcftools_annotate remove annotations" "$meta_executable" \ --input "../example.vcf" \ - --output "stats.txt" \ + --output "annotated.vcf" \ + --remove "ID,INFO/DP,FORMAT/DP" # checks -assert_file_exists "stats.txt" -assert_file_not_empty "stats.txt" -assert_file_contains "stats.txt" "bcftools stats ../example.vcf" +assert_file_exists "annotated.vcf" +assert_file_not_empty "annotated.vcf" +#assert_file_contains "annotated.vcf" "" echo "- test1 succeeded -" popd > /dev/null +# # Test 2: Rename annotations +# mkdir "$TMPDIR/test2" && pushd "$TMPDIR/test2" > /dev/null + +# echo "> Run bcftools_annotate rename annotations" +# "$meta_executable" \ +# --input "../example.vcf" \ +# --output "stats.txt" \ +# --rename_annotations "ID=ID2,INFO/DP=INFO/Depth,FORMAT/DP=FORMAT/Depth" + +# # checks +# assert_file_exists "stats.txt" +# assert_file_not_empty "stats.txt" +# #assert_file_contains "stats.txt" "bcftools stats ../example.vcf" +# echo "- test2 succeeded -" + echo "---- All tests succeeded! ----" diff --git a/src/bcftools/bcftools_annotate/test_data/example.vcf b/src/bcftools/bcftools_annotate/test_data/example.vcf new file mode 100644 index 00000000..72ae410e --- /dev/null +++ b/src/bcftools/bcftools_annotate/test_data/example.vcf @@ -0,0 +1,32 @@ +##fileformat=VCFv4.0 +##fileDate=20090805 +##source=myImputationProgramV3.1 +##reference=1000GenomesPilot-NCBI36 +##contig= +##contig= +##phasing=partial +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##FILTER= +##FILTER= +##FORMAT= +##FORMAT= +##FORMAT= +##FORMAT= +##ALT= +##ALT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA00001 NA00002 NA00003 +19 111 . A C 9.6 . . GT:HQ 0|0:10,10 0|0:10,10 0/1:3,3 +19 112 . A G 10 . . GT:HQ 0|0:10,10 0|0:10,10 0/1:3,3 +20 14370 rs6054257 G A 29 PASS NS=3;DP=14;AF=0.5;DB;H2 GT:GQ:DP:HQ 0|0:48:1:51,51 1|0:48:8:51,51 1/1:43:5:.,. +20 17330 . T A 3 q10 NS=3;DP=11;AF=0.017 GT:GQ:DP:HQ 0|0:49:3:58,50 0|1:3:5:65,3 0/0:41:3:.,. +20 1110696 rs6040355 A G,T 67 PASS NS=2;DP=10;AF=0.333,0.667;AA=T;DB GT:GQ:DP:HQ 1|2:21:6:23,27 2|1:2:0:18,2 2/2:35:4:.,. +20 1230237 . T . 47 PASS NS=3;DP=13;AA=T GT:GQ:DP:HQ 0|0:54:.:56,60 0|0:48:4:51,51 0/0:61:2:.,. +20 1234567 microsat1 G GA,GAC 50 PASS NS=3;DP=9;AA=G;AN=6;AC=3,1 GT:GQ:DP 0/1:.:4 0/2:17:2 1/1:40:3 +20 1235237 . T . . . . GT 0/0 0|0 ./. diff --git a/src/bcftools/bcftools_annotate/test_data/output.vcf b/src/bcftools/bcftools_annotate/test_data/output.vcf new file mode 100644 index 00000000..f72e1adb --- /dev/null +++ b/src/bcftools/bcftools_annotate/test_data/output.vcf @@ -0,0 +1,33 @@ +##fileformat=VCFv4.0 +##FILTER= +##fileDate=20090805 +##source=myImputationProgramV3.1 +##reference=1000GenomesPilot-NCBI36 +##contig= +##contig= +##phasing=partial +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +##FILTER= +##FILTER= +##FORMAT= +##FORMAT= +##FORMAT= +##ALT= +##ALT= +##bcftools_annotateVersion=1.16+htslib-1.16 +##bcftools_annotateCommand=annotate -x ID,INFO/DP,FORMAT/DP -o output.vcf example.vcf; Date=Wed Aug 28 08:53:36 2024 +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA00001 NA00002 NA00003 +19 111 . A C 9.6 . . GT:HQ 0|0:10,10 0|0:10,10 0/1:3,3 +19 112 . A G 10 . . GT:HQ 0|0:10,10 0|0:10,10 0/1:3,3 +20 14370 . G A 29 PASS NS=3;AF=0.5;DB;H2 GT:GQ:HQ 0|0:48:51,51 1|0:48:51,51 1/1:43:.,. +20 17330 . T A 3 q10 NS=3;AF=0.017 GT:GQ:HQ 0|0:49:58,50 0|1:3:65,3 0/0:41:.,. +20 1110696 . A G,T 67 PASS NS=2;AF=0.333,0.667;AA=T;DB GT:GQ:HQ 1|2:21:23,27 2|1:2:18,2 2/2:35:.,. +20 1230237 . T . 47 PASS NS=3;AA=T GT:GQ:HQ 0|0:54:56,60 0|0:48:51,51 0/0:61:.,. +20 1234567 . G GA,GAC 50 PASS NS=3;AA=G;AN=6;AC=3,1 GT:GQ 0/1:. 0/2:17 1/1:40 +20 1235237 . T . . . . GT 0/0 0|0 ./.