Update module according to discussion on Slack

This commit is contained in:
Gregor Sturm 2020-07-15 13:00:10 +02:00
parent 01a926866e
commit a2bcb5c36a
3 changed files with 45 additions and 19 deletions

View file

@ -1,29 +1,40 @@
nextflow.preview.dsl = 2
def MODULE = "fastqc" def MODULE = "fastqc"
params.publish_dir = MODULE params.publish_dir = MODULE
params.publish_results = "default" params.publish_results = "default"
process FASTQC { process FASTQC {
input: publishDir "${params.out_dir}/${params.publish_dir}",
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",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
saveAs: { filename -> saveAs: { filename ->
if(params.publish_results == "none") null if (params.publish_results == "none") null
else filename } 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: 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 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
"""
}
} }

View file

@ -29,14 +29,28 @@ params:
Append to the path for the standard output directory provided by `$out_dir`. Append to the path for the standard output directory provided by `$out_dir`.
- publish_dir_mode: - publish_dir_mode:
type: string 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: input:
- name: - name:
type: string type: string
description: Sample identifier description: Sample identifier
- single_end:
type: boolean
description: |
Boolean indicating whether the corresponding sample is single-end (true)
or paired-end (false).
- reads: - reads:
type: file 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: output:
- report: - report:
type: file type: file

View file

@ -12,7 +12,7 @@ include { FASTQC } from '../main.nf'
*/ */
workflow test_single_end { workflow test_single_end {
input_files = Channel.fromPath("data/test_single_end.fastq.gz") input_files = Channel.fromPath("data/test_single_end.fastq.gz")
.map {f -> [f.baseName, f]} .map {f -> [f.baseName, true, f]}
FASTQC(input_files) FASTQC(input_files)
} }
@ -21,6 +21,7 @@ workflow test_single_end {
*/ */
workflow test_paired_end { workflow test_paired_end {
input_files = Channel.fromFilePairs("data/test_R{1,2}.fastq.gz") input_files = Channel.fromFilePairs("data/test_R{1,2}.fastq.gz")
.map {f -> [f[0], false, f[1]]}
FASTQC(input_files) FASTQC(input_files)
} }