diff --git a/software/fastqc/main.nf b/software/fastqc/main.nf index 01c21a62..35753657 100644 --- a/software/fastqc/main.nf +++ b/software/fastqc/main.nf @@ -1,29 +1,40 @@ -nextflow.preview.dsl = 2 def MODULE = "fastqc" params.publish_dir = MODULE params.publish_results = "default" process FASTQC { - input: - tuple val(name), path(reads) - - output: - tuple val(name), path ("*fastqc*"), emit: all - path "*.zip", emit: report // e.g. for MultiQC later - path "*.version.txt", emit: version - - container "docker.pkg.github.com/nf-core/$MODULE" - conda "${moduleDir}/environment.yml" - - publishDir "${params.out_dir}/${params.publish_dir}/$name", + publishDir "${params.out_dir}/${params.publish_dir}", mode: params.publish_dir_mode, saveAs: { filename -> - if(params.publish_results == "none") null - else filename } + if (params.publish_results == "none") null + else filename } + + container "docker.pkg.github.com/nf-core/$MODULE" + + conda "${moduleDir}/environment.yml" + + input: + tuple val(name), val(single_end), path(reads) + + output: + tuple val(name), val(single_end), path("*.html"), emit: html + tuple val(name), val(single_end), path("*.zip"), emit: zip + path "*.version.txt", emit: version script: + // Add soft-links to original FastQs for consistent naming in pipeline + if (single_end) { """ - fastqc ${params.fastqc_args} -t ${task.cpus} $reads + [ ! -f ${name}.fastq.gz ] && ln -s $reads ${name}.fastq.gz + fastqc ${params.fastqc_args} --threads $task.cpus ${name}.fastq.gz fastqc --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > fastqc.version.txt """ + } else { + """ + [ ! -f ${name}_1.fastq.gz ] && ln -s ${reads[0]} ${name}_1.fastq.gz + [ ! -f ${name}_2.fastq.gz ] && ln -s ${reads[1]} ${name}_2.fastq.gz + fastqc ${params.fastqc_args} --threads $task.cpus ${name}_1.fastq.gz ${name}_2.fastq.gz + fastqc --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > fastqc.version.txt + """ + } } diff --git a/software/fastqc/meta.yml b/software/fastqc/meta.yml index 94f3e320..fcbfeab3 100644 --- a/software/fastqc/meta.yml +++ b/software/fastqc/meta.yml @@ -29,14 +29,28 @@ params: Append to the path for the standard output directory provided by `$out_dir`. - publish_dir_mode: type: string - description: Provide a value for the Nextflow `publishDir` mode parameter (e.g. copy, link, ...) + description: | + Provide a value for the Nextflow `publishDir` mode parameter + (e.g. copy, link, ...) + - publish_results: + type: string + description: | + Whether or not to publish results into `publish_dir`. Set to `none` to not + publish any files at all; to `default` to publish all relevant files. input: - name: type: string description: Sample identifier + - single_end: + type: boolean + description: | + Boolean indicating whether the corresponding sample is single-end (true) + or paired-end (false). - reads: type: file - description: List of input FastQ files of size 1 and 2 for single-end and paired-end data, respectively. + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. output: - report: type: file diff --git a/software/fastqc/test/main.nf b/software/fastqc/test/main.nf index f9eb4a75..0b0038d7 100755 --- a/software/fastqc/test/main.nf +++ b/software/fastqc/test/main.nf @@ -12,7 +12,7 @@ include { FASTQC } from '../main.nf' */ workflow test_single_end { input_files = Channel.fromPath("data/test_single_end.fastq.gz") - .map {f -> [f.baseName, f]} + .map {f -> [f.baseName, true, f]} FASTQC(input_files) } @@ -21,6 +21,7 @@ workflow test_single_end { */ workflow test_paired_end { input_files = Channel.fromFilePairs("data/test_R{1,2}.fastq.gz") + .map {f -> [f[0], false, f[1]]} FASTQC(input_files) }