For the impatient
The latest source code can be downloaded from github using:
git clone git://github.com/samtools/htslib.git git clone git://github.com/samtools/bcftools.git cd bcftools # The following is optional: # autoheader && autoconf && ./configure --enable-libgsl --enable-perl-filters make
In order to use the BCFtools plugins, this environment variable must
be set and point to the correct location:
BCFtools and HTSlib depend on the
zlib library http://zlib.net, the
library http://bzip.org/ and
liblzma http://tukaani.org/xz/. Building
them requires development files to be installed on the build machine;
note that some Linux distributions package these separately from the library
itself (see below).
liblzma dependencies can be removed if full CRAM support
is not needed - see HTSlib’s INSTALL file for details.
Packages for dpkg-based Linux distributions (Debian / Ubuntu) are:
zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev or libcurl4-openssl-dev libssl-dev libncurses5-dev
Packages for rpm or yum-based Linux distributions (RedHat / Fedora / CentOS) are:
zlib-devel bzip2 bzip2-devel xz-devel curl-devel openssl-devel ncurses-devel
Packages on MacOS, assuming Xcode is installed:
xz gsl (optional)
To build BCFtools, you will need:
GNU make C compiler (e.g. gcc or clang)
In addition, building the configure script requires:
Running the configure script uses awk, along with a number of standard UNIX tools (cat, cp, grep, mv, rm, sed, among others). Almost all installations will have these already.
Running the test harness (make test) uses:
This step is only needed if configure.ac has been changed, or if configure does not exist (for example, when building from a git clone). The configure script and config.h.in can be built by running:
If you have a full GNU autotools install, you can alternatively run:
AC_CONFIG_SUBDIRS: you should use literals can be ignored
or supressed using
cd to the bcftools directory containing the package’s source and type:
If installing from a tarballs (as opposed form github), BCFtools release contains a copy of HTSlib which will
be used to build BCFtools. If you already have a system-installed HTSlib or another HTSlib that you would
prefer to build against, you can arrange this by using the configure script’s
--with-htslib option. Use
--with-htslib=DIR to point to an HTSlib source tree or installation in DIR; or
use a system-installed HTSlib. When downloaded from github and
--with-htslib option is not given, the directory
../htslib is used.
Optional Compilation with Perl
-e options can take external perl scripts for a more
sophisticated filtering. This option can be enabled by supplying the
--enable-perl-filters option to configure before running make:
Note that enabling this option changes the license from MIT to GPL because bcftools need to be built with
perl -MExtUtils::Embed -e ccopts -e ldopts
Note that when compiling on MacOS, the default options for linking with Perl
provided by the system sometimes do not work. It was reported that removing
the occurance of
-arch i386 from
config.mk solved the problem.
Optional Compilation with GSL
polysomy command depends on the GNU Scientific Library (GSL) and is not
enabled by default. In order to compile it, supply the
option to configure before running make:
The GNU Scientific Library depends on the cblas library. The configure
script will look for both libcblas and libgslcblas, in that order. If
you have more than one version of cblas installed and want to override its
choice you can do this by using either
Note that GSL is distributed under the GNU General Public License (GPL). When --enable-libgsl is used to compile bcftools, the resulting program will also be GPL licensed. If you want to distribute the program, you MUST do so under terms compatible with that license. A copy of the GPL is included in the LICENSE file, or can be downloaded from http://www.gnu.org/copyleft/gpl.html.
In the default compilation mode the program is dual licensed and you may choose to be licensed under the terms of the MIT/Expat license or the GNU General Public License (GPL).
Information on the GNU Scientific Library, including the rationale for its choice of license can be found at https://www.gnu.org/software/gsl/.
make install to install the bcftools executable and associated scripts
and a manual page to
/usr/local. This can be
changed by using the configure script’s
The install target also understands DESTDIR and the other usual installation directory variables.
The bgzip and tabix utilities are provided by HTSlib. If you have not also installed HTSlib separately, you may wish to install these utilities by hand by copying the programs to the same bin directory to which you have installed bcftools et al.
We welcome your feedback, please help us improve this page by either opening an issue on github or editing it directly and sending a pull request.