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..34ccbf3 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, params.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 } } @@ -466,6 +466,9 @@ ${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) + 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/artic_nanopore_nCov19.nf b/workflows/artic_nanopore_nCov19.nf index 949ecd6..7bb0d7d 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 b89bea9..42f6896 100755 --- a/workflows/process/artic.nf +++ b/workflows/process/artic.nf @@ -11,6 +11,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 @@ -22,11 +23,12 @@ process artic_medaka { tuple val(name), path("${name}.fail.vcf"), emit: vcf_fail script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise 500 \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ @@ -76,6 +78,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 @@ -86,6 +89,7 @@ process artic_medaka_custom_bed { tuple val(name), path("${name}.coverage_mask.txt"), emit: coverage_mask tuple val(name), path("${name}.fail.vcf"), emit: vcf_fail script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ # create a new primer dir as input for artic mkdir -p primer_scheme/nCoV-2019 @@ -101,7 +105,7 @@ process artic_medaka_custom_bed { artic minion --medaka \ --medaka-model ${params.medaka_model} \ --min-depth ${params.min_depth} \ - --normalise 500 \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \ @@ -152,6 +156,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 @@ -162,8 +167,10 @@ process artic_nanopolish { tuple val(name), path("${name}.coverage_mask.txt"), emit: coverage_mask tuple val(name), path("${name}.fail.vcf"), emit: vcf_fail script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ - artic minion --minimap2 --normalise 500 \ + artic minion --minimap2 \ + ${normalise_arg} \ --threads ${task.cpus} \ --scheme-directory ${external_scheme} \ --read-file ${reads} \ @@ -216,6 +223,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 @@ -226,6 +234,7 @@ process artic_nanopolish_custom_bed { tuple val(name), path("${name}.coverage_mask.txt"), emit: coverage_mask tuple val(name), path("${name}.fail.vcf"), emit: vcf_fail script: + def normalise_arg = normalise_threshold ? "--normalise ${normalise_threshold}" : '' """ # create a new primer dir as input for artic mkdir -p primer_scheme/nCoV-2019 @@ -238,7 +247,8 @@ 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_arg} \ --threads ${task.cpus} \ --scheme-directory primer_scheme \ --read-file ${reads} \