Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix on-the-fly indexing of VCF w.r.t virtual offsets.
When using bcftools view --write-index -o out.vcf.gz the virtual file offsets can differ depending on whether we do a bgzf_tell before or after a flush. Specifically it could point to the last byte in the current BGZF block or the first byte in the next BGZF block. Ultimately both of these resolve to the same physical location, but in some situations the former may mean attempting to read zero bytes (the remainder of the bgzf block). This has been known in the past to be misinterpreted as an EOF. (See samtools/samtools#1861) It also means the contents of the index produced by --write-index and a separate bcftools index command can yield different results, albeit both representing the same data. The fix for the samtools / bcftools issue above (#1672) when multi-threading inadvertently recreated the bug when not multi-threading. Fixes samtools/bcftools#2267
- Loading branch information