Skip to content

Commit 3f620f6

Browse files
committed
Use the highest VCF version when merging headers
Requires the htslib update samtools/htslib#1912 Resolves #2395
1 parent 9f4bef6 commit 3f620f6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

test/merge.symbolic.1.1.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
##fileformat=VCFv4.1
1+
##fileformat=VCFv4.4
22
##FILTER=<ID=PASS,Description="All filters passed">
33
##contig=<ID=chr1,length=248956422>
44
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of structural variation">

test/merge.symbolic.1.b.vcf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
##fileformat=VCFv4.1
1+
##fileformat=VCFv4.4
22
##contig=<ID=chr1,length=248956422>
33
##INFO=<ID=END,Number=1,Type=Integer,Description="End position of structural variation">
44
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">

vcfmerge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3424,6 +3424,7 @@ void merge_vcf(args_t *args)
34243424
if ( args->out_fh == NULL ) error("Can't write to \"%s\": %s\n", args->output_fname, strerror(errno));
34253425
if ( args->n_threads ) hts_set_opt(args->out_fh, HTS_OPT_THREAD_POOL, args->files->p); //hts_set_threads(args->out_fh, args->n_threads);
34263426
args->out_hdr = bcf_hdr_init("w");
3427+
bcf_hdr_set_version(args->out_hdr, bcf_hdr_get_version(args->files->readers[0].header));
34273428

34283429
if ( args->header_fname )
34293430
{
@@ -3445,7 +3446,6 @@ void merge_vcf(args_t *args)
34453446
info_rules_init(args);
34463447
missing_rules_init(args);
34473448

3448-
bcf_hdr_set_version(args->out_hdr, bcf_hdr_get_version(args->files->readers[0].header));
34493449
if ( bcf_hdr_write(args->out_fh, args->out_hdr)!=0 ) error("[%s] Error: cannot write to %s\n", __func__,args->output_fname);
34503450
if ( args->header_only )
34513451
{

0 commit comments

Comments
 (0)