dhtslib relies on htslib. htslib relies on a handful of compression and web-access libraries: zlib, bzip2, lzma, curl, and ssl. Technically htslib can be built without some of these libraries, though to get all the benefits of dhtslib we recommend installing all of them. For more information you can visit the htslib repository.
To intall htslib dependencies:
Debian/Ubuntu---------------sudoapt-getupdate# Ensure the package list is up to datesudoapt-getinstallautoconfautomakemakegccperlzlib1g-devlibbz2-devliblzma-devlibcurl4-gnutls-devlibssl-devNote:libcurl4-openssl-devcanbeusedasanalternativetolibcurl4-gnutls-dev.RedHat/CentOS/AmazonLinux---------------sudoyuminstallautoconfautomakemakegccperl-Data-Dumperzlib-develbzip2bzip2-develxz-develcurl-developenssl-develAlpineLinux------------sudoapkupdate# Ensure the package list is up to datesudoapkaddautoconfautomakemakegccmusl-devperlbashzlib-devbzip2-devxz-devcurl-devlibressl-devOpenSUSE--------sudozypperinstallautoconfautomakemakegccperlzlib-devellibbz2-develxz-devellibcurl-devellibopenssl-develMacOS-----brewinstallxzautoconfautomake
libdeflate can also be installed for faster (de)compression but is optional.
htslib build and install
You will then need to download htslib (latest release here). As of now we support versions >=1.10. To install htslib:
htslib is also linked as a submodule in the dhtslib repo and potentially could be used as it reflects the currently supported version (you must git clone recursively).
Troubleshooting
dub linking issues
By default htslib is dynamically linked to dhtslib via dub.Sometimes it is necessary to specify the LIBRARY_PATH or LD_LIBRARY_PATH environment variables in order for dub and the D compilers to find your htslib installation. This could also apply if your htslib isn't a standard install under /usr/local/lib.
Statically linking to htslib
libhts.a needs to be added to your project's source files. Remember to link to all dynamic libraries configured when htslib was built. This may include bz2, lzma, zlib, deflate, crypto, pthreads, curl. Finally, if statically linking, the -lhts flag needs to be removed from compilation by selecting the dub configuration source-static as the dub configuration type for dhtslib within your own project's dub configuration file:
curl https://github.com/samtools/htslib/releases/download/1.12/htslib-1.12.tar.bz2 -o htslib-1.12.tar.bz2
tar -xjf htslib-1.12.tar.bz2
cd htslib-1.12
./configure
make
sudo make install
cd htslib
autoreconf -i
./configure
make
sudo make install