From a4df6c75fd7ad00e8fccceeab48eea17d6212e3e Mon Sep 17 00:00:00 2001 From: Petr Danecek Date: Mon, 14 Feb 2022 10:43:44 +0000 Subject: [PATCH] Add test for #1598 Note this fails until https://github.com/samtools/htslib/pull/1396 is merged --- NEWS | 20 ++++++++++++-------- test/test.pl | 6 ++++-- test/view.sites.1.out | 8 ++++++++ test/view.sites.txt | 4 ++++ test/view.sites.txt.gz | Bin 0 -> 86 bytes test/view.sites.txt.gz.tbi | Bin 0 -> 96 bytes test/view.sites.vcf | 8 ++++++++ 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 test/view.sites.1.out create mode 100644 test/view.sites.txt create mode 100644 test/view.sites.txt.gz create mode 100644 test/view.sites.txt.gz.tbi create mode 100644 test/view.sites.vcf diff --git a/NEWS b/NEWS index afa239527..94d25099f 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ of a VCF or BCF file. Without any options, this is equivalent to `bcftools view --header-only --no-version` but more succinct and memorable. +* The `-T, --targets-file` option had the following bug originating in HTSlib code: + when an uncompressed file with multiple columns CHR,POS,REF was provided, the + REF would be interpreted as 0 gigabases (#1598) + Changes affecting specific commands: * bcftools annotate @@ -89,7 +93,7 @@ Changes affecting specific commands: Changes affecting the whole of bcftools, or multiple commands: * New `--regions-overlap` and `--targets-overlap` options which address - a long-standing design problem with subsetting VCF files by region. + a long-standing design problem with subsetting VCF files by region. BCFtools recognize two sets of options, one for streaming (`-t/-T`) and one for index-gumping (`-r/-R`). They behave differently, the first includes only records with POS coordinate within the regions, the other @@ -117,11 +121,11 @@ Changes affecting specific commands: by using `-c INFO/END`. - add a new '.' modifier to control wheter missing values should be carried - over from a tab-delimited file or not. For example: + over from a tab-delimited file or not. For example: -c TAG .. adds TAG if the source value is not missing. If TAG exists in the target file, it will be overwritten - + -c .TAG .. adds TAG even if the source value is missing. This can overwrite non-missing values with a missing value and can create empty VCF fields (`TAG=.`) @@ -250,7 +254,7 @@ Changes affecting specific commands: * bcftools +fill-tags: - Generalization and better support for custom functions that allow - adding new INFO tags based on arbitrary `-i, --include` type of + adding new INFO tags based on arbitrary `-i, --include` type of expressions. For example, to calculate a missing INFO/DP annotation from FORMAT/AD, it is possible to use: @@ -314,7 +318,7 @@ Changes affecting specific commands: - Atomization of AD and QS tags now correctly updates occurrences of duplicate alleles within different haplotypes - + - Fix a bug in atomization of Number=A,R tags * bcftools reheader: @@ -326,7 +330,7 @@ Changes affecting specific commands: - A wider range of genotypes can be set by the plugin by allowing specifying custom genotypes. For example, to force a heterozygous genotype it is now possible to use expressions like: - + c:'m|M' c:0/1 c:0 @@ -338,7 +342,7 @@ Changes affecting specific commands: - Better handling of ambiguous keys such as INFO/AF and CSQ/AD. The `-p, --annot-prefix` option is now applied before doing anything else which allows its use with `-f, --format` and `-c, --columns` options. - + - Some consequence field names may not constitute a valid tag name, such as "pos(1-based)". Newly field names are trimmed to exclude brackets. @@ -468,7 +472,7 @@ Changes affecting specific commands: * bcftools csq: - - Fix a bug wich caused incorrect FORMAT/BCSQ formatting at sites with too + - Fix a bug wich caused incorrect FORMAT/BCSQ formatting at sites with too many per-sample consequences - Fix a bug which incorrectly handled the --ncsq parameter and could clash diff --git a/test/test.pl b/test/test.pl index e2cc7651c..0b6f7c36e 100755 --- a/test/test.pl +++ b/test/test.pl @@ -306,6 +306,8 @@ test_vcf_view($opts,in=>'view.filter.annovar',out=>'view.filter.annovar.2.out',args=>q[-H -i 'Gene.refGene~"NOD"'],reg=>''); test_vcf_view($opts,in=>'view.filter.annovar',out=>'view.filter.annovar.3.out',args=>q[-H -i 'LJB2_MutationTaster=="0.291000"'],reg=>''); test_vcf_view($opts,in=>'view-a',out=>'view-a.1.out',args=>q[-H -a]); +test_vcf_view($opts,in=>'view.sites',out=>'view.sites.1.out',args=>'',tgts=>'view.sites.txt'); +test_vcf_view($opts,in=>'view.sites',out=>'view.sites.1.out',args=>'',tgts=>'view.sites.txt.gz'); test_vcf_head($opts,in=>'mpileup.2.vcf',in_nheaders=>22); test_vcf_call($opts,in=>'mpileup',out=>'mpileup.1.out',args=>'-mv'); test_vcf_call($opts,in=>'mpileup',out=>'mpileup.2.out',args=>'-mg0'); @@ -868,7 +870,7 @@ sub parse_params $$opts{path} = cygpath($$opts{path}); $$opts{bin} = cygpath($$opts{bin}); } - + return $opts; } sub _cmd @@ -1540,7 +1542,7 @@ sub test_vcf_plugin if ( !$$opts{test_plugins} ) { return; } $ENV{BCFTOOLS_PLUGINS} = "$$opts{bin}/plugins"; if ( !exists($args{args}) ) { $args{args} = ''; } - my $wpath = $$opts{path}; + my $wpath = $$opts{path}; if ($^O =~ /^msys/) { $wpath = `cygpath -w $$opts{path}`; $wpath =~ s/\r?\n//; diff --git a/test/view.sites.1.out b/test/view.sites.1.out new file mode 100644 index 000000000..30a471653 --- /dev/null +++ b/test/view.sites.1.out @@ -0,0 +1,8 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +#CHROM POS ID REF ALT QUAL FILTER INFO +1 10001 . G C 40 . . +1 10002 . T A 50 . . +1 10003 . A G 60 . . +1 10004 . A T 70 . . diff --git a/test/view.sites.txt b/test/view.sites.txt new file mode 100644 index 000000000..81af4e73b --- /dev/null +++ b/test/view.sites.txt @@ -0,0 +1,4 @@ +1 10001 G A +1 10002 T A +1 10003 G C +1 10004 A C diff --git a/test/view.sites.txt.gz b/test/view.sites.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..338845aa03272d86ec9d763c3fd19436baef6c1b GIT binary patch literal 86 zcmb2|=3rp}f&Xj_PR>jWmJG&EOiT<644#xcFL`3bvbop7`9V(df*rjW&J5gzpHfm%8W;r5vK&1XU?^}~z^97KF+`z3bjFuiEP<_h f=MFV+Nk|$nGF-eW5?lw=DvxG{Gy^lpL@)pV(2f>6 literal 0 HcmV?d00001 diff --git a/test/view.sites.vcf b/test/view.sites.vcf new file mode 100644 index 000000000..30a471653 --- /dev/null +++ b/test/view.sites.vcf @@ -0,0 +1,8 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +#CHROM POS ID REF ALT QUAL FILTER INFO +1 10001 . G C 40 . . +1 10002 . T A 50 . . +1 10003 . A G 60 . . +1 10004 . A T 70 . .