(QuickTip) Automatic installation of the latest HTSlib
When setting up Ubuntu/Debian machines for biology, I sometimes need to have HTSlib installed separately from SAMtools. I also need this done automatically, without my intervention (E.G.: for the creation of Amazon Machine Images). To do this, I do the following as Root.
- Make sure that HTSlib’s prerequisites are installed.
apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev - Make a new directory where you want to install HTSlib and navigate to it.
- Run the following commands to grab the .tar.bz2 file from Github, untar it and install it.
curl -s https://api.github.com/repos/samtools/htslib/releases/latest \ | grep '"browser_download_url":.*bz2"$' \ | awk '{print $2}' \ | xargs wget tar -xvf *.bz2 cd $(ls -d */) autoreconf -i ./configure make make install
This can optionally be tested with pkg-config --exists htslib && echo OK