Nextalign CLI

Nextalign CLI is a viral genome sequence alignment tool for command line. It uses the same algorithm that is used in Nextclade Web and Nextclade CLI.

You can learn more about the algorithm in the Algorithm section (Nextalign algorithms is limited to alignment and translation steps).

This section describes:

  • how to install Nextalign CLI - using Docker container and natively

  • how to run Nextalign CLI with sample data

  • what other sections of the documentation are worth checking after that

Installation (with docker)

Container images are available at Docker Hub: 🐋 nextstrain/nextalign

Pull and run the latest version with:

docker pull nextstrain/nextalign:latest
docker run -it --rm nextstrain/nextalign:latest nextalign --help

Pull and run a specific version with:

docker run -it --rm nextstrain/nextalign:2.0.0 nextalign --help

⚠️Don’t forget to mount necessary docker volumes to be able to supply the data into the container and to access the results. You may want to also add --user argument to docker command, to run on behalf of a non-root user and group. This is not specific to Nextclade. Please refer to Docker documentation for more details.

Docker images are available based on:

  • debian (default): Nextclade executable + a set of basic Linux utilities, such as bash, curl and wget, to facilitate usage in workflows

  • alpine: pure Alpine + Nextclade executable

  • scratch: empty image + Nextclade executable

You can choose to use the latest available version (:latest or no tag), or to freeze a specific version (e.g. :2.0.0) or only major version (e.g. :2), or a base image (e.g. :debian) or both version and base image (e.g. :2.0.0-debian), or mix and match.

Tag :latest points to :debian.

Installation (local)

Download manually

You can download the latest version of Nextalign CLI for your platform using one of these direct links:

All versions and their release notes are available on 🐈 Github Releases.

These executables are self-contained and don’t require any dependencies. They can be renamed and moved freely. It is convenient to rename the executable to nextclade and to move to one of the directories included in system $PATH, so that it’s available from any directory in the console.

⚠️ Note that macOS executables are not currently signed with a developer certificate (it requires maintaining a paid Apple developer account). Recent versions of macOS might refuse to run the executable. Before invoking Nextalign on command line, follow these steps to add Nextalign to the exclude list: macOS User Guide: Open a Mac app from an unidentified developer, and check Security settings. Refer to the latest macOS documentation if none of this works.

⚠️ GNU vs musl. Nextalign has two flavors of executables for Linux: “gnu” and “musl”, depending on what libc is used. We recommend “gnu” flavor by default - it is typically faster. However, if for some reason “gnu” flavor does not work, try “musl”.

Download from command line

The following commands can be used to download Nextalign from command line, from shell scripts and inside dockerfiles:

🐧 Linux x86_64 (click to expand)

Download latest version:

curl -fsSL "https://github.com/nextstrain/nextalign/releases/latest/download/nextalign-x86_64-unknown-linux-gnu" -o "nextalign" && chmod +x nextalign

Download specific version:

curl -fsSL "https://github.com/nextstrain/nextclade/releases/download/2.0.0/nextalign-x86_64-unknown-linux-gnu" -o "nextalign" && chmod +x nextalign

🍏 macOS Intel (click to expand)

Download latest version:

curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextalign-x86_64-apple-darwin" -o "nextalign" && chmod +x nextalign

Download specific version:

curl -fsSL "https://github.com/nextstrain/nextclade/releases/download/2.0.0/nextalign-x86_64-apple-darwin" -o "nextalign" && chmod +x nextalign

🍎 macOS Apple Silicon (click to expand)

Download latest version:

curl -fsSL "https://github.com/nextstrain/nextclade/releases/latest/download/nextalign-aarch64-apple-darwin" -o "nextalign" && chmod +x nextalign

Download specific version:

curl -fsSL "https://github.com/nextstrain/nextclade/releases/download/2.0.0/nextalign-aarch64-apple-darwin" -o "nextalign" && chmod +x nextalign

🪟 Windows x86_64 PowerShell (click to expand)

Download latest version:

Invoke-WebRequest https://github.com/nextstrain/nextclade/releases/latest/download/nextalign-x86_64-pc-windows-gnu.exe -O nextalign.exe

Download specific version:

Invoke-WebRequest https://github.com/nextstrain/nextclade/releases/download/2.0.0/nextalign-x86_64-pc-windows-gnu.exe -O nextalign.exe

Using conda

⚠️Note that new versions may appear on bioconda with some delay (hours to weeks)

A Nextalign conda package is available for Linux and macOS from the conda channel bioconda:

conda install -c bioconda nextalign

Usage

Refer to help prompt for usage of Nextalign:

nextalign --help
nextalign run --help

Quick Example

  1. Download the example SARS-CoV-2 data files from GitHub (You can also try other viruses in the data/ directory)

  2. Run:

    nextalign run \
      --input-ref=data/sars-cov-2/reference.fasta \
      --genemap=data/sars-cov-2/genemap.gff \
      --output-all=output/ \
      data/sars-cov-2/sequences.fasta
    

    Add -v to show more information in the console. Add --include-reference flag to also write gap-stripped reference sequence and peptides into outputs.

    There is even more advanced flags to control alignment algorithm. Refer to nextalign run --help for more details.

  3. Find the output files in the output/ directory:

  • nextalign.aligned.fasta - aligned input sequences

  • nextalign.gene_<gene_name>.translation.fasta - aligned peptides corresponding to each gene

What’s next?

Congratulations, You have learned how to use Nextalign CLI!

Going further, you might want to learn about the science behind the Nextalign internals in the Algorithm section. The required input data is described in Input files section. And produced files are described in Output files section.

For a more convenient online tool, check out Nextclade Web.

Nextclade is an open-source project. We welcome ideas and contributions. Head to our GitHub repository if you want to obtain source code and contribute to the project.