HTSlib is an open-source C library designed for handling high-throughput sequencing (HTS) data [1]. It provides the underlying functionality for manipulating various file formats commonly used in genomics, such as SAM (Sequence Alignment/Map), BAM (Binary Alignment/Map), CRAM (Compressed Reference-oriented Alignment Map), and VCF (Variant Call Format). In this article, we are installing on Ubuntu (Linux).
Preparing system
It is good to update and upgrade your Ubuntu system first. Log into your Ubuntu system and open the terminal by pressing Ctrl+Alt+T altogether, and type the following commands:
$ sudo apt-get update
$ sudo apt-get upgrade
Downloading HTSlib
Change to the directory where you want to download (here, it is Downloads). Open a terminal and paste the following command to download HTSlib.
$ cd Downloads/
$ wget https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2
Installing Prerequisites
Install the following libraries before proceeding.
$ sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libdeflate-dev
Installing HTSlib
Untar the package.
$ tar xvjf htslib-1.20.tar.bz2
Move inside the new HTSlib directory (htslib-1.20) and install it using the following commands
$ cd htslib-1.20/
$ ./configure
$ make
$ sudo make install
Verify Installation
You can check if HTSlib is installed correctly by running:
$ htsfile
This should display the usage information for HTSlib.
Update Library Paths
You might need to update your library paths to include the directory where HTSlib was installed. Paste the following command in the terminal.
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Now reload the profile as follows
$ source ~/.bashrc
References
- Bonfield, J. K., Marshall, J., Danecek, P., Li, H., Ohan, V., Whitwham, A., … & Davies, R. M. (2021). HTSlib: C library for reading/writing high-throughput sequencing data. Gigascience, 10(2), giab007.