Tutorial: How to Install SamTools, HTSLib, and BCFTools on Ubuntu 18.04
10
gravatar for otwtgin2010
8 months ago by
otwtgin2010130
otwtgin2010130 wrote:

Just thought I would contribute this since figuring it all out was a super confusing process consisting of a few hundred google searches. It's likely it was just me, but maybe there are a few other people like me who will benefit from being able to avoid the process. This was a clean Ubuntu 18.04 install. Probably most people do not have that luxury.

Install Updates and Required Packages

sudo apt-get update
sudo apt-get install gcc
sudo apt-get install make
sudo apt-get install libbz2-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libncurses5-dev 
sudo apt-get install libncursesw5-dev
sudo apt-get install liblzma-dev

Install HTSLIB

cd /usr/bin
wget https://github.com/samtools/htslib/releases/download/1.9/htslib-1.9.tar.bz2
tar -vxjf htslib-1.9.tar.bz2
cd htslib-1.9
make

Install SAMTOOLS

cd ..
wget https://github.com/samtools/samtools/releases/download/1.9/samtools-1.9.tar.bz2
tar -vxjf samtools-1.9.tar.bz2
cd samtools-1.9
make

Install BCFTools

cd ..
wget https://github.com/samtools/bcftools/releases/download/1.9/bcftools-1.9.tar.bz2
tar -vxjf bcftools-1.9.tar.bz2
cd bcftools-1.9
make

Export To Path And Refresh

export PATH="$PATH:/usr/bin/bcftools-1.9"
export PATH="$PATH:/usr/bin/samtools-1.9"
export PATH="$PATH:/usr/bin/htslib-1.9"
source ~/.profile
htslib bcftools tutorial samtools • 5.2k views
ADD COMMENTlink written 8 months ago by otwtgin2010130
5

Thank you otwtgin2010 for the work. Others may benefit from it, if they want to compile these softwares from source. Another option would be to use the Anaconda package manager. With conda, things are as easy as conda install -c bioconda samtools, taking care of the dependencies internally.

ADD REPLYlink written 8 months ago by ATpoint14k
1

This is the best way to go about it, IMO. Neither apt-get nor brew allow creating environments.

ADD REPLYlink written 8 months ago by RamRS20k
1

+1 for sharing your experiences with other users. Keep on contributing!

As Ram said, in this case one should follow the instruction given by the authors of the program.

fin swimmer

ADD REPLYlink written 8 months ago by finswimmer11k

this was super helpful for my attempt to get HTSlib working

ADD REPLYlink written 14 days ago by MaxF10
4
gravatar for RamRS
8 months ago by
RamRS20k
Houston, TX
RamRS20k wrote:

EDIT

Wait, you're using apt-get to install prerequisites but not the actual software you need? Why is that? Pretty sure samtools is available on apt-get.


source ~/.profile might override your $PATH settings if there is a statement in the profile file that overwrites (not appends to) the $PATH variable. You're better off with, say:

mkdir ~/myBinaries/
cd ~/myBinaries/
find /usr/bin/bcftools-1.9/ -type f -executable | xargs -I v_b ln -s v_b ./
find /usr/bin/samtools-1.9/ -type f -executable | xargs -I v_b ln -s v_b ./
find /usr/bin/htslib-1.9/ -type f -executable | xargs -I v_b ln -s v_b ./
cd -
echo 'export PATH=$PATH:~/myBinaries' >>~/.profile
source ~/.profile

Or, use a package manager and not worry about adding stuff to $PATH :-)

ADD COMMENTlink modified 8 months ago • written 8 months ago by RamRS20k

Got it - thank-you for the clarification! i tried apt-get but it was installing old versions. And the old versions were super buggy and didn't work with a lot of my sample files.

ADD REPLYlink written 8 months ago by otwtgin2010130
1

I see. Also, this information is available directly on the htslib site: http://www.htslib.org/download/

Plus the post contains less information than what's available on that site. Why create this post?

ADD REPLYlink written 8 months ago by RamRS20k
1

Thanks. Yeah, for someone who knows as much as they should, that would no doubt be plenty. But i guess for those who knows as little as i do :) - the things like how you download the file, how you extract it (or even that you need to extract it), that you need "make" installed are not self-evident.

ADD REPLYlink written 8 months ago by otwtgin2010130
1

You're right, but that's a rabbit hole. We have to stick to some pre-requisites that we can assume people that come here know. Command line basics is one of them. How to download a file (not necessarily using the command line), un-archive it (tar options, computer science stuff), cd into directories, know sudo stuff, etc. People who do not know that should be working with bioinformaticians who do and learning in the process, not searching online.

ADD REPLYlink modified 8 months ago • written 8 months ago by RamRS20k
1

Thanks and true! i guess i have a tendency to create my roof before my foundation, and the assumption that most others are the same way is an invalid one. And i don't mean this to be my personal beef about documentation that is not sufficient enough to make up for my lack of basic knowledge. Just hoping it will help someone else.

ADD REPLYlink written 8 months ago by otwtgin2010130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2024 users visited in the last hour