Creating our pipeline

John Salamon

Aug 28, 2024

Creating our project dir

A brief word on configuration

executor {
    name = 'local'
    cpus = 2
    memory = '4 GB'
}

We can also specify our conda environment, if we wish:

conda.enabled = true

// This is actually a per-process option, as we may have many different envs
process.conda = "assets/environment.yml"

Getting files as inputs, and using params

params.samplesheet = 'assets/samplesheet.csv'
nextflow main.nf --samplesheet 'assets/samplesheet.csv'
channel.of( file('samplesheet.csv') )
        | splitCsv( header: true )

Adding metadata to channels

input:
tuple val(id), path(reads)

output:
tuple val(id), path('*.json'), emit: json

Specifying resources in config

label 'process_low'
process {
    withLabel: 'process_low' {
        cpus = 1
    }
}

Config options can be accessed via task:

"""
# map reads
echo "mapping reads"
minimap2 -t ${task.cpus} -a -x sr ${genome} ${reads} > ${id}.sam 2> ${id}.minimap2.log
"""

Getting results out

publishDir "${params.outdir}", pattern: "*.html"