Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0 coordinate overflows in VCF format #1475

Closed
Rapsssito opened this issue Jul 20, 2022 · 1 comment
Closed

0 coordinate overflows in VCF format #1475

Rapsssito opened this issue Jul 20, 2022 · 1 comment

Comments

@Rapsssito
Copy link

As stated here: samtools/bcftools#1753. There is an overflow issue when treating a VCF file with zero positions. Here is an example:

Unsorted VCF

MT	0	1915430843:1	N	]MT:16640]N	99	PASS	.
MT	0	3110098432:1	N	]MT:16638]N	99	PASS	.
MT	16638	3110098432:2	G	G[MT:0[	99	PASS	.
MT	16640	1915430843:2	G	G[MT:0[	99	PASS	.

Commands

bcftools sort test.vcf -o test.sorted.vcf

Sorted VCF

MT	4294967296	3110098432:1	N	]MT:16638]N	99	PASS	.
MT	4294967296	1915430843:1	N	]MT:16640]N	99	PASS	.
MT	16638	3110098432:2	G	G[MT:0[	99	PASS	.
MT	16640	1915430843:2	G	G[MT:0[	99	PASS	.

Note how the 0 from 3110098432:1 has been wrongly changed to 4294967296.

As described by @pd3 in samtools/bcftools#1753 (comment):

This problem is not specific to bcftools sort but to a round trip through BCF via htslib. The format stores 0-based position in hts_pos_t type and 0 coordinate overflows. This needs to be fixed in htslib.

@daviesrob, could you check this out?

pd3 added a commit to pd3/htslib that referenced this issue Jul 20, 2022
The 0 coordinate is valid in VCF specification, but the round-trip
VCF -> BCF -> VCF turns MT:0 into MT:4294967296. Add a check to
detect this overflow.

See samtools#1475 and samtools/bcftools#1753
pd3 added a commit to pd3/htslib that referenced this issue Jul 20, 2022
The 0 coordinate is valid in VCF specification, but the round-trip
VCF -> BCF -> VCF turns MT:0 into MT:4294967296. Add a check to
detect this overflow.

See samtools#1475 and samtools/bcftools#1753
@daviesrob
Copy link
Member

Fixed by #1476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants