From f8916eb9b53b9ab7c425d239c2a8d77338322794 Mon Sep 17 00:00:00 2001 From: FelixKrueger Date: Mon, 16 Mar 2020 14:17:38 +0000 Subject: [PATCH] FastQC module is working and now accepting arguments --- tools/fastqc/main.nf | 45 +++++++++++++++++++++---------- tools/fastqc/meta.yml | 6 +++-- tools/fastqc/test/main.nf | 25 +++++++++-------- tools/fastqc/test/nextflow.config | 4 +-- 4 files changed, 49 insertions(+), 31 deletions(-) mode change 100644 => 100755 tools/fastqc/test/main.nf diff --git a/tools/fastqc/main.nf b/tools/fastqc/main.nf index 65ba5981..83956ae8 100644 --- a/tools/fastqc/main.nf +++ b/tools/fastqc/main.nf @@ -1,20 +1,37 @@ -process fastqc { - tag "FastQC - $sample_id" - publishDir "${params.outdir}/fastqc", mode: 'copy', - saveAs: {filename -> filename.indexOf(".zip") > 0 ? "zips/$filename" : "$filename"} +nextflow.preview.dsl = 2 - container 'quay.io/biocontainers/fastqc:0.11.8--2' +process FASTQC { + + // tag "FastQC - $sample_id" - input: - tuple sample_id, path(reads) + input: + tuple val(name), path(reads) + val (outputdir) + // fastqc_args are best passed into the workflow in the following manner: + // --fastqc_args="--nogroup -a custom_adapter_file.txt" + val (fastqc_args) + val (verbose) - output: - path "*_fastqc.{zip,html}" + output: + tuple val(name), path ("*fastqc*"), emit: all + path "*.zip", emit: report // e.g. for MultiQC later + + // container 'quay.io/biocontainers/fastqc:0.11.8--2' - script: - """ - fastqc -q $reads + publishDir "$outputdir", + mode: "copy", overwrite: true + + script: + + if (verbose){ + println ("[MODULE] FASTQC ARGS: " + fastqc_args) + } + + """ + module load fastqc + fastqc $fastqc_args -q -t 2 $reads + + fastqc --version &> fastqc.version.txt + """ - fastqc --version &> fastqc.version.txt - """ } diff --git a/tools/fastqc/meta.yml b/tools/fastqc/meta.yml index 0d5afc23..0d67f866 100644 --- a/tools/fastqc/meta.yml +++ b/tools/fastqc/meta.yml @@ -16,7 +16,7 @@ tools: documentation: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/ input: - - - sample_id: + - name: type: string description: Sample identifier - reads: @@ -29,4 +29,6 @@ output: description: FastQC report pattern: *_fastqc.{zip,html} authors: - - @ewels + - + - @ewels + - @FelixKrueger diff --git a/tools/fastqc/test/main.nf b/tools/fastqc/test/main.nf old mode 100644 new mode 100755 index c349bbe8..9ec2d338 --- a/tools/fastqc/test/main.nf +++ b/tools/fastqc/test/main.nf @@ -1,22 +1,21 @@ #!/usr/bin/env nextflow nextflow.preview.dsl = 2 -include '../../../nf-core/module_testing/check_process_outputs.nf' params(params) -include '../main.nf' params(params) + +params.outdir = "." // gets set in nextflow.config file (as './results/fastqc') +params.fastqc_args = '' +params.verbose = false + +// TODO: check the output files in some way +// include '../../../nf-core/module_testing/check_process_outputs.nf' +include '../main.nf' // Define input channels -readPaths = [ - ['SRR4238351', ['../../../test-datasets/tools/fastqc/input/SRR4238351_subsamp.fastq.gz']], - ['SRR4238355', ['../../../test-datasets/tools/fastqc/input/SRR4238355_subsamp.fastq.gz']], - ['SRR4238359', ['../../../test-datasets/tools/fastqc/input/SRR4238359_subsamp.fastq.gz']], - ['SRR4238379', ['../../../test-datasets/tools/fastqc/input/SRR4238379_subsamp.fastq.gz']] -] -Channel - .from(readPaths) - .map { row -> [ row[0], [ file(row[1][0]) ] ] } - .set { ch_read_files } +ch_read_files = Channel + .fromFilePairs('../../../test-datasets/test*{1,2}.fastq.gz',size:-1) + // .view() // to check whether the input channel works // Run the workflow workflow { - fastqc(ch_read_files) + FASTQC (ch_read_files, params.outdir, params.fastqc_args, params.verbose) // .check_output() } diff --git a/tools/fastqc/test/nextflow.config b/tools/fastqc/test/nextflow.config index c137a138..e28180ad 100644 --- a/tools/fastqc/test/nextflow.config +++ b/tools/fastqc/test/nextflow.config @@ -1,2 +1,2 @@ -docker.enabled = true -params.outdir = './results' +// docker.enabled = true +params.outdir = './results/fastqc'