Skip to content

Commit

Permalink
Add test for #1598
Browse files Browse the repository at this point in the history
Note this fails until samtools/htslib#1396 is merged
  • Loading branch information
pd3 committed Feb 14, 2022
1 parent 58f886f commit a4df6c7
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
20 changes: 12 additions & 8 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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=.`)
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -868,7 +870,7 @@ sub parse_params
$$opts{path} = cygpath($$opts{path});
$$opts{bin} = cygpath($$opts{bin});
}
return $opts;
}
sub _cmd
Expand Down Expand Up @@ -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//;
Expand Down
8 changes: 8 additions & 0 deletions test/view.sites.1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=1,length=20000000>
#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 . .
4 changes: 4 additions & 0 deletions test/view.sites.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1 10001 G A
1 10002 T A
1 10003 G C
1 10004 A C
Binary file added test/view.sites.txt.gz
Binary file not shown.
Binary file added test/view.sites.txt.gz.tbi
Binary file not shown.
8 changes: 8 additions & 0 deletions test/view.sites.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##contig=<ID=1,length=20000000>
#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 . .

0 comments on commit a4df6c7

Please sign in to comment.