From f7c9361027ee93e33b9fd37e81cb39ceeb7020eb Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Fri, 21 Jun 2024 14:49:14 +1200 Subject: [PATCH] Now emitting trimmed reads --- .../fastq_fastqc_umitools_fastp/main.nf | 6 +- .../tests/main.nf.test.snap | 62 ++++++++++++++++--- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf index dff519ec9f6..ab6cbb320c5 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/main.nf @@ -12,9 +12,9 @@ include { FASTP } from '../../../modules/nf-core/fastp/main' // import groovy.json.JsonSlurper -def getFastpReadsAfterFiltering(json_file) { +def getFastpReadsAfterFiltering(json_file, min_num_reads) { - if ( workflow.stubRun ) { return 0 } + if ( workflow.stubRun ) { return min_num_reads } def Map json = (Map) new JsonSlurper().parseText(json_file.text).get('summary') return json['after_filtering']['total_reads'].toLong() @@ -115,7 +115,7 @@ workflow FASTQ_FASTQC_UMITOOLS_FASTP { .out .reads .join(trim_json) - .map { meta, reads, json -> [ meta, reads, getFastpReadsAfterFiltering(json) ] } + .map { meta, reads, json -> [ meta, reads, getFastpReadsAfterFiltering(json, min_trimmed_reads.toLong()) ] } .set { ch_num_trimmed_reads } ch_num_trimmed_reads diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap index 5f804bfbe4e..b591fab9053 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap @@ -550,7 +550,16 @@ "content": [ { "0": [ - + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] ], "1": [ [ @@ -567,17 +576,30 @@ "id": "test", "single_end": false }, - 0 + 1 ] ], "11": [ - + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "12": [ - + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "13": [ "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ], "2": [ @@ -662,13 +684,34 @@ ] ], "fastqc_trim_html": [ - + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "fastqc_trim_zip": [ - + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "reads": [ - + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] ], "trim_html": [ [ @@ -703,7 +746,7 @@ "id": "test", "single_end": false }, - 0 + 1 ] ], "trim_reads_fail": [ @@ -717,6 +760,7 @@ ], "versions": [ "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] } @@ -725,6 +769,6 @@ "nf-test": "0.8.4", "nextflow": "24.04.2" }, - "timestamp": "2024-06-21T12:21:48.845872" + "timestamp": "2024-06-21T14:46:58.329605" } } \ No newline at end of file