Skip to content

END field-related bcftools merge infinite loop and infinite output #2410

@jmarshall

Description

@jmarshall

Given the following two VCF files (which will then be bgzipped and tabix-indexed):

##fileformat=VCFv4.2
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number">
##INFO=<ID=END,Number=1,Type=Integer,Description="End coordinate of the variant">
##contig=<ID=chr1,length=248956422>
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SA
chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2
chr1	80000	id2	G	.	12.34	PASS	END=95000	GT:CN	0/0:2

and

##fileformat=VCFv4.2
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number">
##INFO=<ID=END,Number=1,Type=Integer,Description="End coordinate of the variant">
##contig=<ID=chr1,length=248956422>
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	SB
chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2
chr1	80000	id2	G	.	15.43	PASS	END=95000	GT:CN	0/0:2

(attached as infinite.a.vcf.txt and infinite.b.vcf.txt)

the following bcftools merge command runs forever generating the same output line over and over:

bgzip infinite.a.vcf
bgzip infinite.b.vcf
tabix infinite.a.vcf.gz
tabix infinite.b.vcf.gz

bcftools merge infinite.a.vcf.gz infinite.b.vcf.gz -o out.vcf -m all -0

This outputs the merged first record repeatedly forever:

chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2	0/0:2
chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2	0/0:2
chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2	0/0:2
chr1	80000	id1	G	.	0	PASS	END=90000	GT:CN	0/0:2	0/0:2
[…]

BCFtools 1.17 produced appropriately merged output for these input files. Bisecting shows that the issue arrived with 60c65eb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions