# Nextflow

> Scalable, reproducible, portable data-driven pipelines

- Category: Science & Biomedical AI / Scientific Workflow Orchestration
- Language: Groovy
- Repository: https://github.com/nextflow-io/nextflow
- Website: https://www.nextflow.io
- Canonical page: https://ai-tldr.dev/tools/nextflow/

## In short

Nextflow is a workflow system for creating scalable, portable, and reproducible pipelines. It sits in the Scientific Workflow Orchestration category of the Science & Biomedical AI tools and is open-source, written in Groovy. To get started: check Java.

## Overview

Nextflow is a workflow system for creating scalable, portable, and reproducible pipelines. It is based on a dataflow programming model, where you describe your work as a set of processes connected by channels of data, and Nextflow handles running those processes in parallel and in the right order.

It is built around a domain-specific language (DSL) for data-driven computational pipelines. You can combine existing scripts and tools written in different languages inside a pipeline without rewriting them, so it is widely used for genomics and bioinformatics work where many separate tools are chained together.

The same pipeline runs unchanged across many environments. Nextflow separates the pipeline logic from the execution layer, so it can run on a local machine, HPC batch schedulers, cloud batch services, and Kubernetes, using containers or package managers to supply software dependencies.

## What it does

- Dataflow programming model where parallelism is defined implicitly through process declarations connected by channels
- Runs the same pipeline on a local machine, HPC schedulers, cloud batch services, and Kubernetes
- Supports HPC batch schedulers including SLURM, LSF, PBS, HTCondor, and GridEngine
- Runs on cloud platforms including AWS Batch, Azure Batch, and Google Cloud Batch
- Manages software dependencies through containers and package managers including Docker, Podman, Singularity, Conda, and Spack
- Continuous checkpoints track intermediate results so a pipeline can resume from the last successful step

## Getting started

Install Nextflow with the install script, confirm it works, then run a demo pipeline from the terminal.

1. Check Java

   Nextflow requires Java 17 or later. Check the installed version before installing.

```bash
java -version
```

2. Install Nextflow

   Download Nextflow with the install script, which creates the nextflow executable in the current directory, then make it executable.

```bash
curl -s https://get.nextflow.io | bash
chmod +x nextflow
```

3. Verify the installation

   Confirm Nextflow is installed correctly. You can move the executable to a directory in your PATH to run it from anywhere.

```bash
nextflow info
```

4. Run a demo pipeline

   Run the built-in hello pipeline to check that Nextflow can execute a workflow end to end.

```bash
nextflow run hello
```

## When to use it

- Build genomics and bioinformatics pipelines that chain together many separate command-line tools
- Run the same analysis pipeline on a laptop, an HPC cluster, or a cloud batch service without rewriting it
- Package each step in a container with Docker or Singularity so runs are reproducible across machines
- Resume a long-running pipeline from the last successful step after a failure using continuous checkpoints
