Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flaviaerius/feffdce5cb37d0933c4803fbf1473e8c to your computer and use it in GitHub Desktop.
Save flaviaerius/feffdce5cb37d0933c4803fbf1473e8c to your computer and use it in GitHub Desktop.
Install samtools, bcftools and htslib on linux

Install samtools, bcftools, htslib, bedtools, and plink2 on linux

Install some build dependencies

sudo apt update

sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev wget libncurses5-dev bzip2
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
wget https://github.com/samtools/bcftools/releases/download/1.16/bcftools-1.16.tar.bz2 -O bcftools.tar.bz2
tar -xjvf bcftools.tar.bz2
cd bcftools-1.16
make
sudo make prefix=/usr/local/bin install
sudo ln -s /usr/local/bin/bin/bcftools /usr/bin/bcftools
# TODO add here the right address for: export BCFTOOLS_PLUGINS=/path/to/bcftools/plugins
# bcftools plugins are needed to use, for example, fill-tags, to annotate allele frequency
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
wget https://github.com/arq5x/bedtools2/releases/download/v2.30.0/bedtools.static.binary
mv bedtools.static.binary bedtools
chmod a+x bedtools
sudo mv bedtools /usr/local/bin
sudo apt-get install plink2
wget https://dalexander.github.io/admixture/binaries/admixture_linux-1.3.0.tar.gz
tar -xvzf admixture_linux-1.3.0.tar.gz

# use admixture32 to do a supervised analysis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment