Skip to content

Commit 900a3da

Browse files
committed
Make the header compatibility check more strict. Fixes #1591
1 parent 1a01f12 commit 900a3da

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

test/test.pl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,18 @@ sub test_naive_concat
15661566
my $seed = srand();
15671567
print STDERR "Random seed for test_naive_concat: $seed\n";
15681568
1569+
my @hdr = ();
1570+
my $nhdr = 1 + int(rand($args{max_hdr_lines}));
1571+
for (my $i=0; $i<$nhdr; $i++)
1572+
{
1573+
my $x = rand;
1574+
push @hdr, "##INFO=<ID=XX$i,Number=1,Type=Integer,Description=\"Test Tag $x\">\n";
1575+
}
1576+
15691577
my @files = ();
15701578
my $exp = '';
15711579
for (my $n=0; $n<$args{nfiles}; $n++)
15721580
{
1573-
my $nhdr = 1 + int(rand($args{max_hdr_lines}));
15741581
my $nbdy = int(rand($args{max_body_lines}));
15751582
my $file = "$$opts{tmp}/$args{name}.$n";
15761583
push @files,$file;
@@ -1579,11 +1586,7 @@ sub test_naive_concat
15791586
print $fh "##fileformat=VCFv4.0\n";
15801587
print $fh "##INFO=<ID=DP,Number=1,Type=Integer,Description=\"Read Depth\">\n";
15811588
print $fh "##contig=<ID=1,length=62435964>\n";
1582-
for (my $i=0; $i<$nhdr; $i++)
1583-
{
1584-
my $x = rand;
1585-
print $fh "##INFO=<ID=XX$i,Number=1,Type=Integer,Description=\"Test Tag $x\">\n";
1586-
}
1589+
print $fh join('',@hdr);
15871590
print $fh join("\t",'#CHROM','POS','ID','REF','ALT','QUAL','FILTER','INFO')."\n";
15881591
15891592
# let one of the files have no body

vcfconcat.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,6 @@ static void naive_concat_check_headers(args_t *args)
780780
// if BCF, check if tag IDs are consistent in the dictionary of strings
781781
if ( type.compression!=bgzf )
782782
error("The --naive option works only for compressed BCFs or VCFs, sorry :-/\n");
783-
if ( type.format==vcf )
784-
{
785-
bcf_hdr_destroy(hdr);
786-
continue;
787-
}
788783

789784
_check_hrecs(hdr0,hdr,args->fnames[0],args->fnames[i]);
790785
_check_hrecs(hdr,hdr0,args->fnames[i],args->fnames[0]);

0 commit comments

Comments
 (0)