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
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
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
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.
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 :)
This is the best way to go about it, IMO. Neither apt-get nor brew allow creating environments.
+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.
THANKS SO MUCH! Also, since a lot of people also use BWA with Samtools, here's what I did to also download that through the command line:
Thanks for the method list very helpful. I have set this up using windows 10 - WSL and Ubuntu 22.04 which is working. There were a couple of additional things I found along he way - install apt-get install bzip2 before htslib / samtools etc.. it wasn't there for the Ubuntu Install. My setup required sudo from fresh for each install. The above bwa release has a bug when running make - apparently linked to gcc 10. I used sudo chmod 777 usr/bin/bwa-0.7.17 to allow modification of file rle.h. Once the folder permission in my case was granted, I used vi and modified the file following make file failed on gcc 10 then added to PATH as above.
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
Still, it would be easier to use a package manager such as
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:
I just wanted to thank you! This still works as of 12/21/21 and version 1.14 for all software