Install Samtools

Click here to go back to the identity Installation page.

Samtools is a very simple program to install. This page gives step by step instructions; for advances users simply download the source, unpack, and use 'make' to build it.

Downloading Samtools

Click on this link: Samtools then click on the link 'Download samtools-0.X.XX.tar.bz2 (XXX kB)' at the top which will look something like this:


This will automatically download a copy of the Samtools source code to your computer after a five second delay. You can either copy this download to your HPC (e.g. using Filezilla) or you can copy the weblink on the page that you see after clicking on the link right click on the 'direct link' and clicking 'Copy Link'.


Then after logging into the HPC type 'wget ' (note the space after wget) and paste the link. It should look something like this:


Unpacking Samtools

The Samtools package contains many files that are packaged using 'tar' and compressed using 'bunzip2'. To unpack the file use the command:

tar xjvf samtools-0.1.19.tar.bz2

Note that you may need to change the numbers in the command to match your version. If this works you should see a list of files streaming past on the screen.

Installing Samtools

Once the package has been unpacked you need to change directory into the Samtools directory ('cd' command) then build the package using 'make':

cd samtools-0.1.19

Again you should see files streaming past. Once this is complete (takes about 2min) the directory should contain the following files (use the 'ls' command):


To run Samtools simply type 'samtools', press return and you should see the program describe how it should be used like this:


Adding Samtools to the path

To make using samtools simple the directory is often added to the 'path' so that the directory it has been installed in does not need to be specified. This can be done by editing the '.bashrc' file directly, e.g. using nano which is installed on most HPCs, or by using these two commands (note this will only work if you do not change directory):

echo 'export PATH=`pwd`:$PATH' >> ~/.bashrc
source ~/.bashrc
which samtools

NB: If you are installing on a Mac then you will need to use '~/.profile' instead of '~/.bashrc'.

If this works the 'which samtools' command should show a directory path followed by 'samtools'; in addition if you change directory and type 'samtools' it should still run the program.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License