From 0c599b9fd8dfd65fcc65b754e7cebb16c7196733 Mon Sep 17 00:00:00 2001 From: Sofia Stamouli <91951607+sofstam@users.noreply.github.com> Date: Fri, 22 Sep 2023 09:32:14 +0200 Subject: [PATCH] Update nextclade to 2.11 (#74) --- .github/scripts/install_singularity.sh | 8 ++-- .github/scripts/test_nanopore_pipelines.sh | 8 ++-- .github/workflows/pull_request.yml | 2 +- README.md | 3 +- bin/get_versions.py | 2 +- bin/process_gvcf.py | 5 +-- bin/qc.py | 4 -- bin/type_vcf.py | 16 -------- conf/base.config | 3 ++ environments/illumina/Singularity | 8 ++-- environments/illumina/environment.yml | 2 +- environments/nanopore/Dockerfile | 1 - environments/nanopore/Singularity | 6 +-- environments/nanopore/environment.yml | 2 +- main.nf | 2 +- modules/analysis.nf | 4 +- modules/artic.nf | 20 +++++----- modules/illumina.nf | 46 +++++++++++----------- modules/out.nf | 6 +-- modules/qc.nf | 10 ++--- modules/typing.nf | 26 ++++++------ modules/upload.nf | 2 +- workflows/articNcovNanopore.nf | 2 +- workflows/illuminaNcov.nf | 4 +- 24 files changed, 85 insertions(+), 107 deletions(-) diff --git a/.github/scripts/install_singularity.sh b/.github/scripts/install_singularity.sh index b1f41f5d..649f1f22 100644 --- a/.github/scripts/install_singularity.sh +++ b/.github/scripts/install_singularity.sh @@ -20,11 +20,11 @@ echo $(which go) go version # install Singularity -export VERSION=3.7.3 +export VERSION=3.11.4 echo Install Singularity version $VERSION .. >> artifacts/test_artifact.log -wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz -tar -xzf singularity-${VERSION}.tar.gz -cd singularity +wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz +tar -xzf singularity-ce-${VERSION}.tar.gz +cd singularity-ce-${VERSION} ./mconfig make -C builddir sudo make -C builddir install diff --git a/.github/scripts/test_nanopore_pipelines.sh b/.github/scripts/test_nanopore_pipelines.sh index e36aa97c..ae463034 100644 --- a/.github/scripts/test_nanopore_pipelines.sh +++ b/.github/scripts/test_nanopore_pipelines.sh @@ -7,7 +7,7 @@ export PATH=/opt/conda/bin:$PATH singularity --version # write test log as github Action artifact echo "Nextflow run current PR in --nanopolish mode (no barcodes).." >> artifacts/test_artifact.log -NXF_VER=21.04.0 nextflow run main.nf \ +NXF_VER=23.04.3 nextflow run main.nf \ -profile singularity \ --nanopolish --prefix "test_nanopore" \ --basecalled_fastq .github/data/nanopore/20200311_1427_X1_FAK72834_a3787181/fastq_pass/ \ @@ -17,7 +17,7 @@ cp .nextflow.log artifacts/nanopolish.nextflow.log rm -rf results && rm -rf work && rm -rf .nextflow* echo "Nextflow run current PR in --nanopolish mode (barcodes).." >> artifacts/test_artifact.log -NXF_VER=21.04.0 nextflow run main.nf \ +NXF_VER=23.04.3 nextflow run main.nf \ -profile singularity \ --nanopolish --prefix "20200311_1427_X1_FAK72834_a3787181" \ --basecalled_fastq .github/data/nanopore/20200311_1427_X1_FAK72834_a3787181/fastq_pass/ \ @@ -27,7 +27,7 @@ cp .nextflow.log artifacts/nanopolish_barcodes.nextflow.log rm -rf results && rm -rf work && rm -rf .nextflow* echo "Nextflow run current PR in --medaka mode (no barcodes).." >> artifacts/test_artifact.log -NXF_VER=21.04.0 nextflow run main.nf \ +NXF_VER=23.04.3 nextflow run main.nf \ -profile singularity \ --medaka \ --basecalled_fastq .github/data/nanopore/20200311_1427_X4_FAK72834_a3787181/fastq_pass/ \ @@ -36,7 +36,7 @@ cp .nextflow.log artifacts/medaka.nextflow.log rm -rf results && rm -rf work && rm -rf .nextflow* echo "Nextflow run current PR in --medaka mode (barcodes).." >> artifacts/test_artifact.log -NXF_VER=21.04.0 nextflow run main.nf \ +NXF_VER=23.04.3 nextflow run main.nf \ -profile singularity \ --medaka \ --basecalled_fastq .github/data/nanopore/20200311_1427_X1_FAK72834_a3787181/fastq_pass/ \ diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index bdc4d345..c6165aff 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -29,7 +29,7 @@ jobs: run: | export PATH=/opt/conda/bin:$PATH conda install -c bioconda nextflow - NXF_VER=21.04.0 nextflow -version + NXF_VER=23.04.3 nextflow -version - name: test nanopore pipelines run: bash .github/scripts/test_nanopore_pipelines.sh - name: test typing functionality diff --git a/README.md b/README.md index 4b8072f4..dd7487f8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Update docker for artic-ncov2019-illumina, artic-ncov2019-nanopore](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile.yml/badge.svg)](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile.yml) +[![Update docker for gms-artic-illumina, gms-artic-nanopore](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile_master.yml/badge.svg)](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile_master.yml) [![Update docker for gms-artic-pangolin +](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile_pangolin_master.yml/badge.svg)](https://github.com/genomic-medicine-sweden/gms-artic/actions/workflows/build_dockerfile_pangolin_master.yml) ![logo](workflow-image/logo.png) diff --git a/bin/get_versions.py b/bin/get_versions.py index c2fde58f..b3fdf3b9 100755 --- a/bin/get_versions.py +++ b/bin/get_versions.py @@ -41,5 +41,5 @@ contents = f.read() match = re.search(regex, contents) if match: - # Add version number to output + # Add version number to output file out.write("{},{}\n".format(tool, match.group(1))) diff --git a/bin/process_gvcf.py b/bin/process_gvcf.py index 3e622130..2b5cf575 100755 --- a/bin/process_gvcf.py +++ b/bin/process_gvcf.py @@ -7,6 +7,7 @@ import os from collections import defaultdict + # from https://www.geeksforgeeks.org/python-make-a-list-of-intervals-with-sequential-numbers/ # via artic-mask def intervals_extract(iterable): @@ -119,7 +120,6 @@ def handle_sub(vcf_header, record): # construct output records for i in range(0, sub_length): - # choose base with highest frequency, skipping the reference max_b = base_max(base_frequency[i], record.ref[i]) if max_b is None: @@ -137,7 +137,6 @@ def handle_sub(vcf_header, record): def main(): - description = "Process a .gvcf file to create a file of consensus variants, low-frequency variants and a coverage mask" parser = argparse.ArgumentParser(description=description) @@ -221,7 +220,6 @@ def main(): ) for record in vcf: - is_gvcf_ref = record.alts[0] == "<*>" # set depth for this part of the genome @@ -261,7 +259,6 @@ def main(): # classify variants using VAF cutoffs for IUPAC ambiguity codes, etc accept_variant = False for out_r in out_records: - # at this point we should have resolved multi-allelic variants assert len(out_r.alts) == 1 diff --git a/bin/qc.py b/bin/qc.py index 1d46c7ad..380112f2 100755 --- a/bin/qc.py +++ b/bin/qc.py @@ -80,7 +80,6 @@ def get_N_positions(fasta): def get_pct_N_bases(fasta): - count_N = len(get_N_positions(fasta)) pct_N_bases = count_N / len(fasta.seq) * 100 @@ -104,7 +103,6 @@ def get_ref_length(ref): def sliding_window_N_density(sequence, window=10): - sliding_window_n_density = [] for i in range(0, len(sequence.seq), 1): window_mid = i + (window / 2) @@ -118,7 +116,6 @@ def sliding_window_N_density(sequence, window=10): def get_num_reads(bamfile): - st_filter = "0x900" command = "samtools view -c -F{} {}".format(st_filter, bamfile) what = shlex.split(command) @@ -151,7 +148,6 @@ def go(args): qc_pass = "FALSE" if len(fasta.seq) != 0: - pct_N_bases = get_pct_N_bases(fasta) largest_N_gap = get_largest_N_gap(fasta) diff --git a/bin/type_vcf.py b/bin/type_vcf.py index 8d0f258e..dc857af6 100755 --- a/bin/type_vcf.py +++ b/bin/type_vcf.py @@ -210,7 +210,6 @@ def csq_annotate_vcf_string(vcfString, RefIn, GffIn): def extract_csq_info_from_vcf_string(csqVcf, minAF, minDP): - v = io.StringIO(csqVcf) vcf_reader = vcf.Reader(v) @@ -235,7 +234,6 @@ def extract_csq_info_from_vcf_string(csqVcf, minAF, minDP): vcf_type = None for record in vcf_reader: - if vcf_type == "nanopolish": if record.FILTER: continue @@ -260,7 +258,6 @@ def extract_csq_info_from_vcf_string(csqVcf, minAF, minDP): continue if vcf_type == "medaka": - if record.FILTER: continue @@ -289,11 +286,9 @@ def extract_csq_info_from_vcf_string(csqVcf, minAF, minDP): def get_variant_summary(info): - sample_vars = [] for variant in info: - aa_r = re.compile( "(?P[0-9]+)(?P[A-Z\*]+)*>*(?P[0-9]+)*(?P[A-Z\*]+)" ) @@ -308,9 +303,7 @@ def get_variant_summary(info): "synonymous" not in variant["consequence"] and "stop_retained" not in variant["consequence"] ): - if "frameshift" in variant["consequence"]: - complete_aa_variant_string = ( "Frameshift." + aa_var["refpos"] + aa_var["varaa"] ) @@ -345,7 +338,6 @@ def read_types_yaml(inFile): def type_vars_in_sample(types, sample_vars): - types_assigned = [] for typename, data in types.items(): @@ -357,14 +349,10 @@ def type_vars_in_sample(types, sample_vars): # {gene, [var, var]} for gene in data["variants"]: - # { gene: gene, aa_var: var, dna_var: var } for sample_variant in sample_vars: - if gene in sample_variant["gene"]: - if sample_variant["aa_var"] in data["variants"][gene]: - data["variants"][gene].remove(sample_variant["aa_var"]) additional_vars_from_type.remove(sample_variant) @@ -405,13 +393,11 @@ def type_vars_in_sample(types, sample_vars): def write_types_to_csv(types_assigned, sampleID, csvFileOut): - fieldnames = list(types_assigned[0].keys()) fieldnames.insert(0, "sampleID") with open(csvFileOut, "w", newline="") as csvfile: - writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() @@ -421,7 +407,6 @@ def write_types_to_csv(types_assigned, sampleID, csvFileOut): def read_vcf_to_vcf_string(FileIn): - if FileIn.endswith(".gz"): with gzip.open(FileIn, "rt") as f: vcfString = f.read() @@ -444,7 +429,6 @@ def write_sample_vars_to_csv(summaryCsvOut, sampleID, sampleVars): fieldnames.insert(0, "sampleID") with open(summaryCsvOut, "w", newline="") as csvfile: - writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() diff --git a/conf/base.config b/conf/base.config index 05a9ccf9..262193f3 100644 --- a/conf/base.config +++ b/conf/base.config @@ -29,6 +29,9 @@ params{ // Scheme version schemeVersion = 'V3' + // Nextclade dataset name + nextcladeData = 'sars-cov-2-21L' + // Run experimental medaka pipeline? Specify in the command using "--medaka" medaka = false diff --git a/environments/illumina/Singularity b/environments/illumina/Singularity index 3cf5c61d..c6f4f570 100644 --- a/environments/illumina/Singularity +++ b/environments/illumina/Singularity @@ -1,5 +1,5 @@ Bootstrap: docker -From: continuumio/miniconda3:latest +From: condaforge/mambaforge:latest Stage: condabuild %files @@ -11,8 +11,7 @@ authors="Matt Bull" description="Docker image containing all requirements for the ARTIC project's ncov2019 pipeline" %post -/opt/conda/bin/conda install mamba -c conda-forge && \ -/opt/conda/bin/mamba env create -f /environment.yml #&& \ +/opt/conda/bin/mamba env create -f /environment.yml && \ /opt/conda/bin/mamba env update -f /extras.yml -n artic-ncov2019-illumina @@ -25,9 +24,8 @@ export PATH=/opt/conda/envs/artic-ncov2019-illumina/bin:$PATH export LC_ALL=C.UTF-8 export LANG=C.UTF-8 - %files from condabuild - /opt/conda/envs/artic-ncov2019-illumina /opt/conda/envs/artic-ncov2019-illumina +/opt/conda/envs/artic-ncov2019-illumina /opt/conda/envs/artic-ncov2019-illumina %post apt-get update diff --git a/environments/illumina/environment.yml b/environments/illumina/environment.yml index 39c9692a..5a043c2e 100644 --- a/environments/illumina/environment.yml +++ b/environments/illumina/environment.yml @@ -27,7 +27,7 @@ dependencies: - fastqc=0.11.9 - rich=12.6.0 - multiqc=1.11 - - nextclade=1.10.2 + - nextclade=2.11 - sambamba=0.8.0 - ensembl-vep>=102.0 - conda-forge::r-base diff --git a/environments/nanopore/Dockerfile b/environments/nanopore/Dockerfile index d45eef4d..cf4241b8 100644 --- a/environments/nanopore/Dockerfile +++ b/environments/nanopore/Dockerfile @@ -16,4 +16,3 @@ COPY --from=condabuild /opt/conda/envs/artic /opt/conda/envs/artic ENV PATH=/opt/conda/envs/artic/bin:$PATH ENV LC_ALL C.UTF-8 ENV LANG C.UTF-8 -ENTRYPOINT ["/opt/conda/envs/artic/bin/artic"] diff --git a/environments/nanopore/Singularity b/environments/nanopore/Singularity index 5bf0120d..80e58c7f 100644 --- a/environments/nanopore/Singularity +++ b/environments/nanopore/Singularity @@ -1,6 +1,7 @@ Bootstrap: docker -From: continuumio/miniconda3:latest +From: condaforge/mambaforge:latest Stage: condabuild + %files environments/nanopore/environment.yml /environment.yml environments/extras.yml /extras.yml @@ -10,7 +11,6 @@ authors="Matt Bull" description="Docker image containing all requirements for the ARTIC project's ncov2019 pipeline" %post -/opt/conda/bin/conda install mamba -c conda-forge && \ /opt/conda/bin/mamba env create -f /environment.yml #&& \ /opt/conda/bin/mamba env update -f /extras.yml -n artic @@ -24,7 +24,7 @@ apt-get install -y git procps && \ apt-get clean -y %files from condabuild - /opt/conda/envs/artic /opt/conda/envs/artic +/opt/conda/envs/artic /opt/conda/envs/artic %environment export PATH=/opt/conda/envs/artic/bin:$PATH diff --git a/environments/nanopore/environment.yml b/environments/nanopore/environment.yml index 15a7544b..bdcbf144 100644 --- a/environments/nanopore/environment.yml +++ b/environments/nanopore/environment.yml @@ -12,7 +12,7 @@ dependencies: - usher=0.2.0 - snakemake-minimal=5.13 - minimap2=2.17 - - nextclade=1.10.2 + - nextclade=2.11 - fastqc=0.11.9 - rich=12.6.0 - multiqc=1.11 diff --git a/main.nf b/main.nf index c799954d..91d0dfdb 100644 --- a/main.nf +++ b/main.nf @@ -1,7 +1,7 @@ #!/usr/bin/env nextflow // enable dsl2 -nextflow.preview.dsl = 2 +nextflow.enable.dsl=2 // include modules include {containerupdate} from './modules/containerupdate.nf' diff --git a/modules/analysis.nf b/modules/analysis.nf index 43b4742a..9c4dc5fa 100644 --- a/modules/analysis.nf +++ b/modules/analysis.nf @@ -15,8 +15,8 @@ process makeReport { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", mode: 'copy', pattern: "${sampleName}_report.tsv" input: - tuple(sampleName, path('pangolinTyping.csv'), path('nextclade_tree.json'), path('nextclade.tsv'), - path('nextclade.json')) + tuple val(sampleName), path('pangolinTyping.csv'), path('nextclade_tree.json'), path('nextclade.tsv'), + path('nextclade.json') output: path "${sampleName}_report.tsv", emit: tsv diff --git a/modules/artic.nf b/modules/artic.nf index 208576a1..f91981fa 100644 --- a/modules/artic.nf +++ b/modules/artic.nf @@ -54,10 +54,10 @@ process articMinIONMedaka { output: file("${sampleName}*") - tuple sampleName, file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim - tuple sampleName, file("${sampleName}.sorted.bam"), emit: mapped - tuple sampleName, file("${sampleName}.consensus.fasta"), emit: consensus_fasta - tuple sampleName, file("${sampleName}.pass.vcf.gz"), emit: vcf + tuple val(sampleName), file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim + tuple val(sampleName), file("${sampleName}.sorted.bam"), emit: mapped + tuple val(sampleName), file("${sampleName}.consensus.fasta"), emit: consensus_fasta + tuple val(sampleName), file("${sampleName}.pass.vcf.gz"), emit: vcf script: // Make an identifier from the fastq filename @@ -102,10 +102,10 @@ process articMinIONNanopolish { output: file("${sampleName}*") - tuple sampleName, file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim - tuple sampleName, file("${sampleName}.sorted.bam"), emit: mapped - tuple sampleName, file("${sampleName}.consensus.fasta"), emit: consensus_fasta - tuple sampleName, file("${sampleName}.pass.vcf.gz"), emit: vcf + tuple val(sampleName), file("${sampleName}.primertrimmed.rg.sorted.bam"), emit: ptrim + tuple val(sampleName), file("${sampleName}.sorted.bam"), emit: mapped + tuple val(sampleName), file("${sampleName}.consensus.fasta"), emit: consensus_fasta + tuple val(sampleName), file("${sampleName}.pass.vcf.gz"), emit: vcf script: // Make an identifier from the fastq filename @@ -144,10 +144,10 @@ process articRemoveUnmappedReads { cpus 1 input: - tuple(sampleName, path(bamfile)) + tuple val(sampleName), path(bamfile) output: - tuple( sampleName, file("${sampleName}.mapped.sorted.bam")) + tuple val(sampleName), file("${sampleName}.mapped.sorted.bam") script: """ diff --git a/modules/illumina.nf b/modules/illumina.nf index 8efb7b53..6a5ee40b 100644 --- a/modules/illumina.nf +++ b/modules/illumina.nf @@ -13,11 +13,11 @@ process readTrimming { cpus 2 input: - tuple(sampleName, path(forward), path(reverse)) + tuple val(sampleName), path(forward), path(reverse) output: path "*_trimming_report.txt", optional: true, emit: log - tuple sampleName, path("*_val_1.fq.gz"), path("*_val_2.fq.gz"), optional: true, emit: trim + tuple val(sampleName), path("*_val_1.fq.gz"), path("*_val_2.fq.gz"), optional: true, emit: trim script: """ @@ -64,10 +64,10 @@ process readMapping { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.sorted.bam", mode: 'copy' input: - tuple sampleName, path(forward), path(reverse), path(ref), path("*") + tuple val(sampleName), path(forward), path(reverse), path(ref), path("*") output: - tuple sampleName, path("${sampleName}.sorted.bam") + tuple val(sampleName), path("${sampleName}.sorted.bam") script: """ @@ -83,10 +83,10 @@ process flagStat { input: //tuple sampleName, path(forward), path(reverse), path(ref), path("*") - tuple sampleName, path(bam) + tuple val(sampleName), path(bam) output: - tuple sampleName, path("${sampleName}.flagstat") + tuple val(sampleName), path("${sampleName}.flagstat") script: """ @@ -103,13 +103,13 @@ process trimPrimerSequences { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.mapped.primertrimmed.sorted.bam.bai", mode: 'copy' input: - tuple sampleName, path(bam), path(bedfile) + tuple val(sampleName), path(bam), path(bedfile) output: - tuple sampleName, path("${sampleName}.mapped.bam"), emit: mapped - tuple sampleName, path("${sampleName}.mapped.primertrimmed.sorted.bam" ), emit: ptrim - tuple sampleName, path("${sampleName}.mapped.primertrimmed.sorted.bam.bai"), emit: bai + tuple val(sampleName), path("${sampleName}.mapped.bam"), emit: mapped + tuple val(sampleName), path("${sampleName}.mapped.primertrimmed.sorted.bam" ), emit: ptrim + tuple val(sampleName), path("${sampleName}.mapped.primertrimmed.sorted.bam.bai"), emit: bai script: if (params.allowNoprimer){ @@ -154,10 +154,10 @@ process depth { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.depth", mode: 'copy' input: - tuple(sampleName, path(bam), path(bai)) + tuple val(sampleName), path(bam), path(bai) output: - tuple sampleName, path("${sampleName}.depth"), emit: depth + tuple val(sampleName), path("${sampleName}.depth"), emit: depth script: """ @@ -173,10 +173,10 @@ process callVariants { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.variants.tsv", mode: 'copy' input: - tuple(sampleName, path(bam), path(ref)) + tuple val(sampleName), path(bam), path(ref) output: - tuple sampleName, path("${sampleName}.variants.tsv"), emit: variants + tuple val(sampleName), path("${sampleName}.variants.tsv"), emit: variants script: """ @@ -193,10 +193,10 @@ process makeConsensus { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.primertrimmed.consensus.fa", mode: 'copy' input: - tuple(sampleName, path(bam)) + tuple val(sampleName), path(bam) output: - tuple sampleName, path("${sampleName}.primertrimmed.consensus.fa"), emit: consensus_fasta + tuple val(sampleName), path("${sampleName}.primertrimmed.consensus.fa"), emit: consensus_fasta script: """ @@ -214,11 +214,11 @@ process callConsensusFreebayes { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.variants.norm.vcf", mode: 'copy' input: - tuple(sampleName, path(bam), path(ref)) + tuple val(sampleName), path(bam), path(ref) output: - tuple sampleName, path("${sampleName}.consensus.fasta") - tuple sampleName, path("${sampleName}.variants.norm.vcf"), emit:vcf + tuple val(sampleName), path("${sampleName}.consensus.fasta") + tuple val(sampleName), path("${sampleName}.variants.norm.vcf"), emit:vcf script: """ @@ -267,10 +267,10 @@ process annotationVEP { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${sampleName}.freebayes.vep.vcf", mode: 'copy' input: - tuple sampleName, path(vcf),path(ref) + tuple val(sampleName), path(vcf),path(ref) output: - tuple sampleName, path("${sampleName}.freebayes.vep.vcf") + tuple val(sampleName), path("${sampleName}.freebayes.vep.vcf") script: """ @@ -292,10 +292,10 @@ process cramToFastq { */ input: - tuple sampleName, file(cram) + tuple val(sampleName), file(cram) output: - tuple sampleName, path("${sampleName}_1.fastq.gz"), path("${sampleName}_2.fastq.gz") + tuple val(sampleName), path("${sampleName}_1.fastq.gz"), path("${sampleName}_2.fastq.gz") script: """ diff --git a/modules/out.nf b/modules/out.nf index 29426f33..b0a4fa5d 100644 --- a/modules/out.nf +++ b/modules/out.nf @@ -11,11 +11,11 @@ process bamToCram { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "${bam.baseName}.cram.crai", mode: 'copy' input: - tuple(sampleName, path(bam), path(ref)) + tuple val(sampleName), path(bam), path(ref) output: - tuple sampleName, path("${bam.baseName}.cram"), emit: cramed - tuple sampleName, path("${bam.baseName}.cram.crai"), emit: cramedidx + tuple val(sampleName), path("${bam.baseName}.cram"), emit: cramed + tuple val(sampleName), path("${bam.baseName}.cram.crai"), emit: cramedidx script: """ diff --git a/modules/qc.nf b/modules/qc.nf index 2a294cb4..aeef882a 100644 --- a/modules/qc.nf +++ b/modules/qc.nf @@ -4,7 +4,7 @@ process makeQCCSV { publishDir "${params.outdir}/qc_plots", pattern: "${sampleName}.depth.png", mode: 'copy' input: - tuple sampleName, path(bam), path(fasta), path(ref) + tuple val(sampleName), path(bam), path(fasta), path(ref) output: path "${params.prefix}.${sampleName}.qc.csv", emit: csv @@ -42,7 +42,7 @@ process fastqc { publishDir "${params.outdir}/QCStats/${task.process.replaceAll(":","_")}", mode: 'copy', overwrite: true input: - tuple sampleName, path(forward), path(reverse) + tuple val(sampleName), path(forward), path(reverse) output: file "*fastqc*" @@ -60,7 +60,7 @@ process statsCoverage { publishDir "${params.outdir}/QCStats/${task.process.replaceAll(":","_")}", pattern: "*.txt", mode: 'copy' input: - tuple sampleName, path(bam), path(ref) + tuple val(sampleName), path(bam), path(ref) output: path "*.txt" @@ -82,7 +82,7 @@ process statsInsert { publishDir "${params.outdir}/QCStats/${task.process.replaceAll(":","_")}", pattern: "*.pdf", mode: 'copy' input: - tuple sampleName, path(bam), path(ref) + tuple val(sampleName), path(bam), path(ref) output: path "${sampleName}_insert_size.metrics.txt", emit: stats @@ -108,7 +108,7 @@ process statsAlignment { publishDir "${params.outdir}/QCStats/${task.process.replaceAll(":","_")}", pattern: "*.txt", mode: 'copy' input: - tuple sampleName, path(bam), path(ref) + tuple val(sampleName), path(bam), path(ref) output: path "${sampleName}_alignment.metrics.txt" diff --git a/modules/typing.nf b/modules/typing.nf index 96f839e5..7de7dcfd 100644 --- a/modules/typing.nf +++ b/modules/typing.nf @@ -8,7 +8,7 @@ process typeVariants { publishDir "${params.outdir}/${task.process.replaceAll(":","_")}/typing", pattern: "${sampleName}.typing.csv", mode: 'copy' input: - tuple sampleName, path(variants), path(gff), path(ref), path(yaml) + tuple val(sampleName), path(variants), path(gff), path(ref), path(yaml) output: path "${sampleName}.variants.csv", optional: true, emit: variants_csv @@ -101,34 +101,34 @@ process pangolinTyping { script: """ - pangolin ${consensus_fasta} --max-ambig 0.2 --outfile ${sampleName}.pangolin.csv + pangolin ${consensus_fasta} --max-ambig 0.2 --outfile ${sampleName}.pangolin.csv """ } process nextclade { tag { sampleName } - label 'nextclade' + label 'nextclade' publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", mode: 'copy', pattern: "${sampleName}.tsv" input: tuple val(sampleName), path(consensus_fasta) - + output: - tuple(sampleName, path("${sampleName}_tree.json"), - path("${sampleName}.tsv"),path("${sampleName}.json")) + tuple val(sampleName), path("${sampleName}_tree.json"), + path("${sampleName}.tsv"), path("${sampleName}.json") script: """ - echo \$(nextclade --version 2>&1) > nextclade_version.txt - nextclade dataset get --name 'sars-cov-2' --output-dir 'data/sars-cov-2' - nextclade --input-fasta ${consensus_fasta} \ - --input-dataset data/sars-cov-2 \ + echo \$(nextclade --version 2>&1) > nextclade_version.txt + nextclade dataset get --name ${params.nextcladeData} --output-dir 'data/${params.nextcladeData}' + nextclade run \ + --input-dataset data/${params.nextcladeData} \ --output-tree ${sampleName}_tree.json \ --output-tsv ${sampleName}.tsv \ - --output-json ${sampleName}.json + --output-json ${sampleName}.json \ + ${consensus_fasta} + """ - """ - } diff --git a/modules/upload.nf b/modules/upload.nf index ae6a9c84..3f1c8ad8 100644 --- a/modules/upload.nf +++ b/modules/upload.nf @@ -4,7 +4,7 @@ process collateSamples { publishDir "${params.outdir}/qc_pass_climb_upload/${params.prefix}", pattern: "${sampleName}", mode: 'copy' input: - tuple(sampleName, path(bam), path(fasta)) + tuple val(sampleName), path(bam), path(fasta) output: path("${sampleName}") diff --git a/workflows/articNcovNanopore.nf b/workflows/articNcovNanopore.nf index 9b0eee4e..a9d39950 100644 --- a/workflows/articNcovNanopore.nf +++ b/workflows/articNcovNanopore.nf @@ -1,7 +1,7 @@ // ARTIC ncov workflow // enable dsl2 -nextflow.preview.dsl = 2 +nextflow.enable.dsl=2 // import modules include {articDownloadScheme} from '../modules/artic.nf' diff --git a/workflows/illuminaNcov.nf b/workflows/illuminaNcov.nf index 5091d427..de2574f9 100644 --- a/workflows/illuminaNcov.nf +++ b/workflows/illuminaNcov.nf @@ -1,7 +1,7 @@ #!/usr/bin/env nextflow // enable dsl2 -nextflow.preview.dsl = 2 +nextflow.enable.dsl=2 // import modules include {articDownloadScheme } from '../modules/artic.nf' @@ -114,7 +114,7 @@ workflow sequenceAnalysis { readMapping(readTrimming.out.trim.combine(ch_preparedRef)) - flagStat(readMapping.out.combine(ch_bedFile)) + flagStat(readMapping.out) trimPrimerSequences(readMapping.out.combine(ch_bedFile))