A More Common Approach

A better approach is to pass the file into the process with Channel.fromPath() and use input: path reads. The “input:” declares an input variable, not a literal source file location. And we use this variable “reads” our shell command and here $reads means: the local process input variable and use the actual input file that was provided to Nextflow for this task via our workflow. We can also use the reads variable to other things like dynamically name files or any

process CUTADAPT { publishDir “results/” , mode: “copy”

input: path reads_var

output: path ’trimmed.fastq’ script: """ cutadapt -a AACCGGTT -o trimmed.fastq $reads_var “”"}

workflow {

CUTADAPT(Channel.fromPath(’~/sample1.fastq’, checkIfExists: true))

}

Previous
Next
RC Logo RC Logo © 2026 The Rector and Visitors of the University of Virginia