Anna Syme

Click name ↑ to return to homepage

Nextflow - introduction

Install

see https://www.nextflow.io/

java -version
#needs to be > version 8
curl -s https://get.nextflow.io | bash
./nextflow run hello

Create a file

A simple nextflow file is this:

#!/usr/bin/env nextflow

process sayhello {
  echo true
  script:
  """
  echo this works, hello
  """
}

There are no inputs or outputs, this just prints to the screen.

Create this (e.g. nano main.nf, then paste in)

Run: ./nextflow run main.nf

“this works, hello” should print to screen.

Add inputs

#!/usr/bin/env nextflow

params.reads = "example.fa"  //replace with [--reads yourfile] at run 
reads_ch = Channel.fromPath(params.reads) //A channel to send the file

process thing {
        echo true

        input:
        file x from reads_ch

        script:
        """
        echo yes
        echo $x
        """
}

Run: ./nextflow run main.nf --reads R1.fastq