From 9bc8156ac712b2631c720a24465e252f06320795 Mon Sep 17 00:00:00 2001 From: Adam Rosenbaum Date: Tue, 15 Oct 2024 10:35:37 +0200 Subject: [PATCH] Make it possible to use chopper as filtering tool as well --- conf/modules.config | 4 ++- nextflow.config | 1 - nextflow_schema.json | 8 +----- subworkflows/local/longread_preprocessing.nf | 29 +++++++++----------- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index c3fb6a44..0adc8846 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -245,7 +245,9 @@ process { withName: CHOPPER { ext.args2 = [ - "--contam ${params.lambda_reference}" + !params.keep_lambda ? "--contam ${params.lambda_reference}": "", + params.longreads_min_quality ? "--quality ${params.longreads_min_quality}": "", + params.longreads_min_length ? "--minlength ${params.longreads_min_length}": "", ].join(' ').trim() publishDir = [ [ diff --git a/nextflow.config b/nextflow.config index 822656b3..f8bf1a4e 100644 --- a/nextflow.config +++ b/nextflow.config @@ -29,7 +29,6 @@ params { keep_phix = false // long read preprocessing options longread_adaptertrimming_tool = "porechop_abi" - longread_phageremoval_tool = "chopper" longread_filtering_tool = "filtlong" // phix_reference = "ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/viral/Enterobacteria_phage_phiX174_sensu_lato/all_assembly_versions/GCA_002596845.1_ASM259684v1/GCA_002596845.1_ASM259684v1_genomic.fna.gz" phix_reference = "${baseDir}/assets/data/GCA_002596845.1_ASM259684v1_genomic.fna.gz" diff --git a/nextflow_schema.json b/nextflow_schema.json index 6f81582e..38faad2f 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -497,16 +497,10 @@ "enum": ["porechop", "porechop_abi"], "default": "porechop_abi" }, - "longread_phageremoval_tool": { - "type": "string", - "description": "Specify which long read phage removal tool to use.", - "enum": ["nanolyse", "chopper"], - "default": "chopper" - }, "longread_filtering_tool": { "type": "string", "description": "Specify which long read filtering tool to use.", - "enum": ["filtlong", "nanoq"], + "enum": ["filtlong", "nanoq", "chopper"], "default": "filtlong" } } diff --git a/subworkflows/local/longread_preprocessing.nf b/subworkflows/local/longread_preprocessing.nf index 9e4cc0c1..76865c25 100644 --- a/subworkflows/local/longread_preprocessing.nf +++ b/subworkflows/local/longread_preprocessing.nf @@ -53,22 +53,13 @@ workflow LONGREAD_PREPROCESSING { } } - if (!params.keep_lambda) { - if (params.longread_phageremoval_tool == 'chopper') { - CHOPPER ( - ch_long_reads - ) - ch_long_reads = CHOPPER.out.fastq - ch_versions = ch_versions.mix(CHOPPER.out.versions.first()) - } else if (params.longread_phageremoval_tool == 'nanolyse') { - NANOLYSE ( - ch_long_reads, - ch_nanolyse_db - ) - ch_long_reads = NANOLYSE.out.fastq - ch_versions = ch_versions.mix(NANOLYSE.out.versions.first()) - } - + if (!params.keep_lambda && params.longread_filtering_tool != 'chopper') { + NANOLYSE ( + ch_long_reads, + ch_nanolyse_db + ) + ch_long_reads = NANOLYSE.out.fastq + ch_versions = ch_versions.mix(NANOLYSE.out.versions.first()) } if (params.longread_filtering_tool == 'filtlong') { @@ -95,6 +86,12 @@ workflow LONGREAD_PREPROCESSING { ch_long_reads = NANOQ.out.reads ch_versions = ch_versions.mix(NANOQ.out.versions.first()) ch_multiqc_files = ch_multiqc_files.mix(NANOQ.out.stats) + } else if (params.longread_filtering_tool == 'chopper') { + CHOPPER ( + ch_long_reads + ) + ch_long_reads = CHOPPER.out.fastq + ch_versions = ch_versions.mix(CHOPPER.out.versions.first()) } NANOPLOT_FILTERED (