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
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.This is the best way to go about it, IMO. Neither apt-get nor brew allow creating environments.
Good direction to find an installer package for Samtools. As an FYI based on the original poster, here is the full instructions for Noobs:
Note that the installer for Conda is for the Python2.7, 64-bit version. Select the appropriate path for something else. The Conda installer takes care of other dependencies including Python itself. It could be even simpler if they registered an install package for Miniconda in APT :)
+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
this was super helpful for my attempt to get HTSlib working
That was an extremely helpful walk-through. I've been trying to install BCFtools following their guidelines, but failing miserably (the operation would stop due to not finding curl:curl.h directory). Now, it has worked just fine.
And sorry for the lay question - I am still taking slow steps in learning Unix - but what is the meaning of the last step, "export to path and refresh"? I tried looking on the
export --help
, but I am still quite not sure what it does.Many thanks, @otwtgin2010 !
It means that you have to put the folder where the executable is in into your
.bashrc
or.bash_profile
likeStill, it would be easier to use a package manager such as
conda
.The reason why you got an error when building bcftools was that there is one missing dependency. Adding one more following then you will be fine: