# Nextflow

Nextflow provides a modern execution stack for bioinformatics, featuring a Groovy-based DSL with reactive streams. It supports multiple backends including Docker and runs on any POSIX-compatible system, with Windows support through [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10).&#x20;

## Prerequisites

* Java 8 or higher
* [Docker](https://docs.docker.com/desktop/)
* Optional: cURL,  [git](https://git-scm.com/downloads), [Conda](https://www.anaconda.com/products/individual#Downloads)
* For Windows only: [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10)

## Getting Started

The following software and workflow are required and will be downloaded, installed, and used as part of this tutorial:

* [Nextflow](https://www.nextflow.io/)
* [02\_download\_collection\_files.nf](https://raw.githubusercontent.com/DNAstack/dnastack-client-library-worked-examples/master/examples/nextflow/02_download_collection_files.nf)
* [nextflow.config](https://raw.githubusercontent.com/DNAstack/dnastack-client-library-worked-examples/master/examples/nextflow/nextflow.config)

## Getting the Example Workflow

### **Clone with Git**

```shell
git clone https://github.com/DNAstack/dnastack-client-library-worked-examples.git
```

Or [Download](https://github.com/DNAstack/dnastack-client-library-worked-examples/archive/refs/heads/master.zip) and Unzip

It is assumed that all commands will be run from the root directory of this repository on your local machine. From the directory where you’ve downloaded the examples repository.

```shell
cd dnastack-client-library-worked-examples/
```

## Installing Nextflow

Download and install [Nextflow](https://www.nextflow.io/) by one of the following methods.

### Using cURL or [direct from this link](https://get.nextflow.io/), and allow execution permission

```shell
curl -o nextflow -L https://get.nextflow.io # Or directly from web link

chmod +x nextflow
```

### Or Using Conda

```shell
conda install -c bioconda nextflow
```

## Running the workflow

### To run the workflow

```shell
./nextflow run --config examples/nextflow/nextflow.config examples/nextflow/02_download_collection_files.nf
```

Output files can be found in the current directory.

## Nextflow Tower

Nextflow Tower provides centralized monitoring and logging for your workflows. To enable Tower:

1. Add the following to the configuration file `nextflow.config`. Replace with your specific access token.

```
docker.enabled = true
tower {
    enabled = true
    accessToken = '<YOUR TOKEN>'
}
```

2. Find your access token in the user menu under "Your tokens"
3. View workflow details in the "runs" section
