From 0b12891efec288383a86155cb7f6188f4f10bfd7 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Thu, 23 Mar 2023 17:43:13 +0100 Subject: [PATCH 1/7] added parameter artic_normalize - sets the normalise parameter for the artic minion workflow --- nextflow.config | 2 ++ poreCov.nf | 8 ++++---- workflows/artic_nanopore_nCov19.nf | 12 ++++++++---- workflows/process/artic.nf | 12 ++++++++---- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/nextflow.config b/nextflow.config index f2f8837..dd65672 100644 --- a/nextflow.config +++ b/nextflow.config @@ -20,6 +20,8 @@ params { list = false samples = false + artic_normalize = 500 + // consensus qc reference_for_qc = '' seq_threshold = '0.90' diff --git a/poreCov.nf b/poreCov.nf index c934eb5..33c7bb5 100755 --- a/poreCov.nf +++ b/poreCov.nf @@ -347,11 +347,11 @@ workflow { // use medaka or nanopolish artic reconstruction if (params.nanopolish) { - artic_ncov_np_wf(filtered_reads_ch, dir_input_ch, basecalling_wf.out[1]) + artic_ncov_np_wf(filtered_reads_ch, dir_input_ch, basecalling_wf.out[1], artic_ncov_np_wf) fasta_input_ch = artic_ncov_np_wf.out[0] } else if (!params.nanopolish) { - artic_ncov_wf(filtered_reads_ch) + artic_ncov_wf(filtered_reads_ch, artic_normalize) fasta_input_ch = artic_ncov_wf.out[0] } } @@ -379,11 +379,11 @@ workflow { external_primer_schemes = Channel.fromPath(workflow.projectDir + "/data/external_primer_schemes", checkIfExists: true, type: 'dir' ) - artic_ncov_np_wf(filtered_reads_ch, dir_input_ch, sequence_summary_ch ) + artic_ncov_np_wf(filtered_reads_ch, dir_input_ch, sequence_summary_ch, artic_ncov_np_wf) fasta_input_ch = artic_ncov_np_wf.out } else if (!params.nanopolish) { - artic_ncov_wf(filtered_reads_ch) + artic_ncov_wf(filtered_reads_ch, params.artic_normalize) fasta_input_ch = artic_ncov_wf.out } } diff --git a/workflows/artic_nanopore_nCov19.nf b/workflows/artic_nanopore_nCov19.nf index 949ecd6..5be048a 100755 --- a/workflows/artic_nanopore_nCov19.nf +++ b/workflows/artic_nanopore_nCov19.nf @@ -4,6 +4,7 @@ include { covarplot; covarplot_custom_bed } from './process/covarplot.nf' workflow artic_ncov_wf { take: fastq + normalise_threshold main: // assembly with a primer bed file @@ -11,7 +12,7 @@ workflow artic_ncov_wf { primerBed = Channel.fromPath(params.primerV, checkIfExists: true ) external_primer_schemes = Channel.fromPath(workflow.projectDir + "/data/external_primer_schemes", checkIfExists: true, type: 'dir' ) - artic_medaka_custom_bed(fastq.combine(external_primer_schemes).combine(primerBed)) + artic_medaka_custom_bed(fastq.combine(external_primer_schemes).combine(primerBed), normalise_threshold) assembly = artic_medaka_custom_bed.out.fasta // plot amplicon coverage @@ -22,7 +23,7 @@ workflow artic_ncov_wf { else { external_primer_schemes = Channel.fromPath(workflow.projectDir + "/data/external_primer_schemes", checkIfExists: true, type: 'dir' ) - artic_medaka(fastq.combine(external_primer_schemes)) + artic_medaka(fastq.combine(external_primer_schemes), normalise_threshold) assembly = artic_medaka.out.fasta // plot amplicon coverage @@ -42,6 +43,7 @@ workflow artic_ncov_np_wf { fastq fast5 sequence_summaries + normalise_threshold main: // assembly @@ -55,7 +57,8 @@ workflow artic_ncov_np_wf { .combine(fast5.map{it -> it[1]}) .combine(sequence_summaries) .combine(primerBed) - .map{it -> tuple(it[0],it[1],it[2],it[3],it[5],it[6])} + .map{it -> tuple(it[0],it[1],it[2],it[3],it[5],it[6]), + normalise_threshold} ) assembly = artic_nanopolish_custom_bed.out.fasta @@ -73,7 +76,8 @@ workflow artic_ncov_np_wf { .combine(external_primer_schemes) .combine(fast5.map{it -> it[1]}) .combine(sequence_summaries) - .map{it -> tuple(it[0],it[1],it[2],it[3],it[5])} + .map{it -> tuple(it[0],it[1],it[2],it[3],it[5]). + normalise_threshold} ) assembly = artic_nanopolish.out.fasta diff --git a/workflows/process/artic.nf b/workflows/process/artic.nf index 96a2b4a..edd37b0 100755 --- a/workflows/process/artic.nf +++ b/workflows/process/artic.nf @@ -8,6 +8,7 @@ process artic_medaka { input: tuple val(name), path(reads), path(external_scheme) + val(normalise_threshold) output: tuple val(name), path("*.consensus.fasta"), emit: fasta tuple val(name), path("${name}_mapped_*.primertrimmed.sorted.bam"), path("${name}_mapped_*.primertrimmed.sorted.bam.bai"), emit: reference_bam @@ -19,7 +20,7 @@ process artic_medaka { artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise 500 \ + --normalise ${normalise_threshold} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ @@ -63,6 +64,7 @@ process artic_medaka_custom_bed { input: tuple val(name), path(reads), path(external_scheme), path(primerBed) + val(normalize_threshold) output: tuple val(name), path("*.consensus.fasta"), emit: fasta tuple val(name), path("${name}_mapped_*.primertrimmed.sorted.bam"), path("${name}_mapped_*.primertrimmed.sorted.bam.bai"), emit: reference_bam @@ -85,7 +87,7 @@ process artic_medaka_custom_bed { artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise 500 \ + --normalise ${normalise_threshold} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \ @@ -130,6 +132,7 @@ process artic_nanopolish { input: tuple val(name), path(reads), path(external_scheme), path(fast5_dir), path(txt_files) + val(normalise_threshold) output: tuple val(name), path("*.consensus.fasta"), emit: fasta tuple val(name), path("${name}_mapped_*.primertrimmed.sorted.bam"), path("${name}_mapped_*.primertrimmed.sorted.bam.bai"), emit: reference_bam @@ -138,7 +141,7 @@ process artic_nanopolish { tuple val(name), path("${name}.trimmed.rg.sorted.bam"), emit: fullbam script: """ - artic minion --minimap2 --normalise 500 \ + artic minion --minimap2 --normalise ${normalise_threshold} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ @@ -185,6 +188,7 @@ process artic_nanopolish_custom_bed { input: tuple val(name), path(reads), path(external_scheme), path(fast5_dir), path(txt_files), path(primerBed) + val(normalise_threshold) output: tuple val(name), path("*.consensus.fasta"), emit: fasta tuple val(name), path("${name}_mapped_*.primertrimmed.sorted.bam"), path("${name}_mapped_*.primertrimmed.sorted.bam.bai"), emit: reference_bam @@ -204,7 +208,7 @@ process artic_nanopolish_custom_bed { sort -k4 > primer_scheme/nCoV-2019/V_custom/nCoV-2019.scheme.bed # start artic - artic minion --minimap2 --normalise 500 \ + artic minion --minimap2 --normalise ${normalise_threshold} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \ From 0fc7621ec3215de1fb632909b3d18daee6d76515 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Mon, 3 Apr 2023 14:26:40 +0200 Subject: [PATCH 2/7] fixed missing params --- poreCov.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poreCov.nf b/poreCov.nf index 33c7bb5..9169318 100755 --- a/poreCov.nf +++ b/poreCov.nf @@ -351,7 +351,7 @@ workflow { fasta_input_ch = artic_ncov_np_wf.out[0] } else if (!params.nanopolish) { - artic_ncov_wf(filtered_reads_ch, artic_normalize) + artic_ncov_wf(filtered_reads_ch, params.artic_normalize) fasta_input_ch = artic_ncov_wf.out[0] } } From 13f2a5be1363c5a4e19139f76462dad4384dfd15 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Mon, 3 Apr 2023 14:33:28 +0200 Subject: [PATCH 3/7] fixed typo --- workflows/artic_nanopore_nCov19.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/artic_nanopore_nCov19.nf b/workflows/artic_nanopore_nCov19.nf index 5be048a..8291804 100755 --- a/workflows/artic_nanopore_nCov19.nf +++ b/workflows/artic_nanopore_nCov19.nf @@ -76,7 +76,7 @@ workflow artic_ncov_np_wf { .combine(external_primer_schemes) .combine(fast5.map{it -> it[1]}) .combine(sequence_summaries) - .map{it -> tuple(it[0],it[1],it[2],it[3],it[5]). + .map{it -> tuple(it[0],it[1],it[2],it[3],it[5]), normalise_threshold} ) From ab9427ab383c44256057755dcd0987696002d024 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Mon, 3 Apr 2023 14:41:41 +0200 Subject: [PATCH 4/7] fixed syntax --- workflows/artic_nanopore_nCov19.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workflows/artic_nanopore_nCov19.nf b/workflows/artic_nanopore_nCov19.nf index 8291804..7bb0d7d 100755 --- a/workflows/artic_nanopore_nCov19.nf +++ b/workflows/artic_nanopore_nCov19.nf @@ -57,8 +57,8 @@ workflow artic_ncov_np_wf { .combine(fast5.map{it -> it[1]}) .combine(sequence_summaries) .combine(primerBed) - .map{it -> tuple(it[0],it[1],it[2],it[3],it[5],it[6]), - normalise_threshold} + .map{it -> tuple(it[0],it[1],it[2],it[3],it[5],it[6])}, + normalise_threshold ) assembly = artic_nanopolish_custom_bed.out.fasta @@ -76,8 +76,8 @@ workflow artic_ncov_np_wf { .combine(external_primer_schemes) .combine(fast5.map{it -> it[1]}) .combine(sequence_summaries) - .map{it -> tuple(it[0],it[1],it[2],it[3],it[5]), - normalise_threshold} + .map{it -> tuple(it[0],it[1],it[2],it[3],it[5])}, + normalise_threshold ) assembly = artic_nanopolish.out.fasta From e4cf9dc1692f7f0f260aa54efab72990d147fc09 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Wed, 12 Apr 2023 13:26:01 +0200 Subject: [PATCH 5/7] added help for --artic_normalize --- poreCov.nf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/poreCov.nf b/poreCov.nf index 9169318..7aa28fe 100755 --- a/poreCov.nf +++ b/poreCov.nf @@ -466,6 +466,8 @@ ${c_yellow}Inputs (choose one):${c_reset} ${c_dim}[Lineage + Reports]${c_reset} ${c_yellow}Workflow control (optional)${c_reset} + --artic_normalize Normalise down to moderate coverage to save runtime [default: $params.artic_normalize] + ${c_dim}(after mapping and before variant calling in the ARTIC bioinformatics pipeline)${c_reset} --update Always try to use latest pangolin & nextclade release [default: $params.update] --samples .csv input (header: Status,_id), renames barcodes (Status) by name (_id), e.g.: Status,_id From 42f660429d3dc7ba2f89ab12c01696494f0d3210 Mon Sep 17 00:00:00 2001 From: "Lataretu, Marie" Date: Tue, 27 Jun 2023 17:05:21 +0200 Subject: [PATCH 6/7] added the option to turn off the normalisation step --- poreCov.nf | 3 ++- workflows/process/artic.nf | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/poreCov.nf b/poreCov.nf index 7aa28fe..34ccbf3 100755 --- a/poreCov.nf +++ b/poreCov.nf @@ -467,7 +467,8 @@ ${c_yellow}Inputs (choose one):${c_reset} ${c_yellow}Workflow control (optional)${c_reset} --artic_normalize Normalise down to moderate coverage to save runtime [default: $params.artic_normalize] - ${c_dim}(after mapping and before variant calling in the ARTIC bioinformatics pipeline)${c_reset} + ${c_dim}(after mapping and before variant calling in the ARTIC bioinformatics pipeline) + Use `--artic_normalize False` to turn off this normalisation.${c_reset} --update Always try to use latest pangolin & nextclade release [default: $params.update] --samples .csv input (header: Status,_id), renames barcodes (Status) by name (_id), e.g.: Status,_id diff --git a/workflows/process/artic.nf b/workflows/process/artic.nf index edd37b0..072b5a8 100755 --- a/workflows/process/artic.nf +++ b/workflows/process/artic.nf @@ -16,11 +16,12 @@ process artic_medaka { tuple val(name), path("${name}.pass.vcf.gz"), path("${name}.coverage_mask.txt.*1.depths"), path("${name}.coverage_mask.txt.*2.depths"), emit: covarplot tuple val(name), path("${name}.trimmed.rg.sorted.bam"), emit: fullbam script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise ${normalise_threshold} \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ From 0854b0e12796fdf9cd7c16c6d9f1d984a28c2ae6 Mon Sep 17 00:00:00 2001 From: MarieLataretu <52002068+MarieLataretu@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:21:27 +0200 Subject: [PATCH 7/7] added turn off function to all artic processes --- workflows/process/artic.nf | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/workflows/process/artic.nf b/workflows/process/artic.nf index 072b5a8..a8c299e 100755 --- a/workflows/process/artic.nf +++ b/workflows/process/artic.nf @@ -73,6 +73,7 @@ process artic_medaka_custom_bed { tuple val(name), path("${name}.pass.vcf.gz"), path("${name}.coverage_mask.txt.*1.depths"), path("${name}.coverage_mask.txt.*2.depths"), emit: covarplot tuple val(name), path("${name}.trimmed.rg.sorted.bam"), emit: fullbam script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ # create a new primer dir as input for artic mkdir -p primer_scheme/nCoV-2019 @@ -88,7 +89,7 @@ process artic_medaka_custom_bed { artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise ${normalise_threshold} \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \ @@ -141,8 +142,10 @@ process artic_nanopolish { tuple val(name), path("${name}.pass.vcf.gz"), path("${name}.coverage_mask.txt.*1.depths"), path("${name}.coverage_mask.txt.*2.depths"), emit: covarplot tuple val(name), path("${name}.trimmed.rg.sorted.bam"), emit: fullbam script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ - artic minion --minimap2 --normalise ${normalise_threshold} \ + artic minion --minimap2 \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ @@ -197,6 +200,7 @@ process artic_nanopolish_custom_bed { tuple val(name), path("${name}.pass.vcf.gz"), path("${name}.coverage_mask.txt.*1.depths"), path("${name}.coverage_mask.txt.*2.depths"), emit: covarplot tuple val(name), path("${name}.trimmed.rg.sorted.bam"), emit: fullbam script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ # create a new primer dir as input for artic mkdir -p primer_scheme/nCoV-2019 @@ -209,7 +213,8 @@ process artic_nanopolish_custom_bed { sort -k4 > primer_scheme/nCoV-2019/V_custom/nCoV-2019.scheme.bed # start artic - artic minion --minimap2 --normalise ${normalise_threshold} \ + artic minion --minimap2 \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \