Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install samtools, bcftools and htslib on linux

Install Samtools, BCFTools and htslib on linux

samtools

$ wget https://github.com/samtools/samtools/releases/download/1.3.1/samtools-1.3.1.tar.bz2 -O samtools.tar.bz2
$ tar -xjvf samtools.tar.bz2
$ cd samtools-{version}
$ make
$ sudo make prefix=/usr/local/bin install
# if you have old version such as 0.x from samtoos, you may remove it and create a link to new version
$ sudo apt remove samtools
$ sudo ln -s /usr/local/bin/bin/samtoos /usr/bin/samtools
# Or, you can just use the path to call samtools
$ /usr/loca/bin/bin/samtoos -h

BCFtools

$ wget https://github.com/samtools/bcftools/releases/download/1.3.1/bcftools-1.3.1.tar.bz2 -O bcftools.tar.bz2
$ tar -xjvf bcftools.tar.bz2
$ cd bcftools-{version}
$ make
$ sudo make prefix=/usr/local/bin install
$ sudo ln -s /usr/local/bin/bin/bcftools /usr/bin/bcftools

HTSlib

$ wget https://github.com/samtools/htslib/releases/download/1.3.2/htslib-1.3.2.tar.bz2 -O htslib.tar.bz2
$ tar -xjvf htslib.tar.bz2
$ cd htslib-{version}
$ make
$ sudo make install
@Farah74

This comment has been minimized.

Copy link

commented Mar 14, 2017

Hi ,

I'm trying to update my samtools (v0.1.18) to (v1.3.1), but got stuck here.

$ sudo make prefix=/usr/local/bin install

[sudo] password for biouser:

I've downloaded the Linux when I was in the RNASeq course before. I've tried to email them but the email was not sent. How can I proceed without typing in the password?

Thank you.

@musohail1

This comment has been minimized.

Copy link

commented Feb 4, 2018

Hello Colleagues,

I tried to install SAMtools using above protocol but when I used command 'make' it gave me following error

bam_tview_curses.c:41:20: fatal error: curses.h: No such file or directory
compilation terminated.
Makefile:133: recipe for target 'bam_tview_curses.o' failed
make: *** [bam_tview_curses.o] Error 1

PLEASE GUIDE

@samesense

This comment has been minimized.

Copy link

commented Feb 22, 2018

@musohail1 You need to install ncurses. For example, on debian/ubuntu:
sudo apt-get install libncurses5-dev libncursesw5-dev

@zsewa

This comment has been minimized.

Copy link

commented Mar 27, 2019

Hi adefelicibus,
thanks for the guide.

There are some typos in the install guide for samtools.
samtools is written as samtoos in some places.

Also consider adding the commands to install the build dependencies (according to https://github.com/samtools/samtools/blob/develop/INSTALL):

sudo apt-get update  # Ensure the package list is up to date
sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libncurses5-dev

Altogether my propose for the samtools section would be:

$ sudo apt-get update && sudo apt-get install -y autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libncurses5-dev
$ wget https://github.com/samtools/samtools/releases/download/1.3.1/samtools-1.3.1.tar.bz2 -O samtools.tar.bz2
$ tar -xjvf samtools.tar.bz2
$ cd samtools-{version}
$ make
$ sudo make prefix=/usr/local/bin install
# if you have old version such as 0.x from samtools, you may remove it and create a link to new version
$ sudo apt remove samtools
$ sudo ln -s /usr/local/bin/bin/samtools /usr/bin/samtools
# Or, you can just use the path to call samtools
$ /usr/loca/bin/bin/samtools -h

Thanks and have a nice time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.