diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2764fe91..63969e2d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,10 @@ Changelog version 1.2.0-dev ----------------- ++ Bgzip files are now detected and a smaller reading buffer is used to + accomodate the fact that bgzip blocks are typically less than 64K. (Unlike + normal gzip files that consist of one block that spans the entire file.) + This has reduced decompression time for bgzip files by roughly 12%. + Speed-up source build by using ISA-L Unix-specific makefile rather than the autotools build. + Simplify build setup. ISA-L release flags are now used and not diff --git a/src/isal/igzip.py b/src/isal/igzip.py index fe19dc56..167c1f4f 100644 --- a/src/isal/igzip.py +++ b/src/isal/igzip.py @@ -220,6 +220,22 @@ def write(self, data): return length +def detect_bgzip(header: bytes) -> bool: + if len(header) < 18: + return False + magic, method, flags, mtime, xfl, os, xlen, si1, si2, slen, bsize = \ + struct.unpack("