Skip to content
Benjamin Buchfink edited this page Nov 2, 2024 · 35 revisions

Requirements

DIAMOND compiles as generic C++ code and has no particular requirements on the hardware architecture, but it makes use of the SSE and AVX instruction sets of the Intel/AMD x86-64 platform if available and will run considerably faster on that platform. It runs on POSIX-compatible operating systems (Linux, FreeBSD, macOS) as well as on Microsoft Windows.

A high-memory server is recommended for better performance, but the program can be run on standard desktop computers or laptops.

Compiled binaries are available for download for Linux, macOS (via Bioconda), FreeBSD (via pkg) and Windows. For best performance, it is recommended to natively compile the software from source on the target system.

The software has been tested on Ubuntu 18.04 bionic, Ubuntu 14.04 trusty, CentOS 7, macOS 10.13 and Microsoft Windows 10.

Binary download

Linux

A precompiled binary is available for recent Linux systems and may be downloaded for immediate use:

wget http://github.com/bbuchfink/diamond/releases/download/v2.1.10/diamond-linux64.tar.gz
tar xzf diamond-linux64.tar.gz

This is a portable binary that contains three separate code paths for systems that support AVX2, systems that support SSE4.1, SSSE3 and POPCNT, as well as generic x86-64 systems that only support SSE2.

Since version 2.0.8, this binary also includes support for using BLAST databases.

If the binary does not work on your system, i.e. you are getting error messages like Kernel too old, please try another installation method or compile the software from source.

Linux/macOS (via Bioconda)

Install Bioconda on your system if not already present, then install DIAMOND using this shell command:

conda install -c bioconda -c conda-forge diamond

It is important to add the -c conda-forge channel, otherwise an old and outdated Diamond version (v0.9.14) will be installed.

Regularly updating to the latest version is also recommended:

conda update diamond

Linux (via Docker)

To pull the latest version of the official Docker container:

docker pull buchfink/diamond

To pull a specific version:

docker pull buchfink/diamond:version2.1.9

The Docker container supports using BLAST databases since v2.0.9.

macOS (via Homebrew)

To install via Homebrew:

brew install diamond

FreeBSD

On FreeBSD, you can use pkg install diamond to install the software.

Windows

A binary executable for Windows can be downloaded at the GitHub Releases page. You also need to install the Visual C++ Redistributable.

Compiling from source

Compilation requires GCC 4.8.1 or later, CMake 2.6 or later as well as libpthread and zlib including development headers. To compile DIAMOND from source, invoke the following commands on the shell:

wget http://github.com/bbuchfink/diamond/archive/v2.1.10.tar.gz
tar xzf v2.1.10.tar.gz
cd diamond-2.1.10
mkdir bin
cd bin
cmake ..
make -j $(nproc --all)
sudo make install

Note:

  • sudo rights are not needed. To install the software within the bin/ folder of your home directory, use: cmake -DCMAKE_INSTALL_PREFIX=$HOME ..
  • Use cmake -DCMAKE_BUILD_MARCH=native to perform a native compile.
  • By default, a portable binary will be created that contains three separate code paths for systems that support AVX2, systems that support SSE4.1, SSSE3 and POPCNT, as well as generic x86-64 systems that only support SSE2.
  • You can use cmake -DSTATIC_LIBGCC=ON -DSTATIC_LIBSTDC++=ON to create a more easily portable binary.
  • Use cmake -DWITH_ZSTD=ON to compile with zstd support. The library has to be installed on the system. For example, on Debian-based systems run apt install libzstd-dev.
  • The compilation time should be about 4 minutes.

BLAST database support

Support for using BLAST databases in not included by default and needs to be enabled by linking against the libraries from the NCBI toolkit. This can either be done by using shared libraries provided by the operating system, or by using self-compiled libraries. The zstd and sqlite3-development libraries are required for compilation.

OS libraries

First, install BLAST on your system using the package manager. For example, on Debian-based systems this can be done by running sudo apt install ncbi-blast+. Check the BLAST version by running blastp -version. If the system's BLAST version is lower than 2.9.0, it is instead recommended to use self-compiled libraries due to a lack of support for the version 5 database format in older BLAST versions. Using a BLAST version lower than 2.9.0 is also untested.

While we are linking against shared system libraries, the header files needed for compilation are not included in any Debian package at this time, so you will need to download these separately and go through the BLAST build process to get usable headers. For this, download the BLAST sources that correspond to your operating system's BLAST version here: https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/

This is an example for the complete procedure tested on Ubuntu 20.04:

cd
sudo apt install ncbi-blast+
# change the BLAST version if needed
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.9.0/ncbi-blast-2.9.0+-src.tar.gz
tar xzf ncbi-blast-2.9.0+-src.tar.gz
cd ncbi-blast-2.9.0+-src/c++
./configure --prefix=$HOME/BLAST2.9 --without-debug --without-exe --without-boost --without-gui
make -j $(nproc --all)
make install
cd
wget https://github.com/bbuchfink/diamond/archive/v2.1.10.tar.gz
tar xzf v2.1.10.tar.gz
mkdir diamond-2.1.10/bin
cd diamond-2.1.10/bin
cmake -DBLAST_INCLUDE_DIR=$HOME/BLAST2.9/include/ncbi-tools++ ..
make -j $(nproc --all)
sudo make install

Self-compiled libraries

If the system's BLAST version is too old or a more easily portable binary is required, you can statically link against the self-compiled BLAST libraries. This procedure was tested on CentOS 7:

cd
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.11.0/ncbi-blast-2.11.0+-src.tar.gz
tar xzf ncbi-blast-2.11.0+-src.tar.gz
cd ncbi-blast-2.11.0+-src/c++
./configure --prefix=$HOME/BLAST2.11 --with-static --without-debug --without-exe --without-boost --without-gui
make -j $(nproc --all)
make install
cd
wget https://github.com/bbuchfink/diamond/archive/v2.1.10.tar.gz
tar xzf v2.1.10.tar.gz
mkdir diamond-2.1.10/bin
cd diamond-2.1.10/bin
cmake -DBLAST_INCLUDE_DIR=$HOME/BLAST2.11/include/ncbi-tools++ -DBLAST_LIBRARY_DIR=$HOME/BLAST2.11/lib ..
make -j $(nproc --all)
sudo make install