Minor style improvents

This commit provides a minor refactoring with som
Nextflow code style improvments:
- Replaces `.toGiga()` with `.giga`
- Replaces `tag { foo }` with `tag "$foo"`
- Move publishDir before input declarations. Directives should be
  before the first input. Tho this is not enforced, it may be in
  future versions.
- Replaces input `file` with `path`
- Remove unnecessary parentheses
This commit is contained in:
Paolo Di Tommaso 2020-07-27 12:11:42 +02:00
parent 6dfb9f02c9
commit 70daf8be30
No known key found for this signature in database
GPG key ID: E6935EB42EE2957A
15 changed files with 59 additions and 57 deletions

View file

@ -8,6 +8,9 @@ process BOWTIE2 {
// label 'bigMem' // label 'bigMem'
// label 'multiCore' // label 'multiCore'
publishDir "$outdir/bowtie2",
mode: "copy", overwrite: true
input: input:
tuple val(name), path(reads) tuple val(name), path(reads)
val (outdir) val (outdir)
@ -18,9 +21,6 @@ process BOWTIE2 {
path "*bam", emit: bam path "*bam", emit: bam
path "*stats.txt", emit: stats path "*stats.txt", emit: stats
publishDir "$outdir/bowtie2",
mode: "copy", overwrite: true
script: script:
if (verbose){ if (verbose){
println ("[MODULE] BOWTIE2 ARGS: " + bowtie2_args) println ("[MODULE] BOWTIE2 ARGS: " + bowtie2_args)

View file

@ -1,13 +1,13 @@
process bwa_index { process bwa_index {
tag {fasta} tag "$fasta"
container 'quay.io/biocontainers/bwa:0.7.17--hed695b0_7' container 'quay.io/biocontainers/bwa:0.7.17--hed695b0_7'
input: input:
path(fasta) path fasta
output: output:
path("${fasta}.*") path "${fasta}.*"
script: script:
""" """

View file

@ -2,7 +2,7 @@ params.bwa_options = "-M -B 2"
params.sequencer = "ILLUMINA" params.sequencer = "ILLUMINA"
process bwa_mem { process bwa_mem {
tag {id} tag "$id"
publishDir "${params.outdir}/bwa_mem", mode: 'copy' publishDir "${params.outdir}/bwa_mem", mode: 'copy'

View file

@ -4,10 +4,10 @@ process cutadapt {
container 'quay.io/biocontainers/cutadapt:1.16--py27_1' container 'quay.io/biocontainers/cutadapt:1.16--py27_1'
input: input:
tuple val(sample_id), file(reads) tuple val(sample_id), path(reads)
output: output:
tuple sample_id, file("trimmed_*.fastq") tuple sample_id, path("trimmed_*.fastq")
script: script:
forward_fq = "trimmed_1.fastq" forward_fq = "trimmed_1.fastq"

View file

@ -2,26 +2,26 @@ nextflow.preview.dsl=2
process FASTQ_SCREEN { process FASTQ_SCREEN {
publishDir "$outputdir",
mode: "link", overwrite: true
// depending on the number of genomes and the type of genome (e.g. plants!), memory needs to be ample! // depending on the number of genomes and the type of genome (e.g. plants!), memory needs to be ample!
// label 'bigMem' // label 'bigMem'
// label 'multiCore' // label 'multiCore'
input: input:
tuple val(name), path(reads) tuple val(name), path(reads)
val (outputdir) val outputdir
// fastq_screen_args are best passed in to the workflow in the following manner: // fastq_screen_args are best passed in to the workflow in the following manner:
// --fastq_screen_args="--subset 200000 --force" // --fastq_screen_args="--subset 200000 --force"
val (fastq_screen_args) val fastq_screen_args
val (verbose) val verbose
output: output:
path "*png", emit: png path "*png", emit: png
path "*html", emit: html path "*html", emit: html
path "*txt", emit: report path "*txt", emit: report
publishDir "$outputdir",
mode: "link", overwrite: true
script: script:
println(name) println(name)
println(reads) println(reads)

View file

@ -4,14 +4,14 @@ process gatk_dict {
container 'quay.io/biocontainers/gatk4-spark:4.1.4.1--1' container 'quay.io/biocontainers/gatk4-spark:4.1.4.1--1'
input: input:
path(fasta) path fasta
output: output:
path("${fasta.baseName}.dict") path "${fasta.baseName}.dict"
script: script:
""" """
gatk --java-options "-Xmx${task.memory.toGiga()}g" \ gatk --java-options "-Xmx${task.memory.giga}g" \
CreateSequenceDictionary \ CreateSequenceDictionary \
--REFERENCE ${fasta} \ --REFERENCE ${fasta} \
--OUTPUT ${fasta.baseName}.dict --OUTPUT ${fasta.baseName}.dict

View file

@ -7,19 +7,19 @@ process HISAT2 {
// label 'bigMem' // label 'bigMem'
// label 'multiCore' // label 'multiCore'
publishDir "$outdir/hisat2",
mode: "copy", overwrite: true
input: input:
tuple val(name), path(reads) tuple val(name), path(reads)
val (outdir) val outdir
val (hisat2_args) val hisat2_args
val (verbose) val verbose
output: output:
path "*bam", emit: bam path "*bam", emit: bam
path "*stats.txt", emit: stats path "*stats.txt", emit: stats
publishDir "$outdir/hisat2",
mode: "copy", overwrite: true
script: script:
if (verbose){ if (verbose){

View file

@ -1,13 +1,13 @@
process htslib_tabix { process htslib_tabix {
tag {vcf} tag "$vcf"
container 'quay.io/biocontainers/tabix:0.2.6--ha92aebf_0' container 'quay.io/biocontainers/tabix:0.2.6--ha92aebf_0'
input: input:
path(vcf) path vcf
output: output:
path("${vcf}.tbi") path "${vcf}.tbi"
script: script:
""" """

View file

@ -4,20 +4,20 @@ process MULTIQC {
// tag "FastQC - $sample_id" // tag "FastQC - $sample_id"
publishDir "${outdir}/multiqc",
mode: "copy", overwrite: true
input: input:
path (file) path file
val (outdir) val outdir
val (multiqc_args) val multiqc_args
// multiqc_args are best passed into the workflow in the following manner: // multiqc_args are best passed into the workflow in the following manner:
// --multiqc_args="--exlude STAR --title custom_report_title" // --multiqc_args="--exlude STAR --title custom_report_title"
val (verbose) val verbose
output: output:
path "*html", emit: html path "*html", emit: html
publishDir "${outdir}/multiqc",
mode: "copy", overwrite: true
script: script:
if (verbose){ if (verbose){

View file

@ -1,13 +1,13 @@
process samtools_faidx { process samtools_faidx {
tag {fasta} tag "$fasta"
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12' container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
input: input:
path(fasta) path fasta
output: output:
path("${fasta}.fai") path "${fasta}.fai"
script: script:
""" """

View file

@ -4,7 +4,7 @@ process samtools_index {
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12' container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
input: input:
path(bam) path bam
output: output:
path "*.bai" path "*.bai"

View file

@ -4,7 +4,7 @@ process samtools_index {
container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12' container 'quay.io/biocontainers/samtools:1.9--h10a08f8_12'
input: input:
path(bam) path bam
output: output:
path "*.bam.bai" path "*.bam.bai"

View file

@ -1,16 +1,16 @@
process shovill { process shovill {
tag { shovill } tag "$shovill"
publishDir "${params.outdir}", pattern: '*.fasta', mode: 'copy' publishDir "${params.outdir}", pattern: '*.fasta', mode: 'copy'
container "quay.io/biocontainers/shovill:1.0.9--0" container "quay.io/biocontainers/shovill:1.0.9--0"
input: input:
tuple(sample_id, path(forward), path(reverse)) tuple val(sample_id), path(forward), path(reverse)
output: output:
path("${sample_id}.fasta") path "${sample_id}.fasta"
script: script:
""" """

View file

@ -1,13 +1,13 @@
process tcoffee { process tcoffee {
tag {fasta} tag "$fasta"
publishDir "${params.outdir}/tcoffee" publishDir "${params.outdir}/tcoffee"
container 'quay.io/biocontainers/t_coffee:11.0.8--py27pl5.22.0_5' container 'quay.io/biocontainers/t_coffee:11.0.8--py27pl5.22.0_5'
input: input:
path(fasta) path "$fasta"
output: output:
path("${fasta}.aln") path "${fasta}.aln"
script: script:
""" """

View file

@ -18,24 +18,26 @@ process TRIM_GALORE {
// container 'quay.io/biocontainers/trim-galore:0.6.5--0' // maybe later // container 'quay.io/biocontainers/trim-galore:0.6.5--0' // maybe later
// tag "$sample_id" // tag "$sample_id"
// Trimming reports are not generated for e.g. --hardtrim5, --clock etc
// saveAs: {filename ->
// else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename"
// else filename
// }
publishDir "${outdir}/trim_galore",
mode: "copy", overwrite: true
input: input:
tuple val (name), path (reads) tuple val(name), path(reads)
val (outdir) val outdir
val (trim_galore_args) val trim_galore_args
val (verbose) val verbose
output: output:
tuple val(name), path ("*fq.gz"), emit: reads tuple val(name), path ("*fq.gz"), emit: reads
path "*trimming_report.txt", optional: true, emit: report path "*trimming_report.txt", optional: true, emit: report
// Trimming reports are not generated for e.g. --hardtrim5, --clock etc
// saveAs: {filename ->
// else if (filename.indexOf("trimming_report.txt") > 0) "logs/$filename"
// else filename
// }
publishDir "${outdir}/trim_galore",
mode: "copy", overwrite: true
script: script:
if (verbose){ if (verbose){