From d473a247d2e0c619b0df877ea19d9a5a98c8e3c8 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Tue, 7 Dec 2021 15:00:43 +0100 Subject: [PATCH] Replace remaining task.ext.suffix with task.ext.prefix (#1117) * Replace remaining task.ext.suffix with task.ext.prefix --- modules/artic/minion/main.nf | 4 ++-- modules/bakta/main.nf | 6 +++--- modules/bcftools/concat/main.nf | 4 ++-- modules/bcftools/isec/main.nf | 4 ++-- modules/bcftools/merge/main.nf | 4 ++-- modules/bedtools/getfasta/main.nf | 4 ++-- modules/checkm/lineagewf/main.nf | 4 ++-- modules/csvtk/concat/main.nf | 4 ++-- modules/damageprofiler/main.nf | 4 ++-- modules/dedup/main.nf | 4 ++-- modules/fargene/main.nf | 4 ++-- modules/gatk4/genomicsdbimport/main.nf | 4 ++-- modules/gffread/main.nf | 4 ++-- modules/leehom/main.nf | 4 ++-- modules/msisensor/msi/main.nf | 4 ++-- modules/nextclade/main.nf | 4 ++-- modules/optitype/main.nf | 6 +++--- modules/plasmidid/main.nf | 4 ++-- modules/prodigal/main.nf | 4 ++-- modules/prokka/main.nf | 4 ++-- modules/qualimap/bamqc/main.nf | 4 ++-- modules/qualimap/rnaseq/main.nf | 4 ++-- modules/quast/main.nf | 4 ++-- modules/rsem/calculateexpression/main.nf | 4 ++-- modules/salmon/quant/main.nf | 4 ++-- modules/samtools/merge/main.nf | 4 ++-- modules/seqkit/split2/main.nf | 1 - modules/seqtk/subseq/main.nf | 4 ++-- modules/tbprofiler/profile/main.nf | 4 ++-- tests/modules/gffread/nextflow.config | 2 +- tests/modules/seqtk/subseq/nextflow.config | 2 +- 31 files changed, 60 insertions(+), 61 deletions(-) diff --git a/modules/artic/minion/main.nf b/modules/artic/minion/main.nf index 86863f95..ce04fcc8 100644 --- a/modules/artic/minion/main.nf +++ b/modules/artic/minion/main.nf @@ -32,8 +32,8 @@ process ARTIC_MINION { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def version = scheme_version.toString().toLowerCase().replaceAll('v','') def fast5 = fast5_dir ? "--fast5-directory $fast5_dir" : "" def summary = sequencing_summary ? "--sequencing-summary $sequencing_summary" : "" diff --git a/modules/bakta/main.nf b/modules/bakta/main.nf index 20127e53..2582dac2 100644 --- a/modules/bakta/main.nf +++ b/modules/bakta/main.nf @@ -26,8 +26,8 @@ process BAKTA { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def proteins_opt = proteins ? "--proteins ${proteins[0]}" : "" def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : "" """ @@ -47,7 +47,7 @@ process BAKTA { """ stub: - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.embl touch ${prefix}.faa diff --git a/modules/bcftools/concat/main.nf b/modules/bcftools/concat/main.nf index dbd9d9dc..cebd2443 100644 --- a/modules/bcftools/concat/main.nf +++ b/modules/bcftools/concat/main.nf @@ -15,8 +15,8 @@ process BCFTOOLS_CONCAT { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ bcftools concat \\ --output ${prefix}.vcf.gz \\ diff --git a/modules/bcftools/isec/main.nf b/modules/bcftools/isec/main.nf index c4eab09d..08323f28 100644 --- a/modules/bcftools/isec/main.nf +++ b/modules/bcftools/isec/main.nf @@ -15,8 +15,8 @@ process BCFTOOLS_ISEC { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ bcftools isec \\ $args \\ diff --git a/modules/bcftools/merge/main.nf b/modules/bcftools/merge/main.nf index 32ad760c..bfb0f162 100644 --- a/modules/bcftools/merge/main.nf +++ b/modules/bcftools/merge/main.nf @@ -15,8 +15,8 @@ process BCFTOOLS_MERGE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ bcftools merge -Oz \\ --output ${prefix}.vcf.gz \\ diff --git a/modules/bedtools/getfasta/main.nf b/modules/bedtools/getfasta/main.nf index c4dae429..5a283e94 100644 --- a/modules/bedtools/getfasta/main.nf +++ b/modules/bedtools/getfasta/main.nf @@ -16,8 +16,8 @@ process BEDTOOLS_GETFASTA { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - def prefix = task.ext.suffix ? "${bed.baseName}${task.ext.suffix}" : "${bed.baseName}" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${bed.baseName}" """ bedtools \\ getfasta \\ diff --git a/modules/checkm/lineagewf/main.nf b/modules/checkm/lineagewf/main.nf index 119ee491..992b165e 100644 --- a/modules/checkm/lineagewf/main.nf +++ b/modules/checkm/lineagewf/main.nf @@ -17,8 +17,8 @@ process CHECKM_LINEAGEWF { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ checkm \\ lineage_wf \\ diff --git a/modules/csvtk/concat/main.nf b/modules/csvtk/concat/main.nf index 745a9ac4..94b1925a 100644 --- a/modules/csvtk/concat/main.nf +++ b/modules/csvtk/concat/main.nf @@ -17,8 +17,8 @@ process CSVTK_CONCAT { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def delimiter = in_format == "tsv" ? "\t" : (in_format == "csv" ? "," : in_format) def out_delimiter = out_format == "tsv" ? "\t" : (out_format == "csv" ? "," : out_format) out_extension = out_format == "tsv" ? 'tsv' : 'csv' diff --git a/modules/damageprofiler/main.nf b/modules/damageprofiler/main.nf index da37909e..23eb9397 100644 --- a/modules/damageprofiler/main.nf +++ b/modules/damageprofiler/main.nf @@ -18,8 +18,8 @@ process DAMAGEPROFILER { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def reference = fasta ? "-r $fasta" : "" def species_list = specieslist ? "-sf $specieslist" : "" """ diff --git a/modules/dedup/main.nf b/modules/dedup/main.nf index 60fc376e..8b4bdc37 100644 --- a/modules/dedup/main.nf +++ b/modules/dedup/main.nf @@ -18,8 +18,8 @@ process DEDUP { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ dedup \\ diff --git a/modules/fargene/main.nf b/modules/fargene/main.nf index ac3f8338..73bdd411 100644 --- a/modules/fargene/main.nf +++ b/modules/fargene/main.nf @@ -32,8 +32,8 @@ process FARGENE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ fargene \\ $args \\ diff --git a/modules/gatk4/genomicsdbimport/main.nf b/modules/gatk4/genomicsdbimport/main.nf index 110dbf4f..e794aa5a 100644 --- a/modules/gatk4/genomicsdbimport/main.nf +++ b/modules/gatk4/genomicsdbimport/main.nf @@ -20,8 +20,8 @@ process GATK4_GENOMICSDBIMPORT { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" // settings for running default create gendb mode inputs_command = input_map ? "--sample-name-map ${vcf[0]}" : "${'-V ' + vcf.join(' -V ')}" diff --git a/modules/gffread/main.nf b/modules/gffread/main.nf index d31f76f8..e7893f8b 100644 --- a/modules/gffread/main.nf +++ b/modules/gffread/main.nf @@ -15,8 +15,8 @@ process GFFREAD { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - def prefix = task.ext.suffix ? "${gff.baseName}${task.ext.suffix}" : "${gff.baseName}" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${gff.baseName}" """ gffread \\ $gff \\ diff --git a/modules/leehom/main.nf b/modules/leehom/main.nf index d997e68b..b5cb2dcb 100644 --- a/modules/leehom/main.nf +++ b/modules/leehom/main.nf @@ -24,8 +24,8 @@ process LEEHOM { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" if (reads.toString().endsWith('.bam')) { """ diff --git a/modules/msisensor/msi/main.nf b/modules/msisensor/msi/main.nf index 1eb510a1..398b34a6 100644 --- a/modules/msisensor/msi/main.nf +++ b/modules/msisensor/msi/main.nf @@ -18,8 +18,8 @@ process MSISENSOR_MSI { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ msisensor \\ msi \\ diff --git a/modules/nextclade/main.nf b/modules/nextclade/main.nf index 317d393d..f60af57b 100755 --- a/modules/nextclade/main.nf +++ b/modules/nextclade/main.nf @@ -19,8 +19,8 @@ process NEXTCLADE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ nextclade \\ $args \\ diff --git a/modules/optitype/main.nf b/modules/optitype/main.nf index 24be66a7..d27f7f9f 100644 --- a/modules/optitype/main.nf +++ b/modules/optitype/main.nf @@ -15,9 +15,9 @@ process OPTITYPE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - def args2 = task.ext.args2 ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ # Create a config for OptiType on a per sample basis with task.ext.args2 diff --git a/modules/plasmidid/main.nf b/modules/plasmidid/main.nf index 290ae549..7404a678 100644 --- a/modules/plasmidid/main.nf +++ b/modules/plasmidid/main.nf @@ -23,8 +23,8 @@ process PLASMIDID { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ plasmidID \\ -d $fasta \\ diff --git a/modules/prodigal/main.nf b/modules/prodigal/main.nf index b09da13c..184b17bb 100644 --- a/modules/prodigal/main.nf +++ b/modules/prodigal/main.nf @@ -19,8 +19,8 @@ process PRODIGAL { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ prodigal -i "${genome}" \\ $args \\ diff --git a/modules/prokka/main.nf b/modules/prokka/main.nf index 8fae6367..551a17b9 100644 --- a/modules/prokka/main.nf +++ b/modules/prokka/main.nf @@ -28,8 +28,8 @@ process PROKKA { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def proteins_opt = proteins ? "--proteins ${proteins[0]}" : "" def prodigal_opt = prodigal_tf ? "--prodigaltf ${prodigal_tf[0]}" : "" """ diff --git a/modules/qualimap/bamqc/main.nf b/modules/qualimap/bamqc/main.nf index a47fde7e..973fd6a4 100644 --- a/modules/qualimap/bamqc/main.nf +++ b/modules/qualimap/bamqc/main.nf @@ -17,8 +17,8 @@ process QUALIMAP_BAMQC { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def collect_pairs = meta.single_end ? '' : '--collect-overlap-pairs' def memory = task.memory.toGiga() + "G" diff --git a/modules/qualimap/rnaseq/main.nf b/modules/qualimap/rnaseq/main.nf index 459f3da5..d83fcd99 100644 --- a/modules/qualimap/rnaseq/main.nf +++ b/modules/qualimap/rnaseq/main.nf @@ -16,8 +16,8 @@ process QUALIMAP_RNASEQ { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def paired_end = meta.single_end ? '' : '-pe' def memory = task.memory.toGiga() + "G" diff --git a/modules/quast/main.nf b/modules/quast/main.nf index 43caca3d..e88051b5 100644 --- a/modules/quast/main.nf +++ b/modules/quast/main.nf @@ -19,8 +19,8 @@ process QUAST { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ?: 'quast' + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: 'quast' def features = use_gff ? "--features $gff" : '' def reference = use_fasta ? "-r $fasta" : '' """ diff --git a/modules/rsem/calculateexpression/main.nf b/modules/rsem/calculateexpression/main.nf index 659082fa..4b2ada47 100644 --- a/modules/rsem/calculateexpression/main.nf +++ b/modules/rsem/calculateexpression/main.nf @@ -23,8 +23,8 @@ process RSEM_CALCULATEEXPRESSION { tuple val(meta), path("${prefix}.transcript.bam"), optional:true, emit: bam_transcript script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def strandedness = '' if (meta.strandedness == 'forward') { diff --git a/modules/salmon/quant/main.nf b/modules/salmon/quant/main.nf index 9557fd24..6cae4f72 100644 --- a/modules/salmon/quant/main.nf +++ b/modules/salmon/quant/main.nf @@ -20,8 +20,8 @@ process SALMON_QUANT { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def reference = "--index $index" def input_reads = meta.single_end ? "-r $reads" : "-1 ${reads[0]} -2 ${reads[1]}" diff --git a/modules/samtools/merge/main.nf b/modules/samtools/merge/main.nf index 8eeb64a2..fcfcf61f 100644 --- a/modules/samtools/merge/main.nf +++ b/modules/samtools/merge/main.nf @@ -17,8 +17,8 @@ process SAMTOOLS_MERGE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def file_type = input_files[0].getExtension() def reference = fasta ? "--reference ${fasta}" : "" """ diff --git a/modules/seqkit/split2/main.nf b/modules/seqkit/split2/main.nf index 7e361a06..5bed1dae 100644 --- a/modules/seqkit/split2/main.nf +++ b/modules/seqkit/split2/main.nf @@ -17,7 +17,6 @@ process SEQKIT_SPLIT2 { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - if(meta.single_end){ """ seqkit \\ diff --git a/modules/seqtk/subseq/main.nf b/modules/seqtk/subseq/main.nf index 1d93b061..abfe4faa 100644 --- a/modules/seqtk/subseq/main.nf +++ b/modules/seqtk/subseq/main.nf @@ -16,8 +16,8 @@ process SEQTK_SUBSEQ { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - def prefix = task.ext.suffix ?: '' + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: '' def ext = "fa" if ("$sequences" ==~ /.+\.fq|.+\.fq.gz|.+\.fastq|.+\.fastq.gz/) { ext = "fq" diff --git a/modules/tbprofiler/profile/main.nf b/modules/tbprofiler/profile/main.nf index 3f6bffc3..87175a39 100644 --- a/modules/tbprofiler/profile/main.nf +++ b/modules/tbprofiler/profile/main.nf @@ -19,8 +19,8 @@ process TBPROFILER_PROFILE { path "versions.yml" , emit: versions script: - def args = task.ext.args ?: '' - prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" def input_reads = meta.single_end ? "--read1 $reads" : "--read1 ${reads[0]} --read2 ${reads[1]}" """ tb-profiler \\ diff --git a/tests/modules/gffread/nextflow.config b/tests/modules/gffread/nextflow.config index c020f934..0714a6e8 100644 --- a/tests/modules/gffread/nextflow.config +++ b/tests/modules/gffread/nextflow.config @@ -3,7 +3,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: GFFREAD { - ext.prefix = { "${meta.id}.out" } + ext.prefix = { "${gff.baseName}.out" } } } diff --git a/tests/modules/seqtk/subseq/nextflow.config b/tests/modules/seqtk/subseq/nextflow.config index 24f16bad..8a8b9b45 100644 --- a/tests/modules/seqtk/subseq/nextflow.config +++ b/tests/modules/seqtk/subseq/nextflow.config @@ -3,7 +3,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } withName: SEQTK_SUBSEQ { - ext.prefix = { "${meta.id}.filtered" } + ext.prefix = { ".filtered" } } }