-
Notifications
You must be signed in to change notification settings - Fork 442
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
Support 0 coordinate in BCF #1476
Conversation
This need to be rebased on the current The BCF specification says that |
Out of interest, is the BCF spec just pandering to Java here or is there a valid reason for POS being signed? Specifically does BCF permit negative positions? It doesn't particularly make any sense to me and the VCF part of the spec indicates 0 and above only. I see CHROM is also signed, which again makes no sense. I suspect this is just the same issue we had with BAM where some things were lazily defined. As such I don't see the issue with our code treating pos as unsigned, as I'd argue it's the spec that is invalid and not the implementation. Edit: although having said that I see we already use |
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
I also think it's a result of lazy definition, there is no reason for negative coordinates, even on circular chromosomes. Forced pushed a code that is in sync with the latest develop. |
Precisely one negative coordinate is allowed in BCF, specifically -1, as already noted. Hence it's signed in the specification.
So this fix will work, but |
Ah of course, I'm forgetting bcf subtracts 1 from VCF, so the 0 goes negative. Definitely in "wouldn't start from here" territory. :-) |
I've now checked that this fixed the problem reported on |
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 #1475 and samtools/bcftools#1753