-
Notifications
You must be signed in to change notification settings - Fork 459
Description
A reminder to my future self, or to inspire others with time on their hands. :-)
An htslib built without finding xz-utils / lzma library is possible, with appropriate configure opts, but this limits potential compatibility with valid files (albeit currently rare). Maybe we could just include an lzma decoder to use in such circumstances so lzma CRAM can still be decoded even if htslib cannot create new ones.
Not high priority as the easy win is simply to require people to use the official library. However I didn't realise how short such code could be. See https://github.com/Shelwien/lzma_sh
The official version from lzma author is LzmaSpec.cpp, 715 lines including main and file I/O. That's public domain. The shortest version there is just 228 lines (still including main and file I/O), but is GPLed. All appear to work. We'd need to de-C++ them, but it demonstrates that at the heart of it the decode format is relatively straight forward.
I've seen very short (~200 line of JavaScript) bz2 decoders too.