From 318f05aa45c208ef8c4b4b71c48b4297fee70af6 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Fri, 30 May 2025 19:48:13 +0200 Subject: [PATCH 1/2] update subworkflows to adhere to lang server --- conf/modules/aligner.config | 93 +++++----- conf/modules/annotate.config | 151 ++++++++-------- conf/modules/freebayes.config | 20 +-- conf/modules/haplotypecaller.config | 18 +- conf/modules/indexcov.config | 19 +- conf/modules/joint_germline.config | 12 +- conf/modules/lofreq.config | 44 +++-- conf/modules/manta.config | 19 +- conf/modules/markduplicates.config | 1 + conf/modules/modules.config | 24 ++- conf/modules/mpileup.config | 48 +++--- conf/modules/mutect2.config | 163 +++++++++--------- conf/modules/prepare_recalibration.config | 1 + conf/modules/recalibrate.config | 1 + conf/test.config | 1 + main.nf | 91 +++++----- modules.json | 8 +- .../controlfreec/freec/environment.yml | 2 + .../nf-core/controlfreec/freec/tests/tags.yml | 2 - .../sentieon/haplotyper/environment.yml | 4 +- modules/nf-core/sentieon/haplotyper/main.nf | 14 +- modules/nf-core/sentieon/haplotyper/meta.yml | 8 +- .../haplotyper/tests/main.nf.test.snap | 66 +++---- .../sentieon/haplotyper/tests/tags.yml | 2 - nextflow.config | 11 +- subworkflows/local/bam_applybqsr/main.nf | 10 +- .../local/bam_applybqsr_spark/main.nf | 10 +- .../local/bam_baserecalibrator/main.nf | 4 +- .../local/bam_baserecalibrator_spark/main.nf | 4 +- .../bam_joint_calling_germline_gatk/main.nf | 28 +-- .../main.nf | 12 +- subworkflows/local/bam_markduplicates/main.nf | 2 +- .../local/bam_markduplicates_spark/main.nf | 4 +- .../local/bam_merge_index_samtools/main.nf | 6 +- subworkflows/local/bam_sentieon_dedup/main.nf | 4 +- .../bam_variant_calling_deepvariant/main.nf | 2 +- .../bam_variant_calling_freebayes/main.nf | 2 +- .../bam_variant_calling_germline_all/main.nf | 24 +-- .../main.nf | 4 +- .../main.nf | 12 +- .../local/bam_variant_calling_mpileup/main.nf | 4 +- .../main.nf | 24 +-- .../main.nf | 26 +-- .../main.nf | 8 +- .../bam_variant_calling_somatic_all/main.nf | 12 +- .../bam_variant_calling_somatic_manta/main.nf | 4 +- .../main.nf | 22 +-- .../main.nf | 2 +- .../main.nf | 14 +- .../main.nf | 2 +- .../main.nf | 4 +- .../main.nf | 14 +- .../local/channel_align_create_csv/main.nf | 18 +- .../channel_applybqsr_create_csv/main.nf | 18 +- .../main.nf | 72 ++++---- .../channel_markduplicates_create_csv/main.nf | 22 +-- .../main.nf | 11 +- .../local/cram_merge_index_samtools/main.nf | 8 +- subworkflows/local/cram_sampleqc/main.nf | 2 +- .../main.nf | 4 +- subworkflows/local/prepare_intervals/main.nf | 9 +- .../local/prepare_reference_cnvkit/main.nf | 2 +- .../local/samplesheet_to_channel/main.nf | 4 +- .../local/utils_nfcore_sarek_pipeline/main.nf | 88 ++++------ subworkflows/local/vcf_annotate_all/main.nf | 6 +- .../local/vcf_annotate_bcftools/main.nf | 2 +- .../local/vcf_qc_bcftools_vcftools/main.nf | 2 +- .../local/vcf_variant_filtering_gatk/main.nf | 4 +- .../nf-core/utils_nextflow_pipeline/main.nf | 2 + .../tests/main.workflow.nf.test | 10 +- .../utils_nextflow_pipeline/tests/tags.yml | 2 - .../nf-core/utils_nfcore_pipeline/main.nf | 89 +++------- .../tests/main.function.nf.test | 46 ++--- .../tests/main.function.nf.test.snap | 30 ---- .../utils_nfcore_pipeline/tests/tags.yml | 2 - 75 files changed, 710 insertions(+), 830 deletions(-) delete mode 100644 modules/nf-core/controlfreec/freec/tests/tags.yml delete mode 100644 modules/nf-core/sentieon/haplotyper/tests/tags.yml delete mode 100644 subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml delete mode 100644 subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml diff --git a/conf/modules/aligner.config b/conf/modules/aligner.config index 70926d573a..7a92fd27bd 100644 --- a/conf/modules/aligner.config +++ b/conf/modules/aligner.config @@ -15,61 +15,60 @@ process { - if (params.step == 'mapping') { - withName: 'BWAMEM1_MEM' { - ext.when = { params.aligner == 'bwa-mem' } - } + withName: "BWAMEM1_MEM" { + ext.when = { params.aligner == 'bwa-mem' } + } - withName: 'BWAMEM2_MEM' { - ext.when = { params.aligner == 'bwa-mem2' } - } + withName: 'BWAMEM2_MEM' { + ext.when = { params.aligner == 'bwa-mem2' } + } - withName: 'DRAGMAP_ALIGN' { - ext.args = { "--RGSM ${meta.patient}_${meta.sample} --RGID ${meta.read_group}" } - ext.when = { params.aligner == 'dragmap' } - } + withName: 'DRAGMAP_ALIGN' { + ext.args = { "--RGSM ${meta.patient}_${meta.sample} --RGID ${meta.read_group}" } + ext.when = { params.aligner == 'dragmap' } + } - withName: 'SENTIEON_BWAMEM' { - ext.prefix = { params.split_fastq > 1 ? "${meta.id}".concat('.').concat(reads.get(0).name.tokenize('.')[0]).concat('.bam') : "${meta.id}.sorted.bam" } - ext.when = { params.aligner == 'sentieon-bwamem' } - } + withName: 'SENTIEON_BWAMEM' { + ext.prefix = { params.split_fastq > 1 ? "${meta.id}".concat('.').concat(reads.get(0).name.tokenize('.')[0]).concat('.bam') : "${meta.id}.sorted.bam" } + ext.when = { params.aligner == 'sentieon-bwamem' } + } - withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN|SENTIEON_BWAMEM' { - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/preprocessing/" }, - pattern: "*bam", - // Only save if save_output_as_bam AND - // (save_mapped OR no_markduplicates OR sentieon_dedup) AND - // only a single BAM file per sample - saveAs: { - if (params.save_output_as_bam && - ( - params.save_mapped || - (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) && - !(params.tools && params.tools.split(',').contains('sentieon_dedup')) - ) && (meta.size * meta.num_lanes == 1) - ) { "mapped/${meta.id}/${it}" } - else { null } - } - ] - } + withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN|SENTIEON_BWAMEM' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/preprocessing/" }, + pattern: "*bam", + // Only save if save_output_as_bam AND + // (save_mapped OR no_markduplicates OR sentieon_dedup) AND + // only a single BAM file per sample + saveAs: { + if (params.save_output_as_bam && + ( + params.save_mapped || + (params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) && + !(params.tools && params.tools.split(',').contains('sentieon_dedup')) + ) && (meta.size * meta.num_lanes == 1) + ) { "mapped/${meta.id}/${it}" } + else { null } + } + ] + } - withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN' { - ext.prefix = { params.split_fastq > 1 ? "${meta.id}".concat('.').concat(reads.get(0).name.tokenize('.')[0]) : "${meta.id}.sorted" } - // Markduplicates Spark NEEDS name-sorted reads or runtime goes through the roof - // However if it's skipped, reads need to be coordinate-sorted - // Only name sort if Spark for Markduplicates + duplicate marking is not skipped - // Currently SENTIEON_BWAMEM only supports coordinate sorting the reads. - ext.args2 = { params.use_gatk_spark && params.use_gatk_spark.contains('markduplicates') && (!params.skip_tools || (params.skip_tools && !params.skip_tools.split(',').contains('markduplicates'))) ? '-n' : '' } - } + withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN' { + ext.prefix = { params.split_fastq > 1 ? "${meta.id}".concat('.').concat(reads.get(0).name.tokenize('.')[0]) : "${meta.id}.sorted" } + // Markduplicates Spark NEEDS name-sorted reads or runtime goes through the roof + // However if it's skipped, reads need to be coordinate-sorted + // Only name sort if Spark for Markduplicates + duplicate marking is not skipped + // Currently SENTIEON_BWAMEM only supports coordinate sorting the reads. + ext.args2 = { params.use_gatk_spark && params.use_gatk_spark.contains('markduplicates') && (!params.skip_tools || (params.skip_tools && !params.skip_tools.split(',').contains('markduplicates'))) ? '-n' : '' } + } - withName: 'BWAMEM.*_MEM|SENTIEON_BWAMEM' { - // Using -B 3 for tumor samples - ext.args = { meta.status == 1 ? "-K 100000000 -Y -B 3 -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" } - } + withName: 'BWAMEM.*_MEM|SENTIEON_BWAMEM' { + // Using -B 3 for tumor samples + ext.args = { meta.status == 1 ? "-K 100000000 -Y -B 3 -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" } } + withName: 'MERGE_BAM|INDEX_MERGE_BAM' { publishDir = [ mode: params.publish_dir_mode, diff --git a/conf/modules/annotate.config b/conf/modules/annotate.config index 6459a686fa..be89ff3c65 100644 --- a/conf/modules/annotate.config +++ b/conf/modules/annotate.config @@ -16,102 +16,91 @@ process { // SNPEFF - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) { - withName: 'SNPEFF_SNPEFF' { - ext.args = { '-nodownload -canon -v' } - ext.prefix = { vcf.baseName - '.vcf' + '_snpEff' } - publishDir = [ - [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/reports/snpeff/${meta.variantcaller}/${meta.id}/" }, - pattern: "*{csv,html,genes.txt}", - saveAs: { params.tools.split(',').contains('snpeff') ? it : null } - ] + withName: 'SNPEFF_SNPEFF' { + ext.args = { '-nodownload -canon -v' } + ext.prefix = { vcf.baseName - '.vcf' + '_snpEff' } + publishDir = [ + [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/reports/snpeff/${meta.variantcaller}/${meta.id}/" }, + pattern: "*{csv,html,genes.txt}", + saveAs: { params.tools.split(',').contains('snpeff') ? it : null } ] - } + ] } + // VEP - if (params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge'))) { - withName: 'ENSEMBLVEP_VEP' { - ext.args = { [ - "--stats_file ${vcf.baseName - '.vcf' + '_VEP.ann'}.summary.html", - (params.vep_dbnsfp && params.dbnsfp && !params.dbnsfp_consequence) ? "--plugin dbNSFP,${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', - (params.vep_dbnsfp && params.dbnsfp && params.dbnsfp_consequence) ? "--plugin dbNSFP,'consequence=${params.dbnsfp_consequence}',${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', - (params.vep_loftee) ? "--plugin LoF,loftee_path:/usr/local/share/ensembl-vep-${params.vep_version}" : '', - (params.vep_spliceai && params.spliceai_snv && params.spliceai_indel) ? "--plugin SpliceAI,snv=${params.spliceai_snv.split("/")[-1]},indel=${params.spliceai_indel.split("/")[-1]}" : '', - (params.vep_spliceregion) ? '--plugin SpliceRegion' : '', - (params.vep_out_format) ? "--${params.vep_out_format}" : '--vcf', - (params.vep_custom_args) ?: '' - ].join(' ').trim() } - // If just VEP: _VEP.ann.vcf - ext.prefix = { vcf.baseName - '.vcf' + '_VEP.ann' } - publishDir = [ - [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/reports/EnsemblVEP/${meta.variantcaller}/${meta.id}/" }, - pattern: "*html" - ], - [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, - pattern: "*{gz}" - ] + withName: 'ENSEMBLVEP_VEP' { + ext.args = { [ + "--stats_file ${vcf.baseName - '.vcf' + '_VEP.ann'}.summary.html", + (params.vep_dbnsfp && params.dbnsfp && !params.dbnsfp_consequence) ? "--plugin dbNSFP,${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', + (params.vep_dbnsfp && params.dbnsfp && params.dbnsfp_consequence) ? "--plugin dbNSFP,'consequence=${params.dbnsfp_consequence}',${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', + (params.vep_loftee) ? "--plugin LoF,loftee_path:/usr/local/share/ensembl-vep-${params.vep_version}" : '', + (params.vep_spliceai && params.spliceai_snv && params.spliceai_indel) ? "--plugin SpliceAI,snv=${params.spliceai_snv.split("/")[-1]},indel=${params.spliceai_indel.split("/")[-1]}" : '', + (params.vep_spliceregion) ? '--plugin SpliceRegion' : '', + (params.vep_out_format) ? "--${params.vep_out_format}" : '--vcf', + (params.vep_custom_args) ?: '' + ].join(' ').trim() } + // If just VEP: _VEP.ann.vcf + ext.prefix = { vcf.baseName - '.vcf' + '_VEP.ann' } + publishDir = [ + [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/reports/EnsemblVEP/${meta.variantcaller}/${meta.id}/" }, + pattern: "*html" + ], + [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, + pattern: "*{gz}" ] - } + ] } // BCFTOOLS ANNOTATE - if (params.tools && params.tools.split(',').contains('bcfann')) { - withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_BCFTOOLS:BCFTOOLS_ANNOTATE' { - ext.args = { '--output-type z --write-index=tbi' } - ext.prefix = { input.baseName - '.vcf' + '_BCF.ann' } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, - pattern: "*{gz,gz.tbi}" - ] - } + withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_BCFTOOLS:BCFTOOLS_ANNOTATE' { + ext.args = { '--output-type z --write-index=tbi' } + ext.prefix = { input.baseName - '.vcf' + '_BCF.ann' } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, + pattern: "*{gz,gz.tbi}" + ] } // SNPEFF THEN VEP - if (params.tools && params.tools.split(',').contains('merge')) { - withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_MERGE:ENSEMBLVEP_VEP' { - ext.args = { [ - "--stats_file ${vcf.baseName - '.ann.vcf' + '_VEP.ann'}.summary.html", - (params.vep_dbnsfp && params.dbnsfp && !params.dbnsfp_consequence) ? "--plugin dbNSFP,${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', - (params.vep_dbnsfp && params.dbnsfp && params.dbnsfp_consequence) ? "--plugin dbNSFP,'consequence=${params.dbnsfp_consequence}',${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', - (params.vep_loftee) ? "--plugin LoF,loftee_path:/usr/local/share/ensembl-vep-${params.vep_version}" : '', - (params.vep_spliceai && params.spliceai_snv && params.spliceai_indel) ? "--plugin SpliceAI,snv=${params.spliceai_snv.split("/")[-1]},indel=${params.spliceai_indel.split("/")[-1]}" : '', - (params.vep_spliceregion) ? '--plugin SpliceRegion' : '', - (params.vep_out_format) ? "--${params.vep_out_format}" : '--vcf', - (params.vep_custom_args) ?: '' - ].join(' ').trim() } - // If merge: Output file will have format *_snpEff_VEP.ann.vcf, *_snpEff_VEP.ann.json or *_snpEff_VEP.ann.tab - ext.prefix = { vcf.baseName - '.ann.vcf' + '_VEP.ann' } - } + withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_MERGE:ENSEMBLVEP_VEP' { + ext.args = { [ + "--stats_file ${vcf.baseName - '.ann.vcf' + '_VEP.ann'}.summary.html", + (params.vep_dbnsfp && params.dbnsfp && !params.dbnsfp_consequence) ? "--plugin dbNSFP,${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', + (params.vep_dbnsfp && params.dbnsfp && params.dbnsfp_consequence) ? "--plugin dbNSFP,'consequence=${params.dbnsfp_consequence}',${params.dbnsfp.split("/")[-1]},${params.dbnsfp_fields}" : '', + (params.vep_loftee) ? "--plugin LoF,loftee_path:/usr/local/share/ensembl-vep-${params.vep_version}" : '', + (params.vep_spliceai && params.spliceai_snv && params.spliceai_indel) ? "--plugin SpliceAI,snv=${params.spliceai_snv.split("/")[-1]},indel=${params.spliceai_indel.split("/")[-1]}" : '', + (params.vep_spliceregion) ? '--plugin SpliceRegion' : '', + (params.vep_out_format) ? "--${params.vep_out_format}" : '--vcf', + (params.vep_custom_args) ?: '' + ].join(' ').trim() } + // If merge: Output file will have format *_snpEff_VEP.ann.vcf, *_snpEff_VEP.ann.json or *_snpEff_VEP.ann.tab + ext.prefix = { vcf.baseName - '.ann.vcf' + '_VEP.ann' } } // ALL ANNOTATION TOOLS - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge') || params.tools.split(',').contains('bcfann'))) { - withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:.*:(TABIX_BGZIPTABIX|TABIX_TABIX)' { - ext.prefix = { input.name - '.vcf' } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, - pattern: "*{gz.tbi}" - ] - } - } - - if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) { - withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_SNPEFF:TABIX_BGZIPTABIX' { - publishDir = [ + withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:.*:(TABIX_BGZIPTABIX|TABIX_TABIX)' { + ext.prefix = { input.name - '.vcf' } + publishDir = [ mode: params.publish_dir_mode, path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, - pattern: "*{gz,gz.tbi}", - saveAs: { params.tools.split(',').contains('snpeff') ? it : null } - ] - } + pattern: "*{gz.tbi}" + ] + } + + withName: 'NFCORE_SAREK:SAREK:VCF_ANNOTATE_ALL:VCF_ANNOTATE_SNPEFF:TABIX_BGZIPTABIX' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/annotation/${meta.variantcaller}/${meta.id}/" }, + pattern: "*{gz,gz.tbi}", + saveAs: { params.tools.split(',').contains('snpeff') ? it : null } + ] } } diff --git a/conf/modules/freebayes.config b/conf/modules/freebayes.config index 2c224aeffd..65060fdaf8 100644 --- a/conf/modules/freebayes.config +++ b/conf/modules/freebayes.config @@ -53,16 +53,14 @@ process { } // PAIR_VARIANT_CALLING - if (params.tools && params.tools.split(',').contains('freebayes')) { - withName: '.*:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_FREEBAYES:FREEBAYES' { - ext.args = { "--pooled-continuous \ - --pooled-discrete \ - --genotype-qualities \ - --report-genotype-likelihood-max \ - --allele-balance-priors-off \ - --min-alternate-fraction 0.03 \ - --min-repeat-entropy 1 \ - --min-alternate-count 2 " } - } + withName: '.*:BAM_VARIANT_CALLING_SOMATIC_ALL:BAM_VARIANT_CALLING_FREEBAYES:FREEBAYES' { + ext.args = { "--pooled-continuous \ + --pooled-discrete \ + --genotype-qualities \ + --report-genotype-likelihood-max \ + --allele-balance-priors-off \ + --min-alternate-fraction 0.03 \ + --min-repeat-entropy 1 \ + --min-alternate-count 2 " } } } diff --git a/conf/modules/haplotypecaller.config b/conf/modules/haplotypecaller.config index 747c86633c..3622e38417 100644 --- a/conf/modules/haplotypecaller.config +++ b/conf/modules/haplotypecaller.config @@ -56,15 +56,13 @@ process { ] } - if (params.tools && params.tools.split(',').contains('haplotypecaller')) { - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_HAPLOTYPECALLER:BAM_MERGE_INDEX_SAMTOOLS:(MERGE_BAM|INDEX_MERGE_BAM)' { - ext.prefix = { "${meta.id}.realigned" } - publishDir = [ - enabled: true, - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/haplotypecaller/${meta.id}/" }, - pattern: "*{bam,bai}" - ] - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_HAPLOTYPECALLER:BAM_MERGE_INDEX_SAMTOOLS:(MERGE_BAM|INDEX_MERGE_BAM)' { + ext.prefix = { "${meta.id}.realigned" } + publishDir = [ + enabled: true, + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/haplotypecaller/${meta.id}/" }, + pattern: "*{bam,bai}" + ] } } diff --git a/conf/modules/indexcov.config b/conf/modules/indexcov.config index 082ea3b7cc..9bae35cdef 100644 --- a/conf/modules/indexcov.config +++ b/conf/modules/indexcov.config @@ -2,19 +2,16 @@ // INDEXCOV process { - if (params.tools && params.tools.split(',').contains('indexcov')) { - withName: 'SAMTOOLS_REINDEX_BAM' { - ext.args = { ' -F 3844 -q 30 ' } // high mapq , primary read paired properly mapped - } - - withName: 'GOLEFT_INDEXCOV' { - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/indexcov/" } - ] + withName: 'SAMTOOLS_REINDEX_BAM' { + ext.args = { ' -F 3844 -q 30 ' } // high mapq , primary read paired properly mapped + } - } + withName: 'GOLEFT_INDEXCOV' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/indexcov/" } + ] } diff --git a/conf/modules/joint_germline.config b/conf/modules/joint_germline.config index b3f5bffc8b..8136a84f2f 100644 --- a/conf/modules/joint_germline.config +++ b/conf/modules/joint_germline.config @@ -32,13 +32,11 @@ process { ] } - if (params.tools && params.tools.contains('haplotypecaller') && params.joint_germline) { - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_JOINT_CALLING_GERMLINE_GATK:BCFTOOLS_SORT' { - ext.prefix = { vcf.baseName - ".vcf" + ".sort" } - publishDir = [ - enabled: false - ] - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_JOINT_CALLING_GERMLINE_GATK:BCFTOOLS_SORT' { + ext.prefix = { vcf.baseName - ".vcf" + ".sort" } + publishDir = [ + enabled: false + ] } withName: 'MERGE_GENOTYPEGVCFS' { diff --git a/conf/modules/lofreq.config b/conf/modules/lofreq.config index 253b252b3b..f826216c67 100644 --- a/conf/modules/lofreq.config +++ b/conf/modules/lofreq.config @@ -14,32 +14,30 @@ //LOFREQ process { - if (params.tools && params.tools.split(',').contains('lofreq')) { - withName: "LOFREQ_CALLPARALLEL" { - ext.args = { "--call-indels" } - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.lofreq" : "${meta.id}.lofreq.${intervals.baseName}" } - ext.when = { params.tools && params.tools.split(',').contains('lofreq') } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/" }, - pattern: "*{vcf.gz,vcf.gz.tbi}", - saveAs: { meta.num_intervals > 1 ? null : "lofreq/${meta.id}/${it}" } - ] - } + withName: "LOFREQ_CALLPARALLEL" { + ext.args = { "--call-indels" } + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.lofreq" : "${meta.id}.lofreq.${intervals.baseName}" } + ext.when = { params.tools && params.tools.split(',').contains('lofreq') } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/" }, + pattern: "*{vcf.gz,vcf.gz.tbi}", + saveAs: { meta.num_intervals > 1 ? null : "lofreq/${meta.id}/${it}" } + ] + } - withName:'VCFTOOLS_TSTV_COUNT'{ - errorStrategy = 'ignore' - } + withName:'VCFTOOLS_TSTV_COUNT'{ + errorStrategy = 'ignore' + } - withName: 'MERGE_LOFREQ.*' { - ext.prefix = { "${meta.id}.lofreq" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/lofreq/${meta.id}" }, - pattern: "*{vcf.gz,vcf.gz.tbi}" - ] - } + withName: 'MERGE_LOFREQ.*' { + ext.prefix = { "${meta.id}.lofreq" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/lofreq/${meta.id}" }, + pattern: "*{vcf.gz,vcf.gz.tbi}" + ] } } diff --git a/conf/modules/manta.config b/conf/modules/manta.config index 71a1c43299..7bcc344248 100644 --- a/conf/modules/manta.config +++ b/conf/modules/manta.config @@ -14,15 +14,14 @@ // MANTA process { - if (params.tools && params.tools.split(',').contains('manta')) { - withName: 'MANTA_GERMLINE|MANTA_TUMORONLY|MANTA_SOMATIC' { - ext.args = { params.wes ? "--exome" : '' } - ext.prefix = { "${meta.id}.manta" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/manta/${meta.id}" }, - pattern: "*{diploid_sv,tumor_sv,somatic_sv}.{vcf.gz,vcf.gz.tbi}" - ] - } + + withName: 'MANTA_GERMLINE|MANTA_TUMORONLY|MANTA_SOMATIC' { + ext.args = { params.wes ? "--exome" : '' } + ext.prefix = { "${meta.id}.manta" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/manta/${meta.id}" }, + pattern: "*{diploid_sv,tumor_sv,somatic_sv}.{vcf.gz,vcf.gz.tbi}" + ] } } diff --git a/conf/modules/markduplicates.config b/conf/modules/markduplicates.config index ce050eccbb..a4070886ef 100644 --- a/conf/modules/markduplicates.config +++ b/conf/modules/markduplicates.config @@ -117,6 +117,7 @@ process { withName: 'NFCORE_SAREK:SAREK:FASTQ_ALIGN_GATK:CRAM_TO_BAM' { ext.when = { params.save_output_as_bam } + // TODO how to handle this properly? if (params.tools && params.tools.split(',').contains('sentieon_dedup')) { ext.prefix = { "${meta.id}.dedup" } publishDir = [ diff --git a/conf/modules/modules.config b/conf/modules/modules.config index 23e35675d0..496e4eae61 100644 --- a/conf/modules/modules.config +++ b/conf/modules/modules.config @@ -76,20 +76,18 @@ process { ] } - if (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator'))) { - withName: 'NFCORE_SAREK:SAREK:CRAM_SAMPLEQC:CRAM_QC_RECAL:MOSDEPTH' { - ext.prefix = { "${meta.id}.recal" } - } + withName: 'NFCORE_SAREK:SAREK:CRAM_SAMPLEQC:CRAM_QC_RECAL:MOSDEPTH' { + ext.prefix = { "${meta.id}.recal" } + } - withName: 'NFCORE_SAREK:SAREK:CRAM_SAMPLEQC:CRAM_QC_RECAL:SAMTOOLS_STATS' { - ext.prefix = { "${meta.id}.recal.cram" } - ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/reports/samtools/${meta.id}" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'NFCORE_SAREK:SAREK:CRAM_SAMPLEQC:CRAM_QC_RECAL:SAMTOOLS_STATS' { + ext.prefix = { "${meta.id}.recal.cram" } + ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/reports/samtools/${meta.id}" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] } // VCF diff --git a/conf/modules/mpileup.config b/conf/modules/mpileup.config index dbdfa27fec..9515dcd8d2 100644 --- a/conf/modules/mpileup.config +++ b/conf/modules/mpileup.config @@ -52,37 +52,35 @@ process { } // PAIR_VARIANT_CALLING - if (params.tools && params.tools.split(',').contains('controlfreec')) { - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_MPILEUP:SAMTOOLS_MPILEUP' { - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.normal" : "${meta.id}_${intervals.simpleName}.normal" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_MPILEUP:SAMTOOLS_MPILEUP' { + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.normal" : "${meta.id}_${intervals.simpleName}.normal" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_MPILEUP:CAT_MPILEUP' { - ext.prefix = { "${meta.id}.normal.mpileup.gz" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_MPILEUP:CAT_MPILEUP' { + ext.prefix = { "${meta.id}.normal.mpileup.gz" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_NORMAL:SAMTOOLS_MPILEUP' { - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.normal" : "${meta.id}_${intervals.simpleName}.normal" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_NORMAL:SAMTOOLS_MPILEUP' { + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.normal" : "${meta.id}_${intervals.simpleName}.normal" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_NORMAL:CAT_MPILEUP' { - ext.prefix = { "${meta.id}.normal.mpileup.gz" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_NORMAL:CAT_MPILEUP' { + ext.prefix = { "${meta.id}.normal.mpileup.gz" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_TUMOR:SAMTOOLS_MPILEUP' { - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.tumor" : "${meta.id}_${intervals.simpleName}.tumor" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_TUMOR:SAMTOOLS_MPILEUP' { + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.tumor" : "${meta.id}_${intervals.simpleName}.tumor" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_TUMOR:CAT_MPILEUP' { - ext.prefix = { "${meta.id}.tumor.mpileup.gz" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_SOMATIC_ALL:MPILEUP_TUMOR:CAT_MPILEUP' { + ext.prefix = { "${meta.id}.tumor.mpileup.gz" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_TUMOR_ONLY_ALL:BAM_VARIANT_CALLING_MPILEUP:SAMTOOLS_MPILEUP' { - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.tumor" : "${meta.id}_${intervals.simpleName}.tumor" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_TUMOR_ONLY_ALL:BAM_VARIANT_CALLING_MPILEUP:SAMTOOLS_MPILEUP' { + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.tumor" : "${meta.id}_${intervals.simpleName}.tumor" } + } - withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_TUMOR_ONLY_ALL:BAM_VARIANT_CALLING_MPILEUP:CAT_MPILEUP' { - ext.prefix = { "${meta.id}.tumor.mpileup.gz" } - } + withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_TUMOR_ONLY_ALL:BAM_VARIANT_CALLING_MPILEUP:CAT_MPILEUP' { + ext.prefix = { "${meta.id}.tumor.mpileup.gz" } } } diff --git a/conf/modules/mutect2.config b/conf/modules/mutect2.config index 5892437ddc..5cacfceb9c 100644 --- a/conf/modules/mutect2.config +++ b/conf/modules/mutect2.config @@ -14,100 +14,99 @@ // MUTECT2 process { - if (params.tools && params.tools.split(',').contains('mutect2')) { - withName: 'GATK4_MUTECT2' { - ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" : "--f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" } - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.mutect2" : "${meta.id}.mutect2.${intervals.baseName}" } - ext.when = { params.tools && params.tools.split(',').contains('mutect2') } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/" }, - pattern: "*{vcf.gz,vcf.gz.tbi,stats}", - saveAs: { meta.num_intervals > 1 ? null : "mutect2/${meta.id}/${it}" } - ] - } + withName: 'GATK4_MUTECT2' { + ext.args = { params.ignore_soft_clipped_bases ? "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" : "--f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz" } + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.mutect2" : "${meta.id}.mutect2.${intervals.baseName}" } + ext.when = { params.tools && params.tools.split(',').contains('mutect2') } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/" }, + pattern: "*{vcf.gz,vcf.gz.tbi,stats}", + saveAs: { meta.num_intervals > 1 ? null : "mutect2/${meta.id}/${it}" } + ] + } - // PAIR_VARIANT_CALLING - withName: 'MUTECT2_PAIRED' { - ext.args = { params.ignore_soft_clipped_bases ? - "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" : - "--f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" } - } + // PAIR_VARIANT_CALLING + withName: 'MUTECT2_PAIRED' { + ext.args = { params.ignore_soft_clipped_bases ? + "--dont-use-soft-clipped-bases true --f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" : + "--f1r2-tar-gz ${task.ext.prefix}.f1r2.tar.gz --normal-sample ${meta.patient}_${meta.normal_id}" } + } - withName: 'MERGE_MUTECT2.*' { - ext.prefix = { "${meta.id}.mutect2" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, - pattern: "*{vcf.gz,vcf.gz.tbi}" - ] - } + withName: 'MERGE_MUTECT2.*' { + ext.prefix = { "${meta.id}.mutect2" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, + pattern: "*{vcf.gz,vcf.gz.tbi}" + ] + } - withName: 'FILTERMUTECTCALLS.*' { - ext.prefix = {"${meta.id}.mutect2.filtered"} - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'FILTERMUTECTCALLS.*' { + ext.prefix = {"${meta.id}.mutect2.filtered"} + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: 'CALCULATECONTAMINATION' { - ext.args = { "-tumor-segmentation ${meta.id}.mutect2.segmentation.table" } - ext.prefix = { "${meta.id}.mutect2" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'CALCULATECONTAMINATION' { + ext.args = { "-tumor-segmentation ${meta.id}.mutect2.segmentation.table" } + ext.prefix = { "${meta.id}.mutect2" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: 'LEARNREADORIENTATIONMODEL' { - ext.prefix = { "${meta.id}.mutect2.artifactprior" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'LEARNREADORIENTATIONMODEL' { + ext.prefix = { "${meta.id}.mutect2.artifactprior" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: 'MERGEMUTECTSTATS' { - ext.prefix = { "${meta.id}.mutect2" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'MERGEMUTECTSTATS' { + ext.prefix = { "${meta.id}.mutect2" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: 'GATHERPILEUPSUMMARIES.*' { - ext.prefix = { "${meta.id}.mutect2" } - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } + withName: 'GATHERPILEUPSUMMARIES.*' { + ext.prefix = { "${meta.id}.mutect2" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/mutect2/${meta.id}/" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } - withName: 'GETPILEUPSUMMARIES.*' { - ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.mutect2" : "${meta.id}.mutect2.${intervals.baseName}" } + withName: 'GETPILEUPSUMMARIES.*' { + ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.mutect2" : "${meta.id}.mutect2.${intervals.baseName}" } + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/variant_calling/" }, + pattern: "*.table", + saveAs: { meta.num_intervals > 1 ? null : "mutect2/${meta.id}/${it}" } + ] + } + + // TODO can the output path be handled with a closure + if (params.joint_mutect2) { + withName: 'CALCULATECONTAMINATION' { publishDir = [ mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/" }, - pattern: "*.table", - saveAs: { meta.num_intervals > 1 ? null : "mutect2/${meta.id}/${it}" } + path: { "${params.outdir}/variant_calling/mutect2/${meta.patient}" }, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } - - if (params.joint_mutect2) { - withName: 'CALCULATECONTAMINATION' { - publishDir = [ - mode: params.publish_dir_mode, - path: { "${params.outdir}/variant_calling/mutect2/${meta.patient}" }, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } } } diff --git a/conf/modules/prepare_recalibration.config b/conf/modules/prepare_recalibration.config index a0f7bfbdb2..832357f2b3 100644 --- a/conf/modules/prepare_recalibration.config +++ b/conf/modules/prepare_recalibration.config @@ -16,6 +16,7 @@ process { withName: 'GATK4_BASERECALIBRATOR|GATK4SPARK_BASERECALIBRATOR' { + // TODO how if (params.use_gatk_spark) { containerOptions = '' } diff --git a/conf/modules/recalibrate.config b/conf/modules/recalibrate.config index 3a4bb52ad5..3848a191ad 100644 --- a/conf/modules/recalibrate.config +++ b/conf/modules/recalibrate.config @@ -16,6 +16,7 @@ process { withName: 'GATK4_APPLYBQSR|GATK4SPARK_APPLYBQSR' { + // TODO how if (params.use_gatk_spark) { containerOptions = '' } diff --git a/conf/test.config b/conf/test.config index 1101d6246c..77914eee84 100644 --- a/conf/test.config +++ b/conf/test.config @@ -81,6 +81,7 @@ process { } } +//TODO this needs to be removed/moved // Enable container engines/virtualisation envs for CI testing // only works when specified with the profile ENV diff --git a/main.nf b/main.nf index effa97ef16..3d98a0d601 100755 --- a/main.nf +++ b/main.nf @@ -19,7 +19,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -nextflow.enable.dsl = 2 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GENOME PARAMETER VALUES @@ -60,8 +59,6 @@ params.vep_cache_version = getGenomeAttribute('vep_cache_version') params.vep_genome = getGenomeAttribute('vep_genome') params.vep_species = getGenomeAttribute('vep_species') -aligner = params.aligner - /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ IMPORT FUNCTIONS / MODULES / SUBWORKFLOWS / WORKFLOWS @@ -77,47 +74,6 @@ include { PREPARE_GENOME } from './subworkflows/local/prepare_ include { PREPARE_INTERVALS } from './subworkflows/local/prepare_intervals' include { PREPARE_REFERENCE_CNVKIT } from './subworkflows/local/prepare_reference_cnvkit' -// Initialize fasta file with meta map: -fasta = params.fasta ? Channel.fromPath(params.fasta).map{ it -> [ [id:it.baseName], it ] }.collect() : Channel.empty() - -// Initialize file channels based on params, defined in the params.genomes[params.genome] scope -bcftools_annotations = params.bcftools_annotations ? Channel.fromPath(params.bcftools_annotations).collect() : Channel.empty() -bcftools_header_lines = params.bcftools_header_lines ? Channel.fromPath(params.bcftools_header_lines).collect() : Channel.empty() -cf_chrom_len = params.cf_chrom_len ? Channel.fromPath(params.cf_chrom_len).collect() : [] -dbsnp = params.dbsnp ? Channel.fromPath(params.dbsnp).collect() : Channel.value([]) -fasta_fai = params.fasta_fai ? Channel.fromPath(params.fasta_fai).collect() : Channel.empty() -germline_resource = params.germline_resource ? Channel.fromPath(params.germline_resource).collect() : Channel.value([]) // Mutect2 does not require a germline resource, so set to optional input -known_indels = params.known_indels ? Channel.fromPath(params.known_indels).collect() : Channel.value([]) -known_snps = params.known_snps ? Channel.fromPath(params.known_snps).collect() : Channel.value([]) -mappability = params.mappability ? Channel.fromPath(params.mappability).collect() : Channel.value([]) -pon = params.pon ? Channel.fromPath(params.pon).collect() : Channel.value([]) // PON is optional for Mutect2 (but highly recommended) -sentieon_dnascope_model = params.sentieon_dnascope_model ? Channel.fromPath(params.sentieon_dnascope_model).collect() : Channel.value([]) - -// Initialize value channels based on params, defined in the params.genomes[params.genome] scope -ascat_genome = params.ascat_genome ?: Channel.empty() -dbsnp_vqsr = params.dbsnp_vqsr ? Channel.value(params.dbsnp_vqsr) : Channel.empty() -known_indels_vqsr = params.known_indels_vqsr ? Channel.value(params.known_indels_vqsr) : Channel.empty() -known_snps_vqsr = params.known_snps_vqsr ? Channel.value(params.known_snps_vqsr) : Channel.empty() -ngscheckmate_bed = params.ngscheckmate_bed ? Channel.value(params.ngscheckmate_bed) : Channel.empty() -snpeff_db = params.snpeff_db ?: Channel.empty() -vep_cache_version = params.vep_cache_version ?: Channel.empty() -vep_genome = params.vep_genome ?: Channel.empty() -vep_species = params.vep_species ?: Channel.empty() - -vep_extra_files = [] - -if (params.dbnsfp && params.dbnsfp_tbi) { - vep_extra_files.add(file(params.dbnsfp, checkIfExists: true)) - vep_extra_files.add(file(params.dbnsfp_tbi, checkIfExists: true)) -} - -if (params.spliceai_snv && params.spliceai_snv_tbi && params.spliceai_indel && params.spliceai_indel_tbi) { - vep_extra_files.add(file(params.spliceai_indel, checkIfExists: true)) - vep_extra_files.add(file(params.spliceai_indel_tbi, checkIfExists: true)) - vep_extra_files.add(file(params.spliceai_snv, checkIfExists: true)) - vep_extra_files.add(file(params.spliceai_snv_tbi, checkIfExists: true)) -} - /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NAMED WORKFLOW FOR PIPELINE @@ -132,6 +88,47 @@ workflow NFCORE_SAREK { main: versions = Channel.empty() + // Initialize fasta file with meta map: + fasta = params.fasta ? Channel.fromPath(params.fasta).map{ it -> [ [id:it.baseName], it ] }.collect() : Channel.empty() + + // Initialize file channels based on params, defined in the params.genomes[params.genome] scope + bcftools_annotations = params.bcftools_annotations ? Channel.fromPath(params.bcftools_annotations).collect() : Channel.empty() + bcftools_header_lines = params.bcftools_header_lines ? Channel.fromPath(params.bcftools_header_lines).collect() : Channel.empty() + cf_chrom_len = params.cf_chrom_len ? Channel.fromPath(params.cf_chrom_len).collect() : [] + dbsnp = params.dbsnp ? Channel.fromPath(params.dbsnp).collect() : Channel.value([]) + fasta_fai = params.fasta_fai ? Channel.fromPath(params.fasta_fai).collect() : Channel.empty() + germline_resource = params.germline_resource ? Channel.fromPath(params.germline_resource).collect() : Channel.value([]) // Mutect2 does not require a germline resource, so set to optional input + known_indels = params.known_indels ? Channel.fromPath(params.known_indels).collect() : Channel.value([]) + known_snps = params.known_snps ? Channel.fromPath(params.known_snps).collect() : Channel.value([]) + mappability = params.mappability ? Channel.fromPath(params.mappability).collect() : Channel.value([]) + pon = params.pon ? Channel.fromPath(params.pon).collect() : Channel.value([]) // PON is optional for Mutect2 (but highly recommended) + sentieon_dnascope_model = params.sentieon_dnascope_model ? Channel.fromPath(params.sentieon_dnascope_model).collect() : Channel.value([]) + + // Initialize value channels based on params, defined in the params.genomes[params.genome] scope + ascat_genome = params.ascat_genome ?: Channel.empty() //TODO why is this not used + dbsnp_vqsr = params.dbsnp_vqsr ? Channel.value(params.dbsnp_vqsr) : Channel.empty() + known_indels_vqsr = params.known_indels_vqsr ? Channel.value(params.known_indels_vqsr) : Channel.empty() + known_snps_vqsr = params.known_snps_vqsr ? Channel.value(params.known_snps_vqsr) : Channel.empty() + ngscheckmate_bed = params.ngscheckmate_bed ? Channel.value(params.ngscheckmate_bed) : Channel.empty() + snpeff_db = params.snpeff_db ?: Channel.empty() //TODO why is this not used + vep_cache_version = params.vep_cache_version ?: Channel.empty() + vep_genome = params.vep_genome ?: Channel.empty() + vep_species = params.vep_species ?: Channel.empty() + + vep_extra_files = [] + + if (params.dbnsfp && params.dbnsfp_tbi) { + vep_extra_files.add(file(params.dbnsfp, checkIfExists: true)) + vep_extra_files.add(file(params.dbnsfp_tbi, checkIfExists: true)) + } + + if (params.spliceai_snv && params.spliceai_snv_tbi && params.spliceai_indel && params.spliceai_indel_tbi) { + vep_extra_files.add(file(params.spliceai_indel, checkIfExists: true)) + vep_extra_files.add(file(params.spliceai_indel_tbi, checkIfExists: true)) + vep_extra_files.add(file(params.spliceai_snv, checkIfExists: true)) + vep_extra_files.add(file(params.spliceai_snv_tbi, checkIfExists: true)) + } + // build indexes if needed PREPARE_GENOME( params.ascat_alleles, @@ -161,8 +158,8 @@ workflow NFCORE_SAREK { : PREPARE_GENOME.out.hashtable // Gather index for mapping given the chosen aligner - index_alignment = (aligner == "bwa-mem" || aligner == "sentieon-bwamem") ? bwa : - aligner == "bwa-mem2" ? bwamem2 : + index_alignment = ( params.aligner == "bwa-mem" || params.aligner == "sentieon-bwamem") ? bwa : + params.aligner == "bwa-mem2" ? bwamem2 : dragmap // TODO: add a params for msisensorpro_scan @@ -228,7 +225,7 @@ workflow NFCORE_SAREK { versions = versions.mix(PREPARE_GENOME.out.versions) versions = versions.mix(PREPARE_INTERVALS.out.versions) - vep_fasta = (params.vep_include_fasta) ? fasta.map{ fasta -> [ [ id:fasta.baseName ], fasta ] } : [[id: 'null'], []] + vep_fasta = (params.vep_include_fasta) ? fasta.map{ fa -> [ [ id:fa.baseName ], fa ] } : [[id: 'null'], []] // Download cache if (params.download_cache) { diff --git a/modules.json b/modules.json index e81103e13f..119c7ecd43 100644 --- a/modules.json +++ b/modules.json @@ -104,7 +104,7 @@ }, "controlfreec/freec": { "branch": "master", - "git_sha": "666652151335353eef2fcd58880bcef5bc2928e1", + "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", "installed_by": ["modules"] }, "controlfreec/freec2bed": { @@ -452,7 +452,7 @@ }, "sentieon/haplotyper": { "branch": "master", - "git_sha": "eb7b70119bfb1877334c996d13e520c61b21067d", + "git_sha": "6b36f8e5427ec38911565398de57656ca3a2606a", "installed_by": ["modules"] }, "sentieon/varcal": { @@ -531,12 +531,12 @@ }, "utils_nextflow_pipeline": { "branch": "master", - "git_sha": "3aa0aec1d52d492fe241919f0c6100ebf0074082", + "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", "installed_by": ["subworkflows"] }, "utils_nfcore_pipeline": { "branch": "master", - "git_sha": "1b6b9a3338d011367137808b49b923515080e3ba", + "git_sha": "05954dab2ff481bcb999f24455da29a5828af08d", "installed_by": ["subworkflows"] }, "utils_nfschema_plugin": { diff --git a/modules/nf-core/controlfreec/freec/environment.yml b/modules/nf-core/controlfreec/freec/environment.yml index f6b64529bc..3aebc4bde1 100644 --- a/modules/nf-core/controlfreec/freec/environment.yml +++ b/modules/nf-core/controlfreec/freec/environment.yml @@ -1,3 +1,5 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda diff --git a/modules/nf-core/controlfreec/freec/tests/tags.yml b/modules/nf-core/controlfreec/freec/tests/tags.yml deleted file mode 100644 index 585f06a523..0000000000 --- a/modules/nf-core/controlfreec/freec/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -controlfreec/freec: - - "modules/nf-core/controlfreec/freec/**" diff --git a/modules/nf-core/sentieon/haplotyper/environment.yml b/modules/nf-core/sentieon/haplotyper/environment.yml index d7abf668ea..ec48106f35 100644 --- a/modules/nf-core/sentieon/haplotyper/environment.yml +++ b/modules/nf-core/sentieon/haplotyper/environment.yml @@ -1,5 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda dependencies: - - bioconda::sentieon=202308.03 + - bioconda::sentieon=202503 diff --git a/modules/nf-core/sentieon/haplotyper/main.nf b/modules/nf-core/sentieon/haplotyper/main.nf index a04b342caf..18d65f5aa3 100644 --- a/modules/nf-core/sentieon/haplotyper/main.nf +++ b/modules/nf-core/sentieon/haplotyper/main.nf @@ -5,15 +5,15 @@ process SENTIEON_HAPLOTYPER { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/a6/a64461f38d76bebea8e21441079e76e663e1168b0c59dafee6ee58440ad8c8ac/data' : - 'community.wave.seqera.io/library/sentieon:202308.03--59589f002351c221' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/80/80ccb05eb4f1a193a3bd99c4da90f55f74ea6556c25f154e53e1ff5a6caa372d/data' : + 'community.wave.seqera.io/library/sentieon:202503--5e378058d837c58c' }" input: tuple val(meta), path(input), path(input_index), path(intervals), path(recal_table) - tuple val(meta1), path(fasta) - tuple val(meta2), path(fai) - tuple val(meta3), path(dbsnp) - tuple val(meta4), path(dbsnp_tbi) + tuple val(meta2), path(fasta) + tuple val(meta3), path(fai) + tuple val(meta4), path(dbsnp) + tuple val(meta5), path(dbsnp_tbi) val(emit_vcf) val(emit_gvcf) @@ -50,7 +50,7 @@ process SENTIEON_HAPLOTYPER { // Create a gVCF command to export a gVCF def gvcf_cmd = emit_gvcf ? - gvcf_cmd = base_cmd + args3 + ' --emit_mode gvcf ' + prefix + '.g.vcf.gz' : + base_cmd + args3 + ' --emit_mode gvcf ' + prefix + '.g.vcf.gz' : "" def sentieonLicense = secrets.SENTIEON_LICENSE_BASE64 ? diff --git a/modules/nf-core/sentieon/haplotyper/meta.yml b/modules/nf-core/sentieon/haplotyper/meta.yml index ee0e6152f0..779d674db2 100644 --- a/modules/nf-core/sentieon/haplotyper/meta.yml +++ b/modules/nf-core/sentieon/haplotyper/meta.yml @@ -32,7 +32,7 @@ input: - recal_table: type: file description: Recalibration table from sentieon/qualcal (optional) - - - meta1: + - - meta2: type: map description: | Groovy Map containing sample information @@ -41,7 +41,7 @@ input: type: file description: Genome fasta file pattern: "*.{fa,fasta}" - - - meta2: + - - meta3: type: map description: | Groovy Map containing sample information @@ -50,7 +50,7 @@ input: type: file description: The index of the FASTA reference. pattern: "*.fai" - - - meta3: + - - meta4: type: map description: | Groovy Map containing sample information @@ -58,7 +58,7 @@ input: - dbsnp: type: file description: VCF file containing known sites (optional) - - - meta4: + - - meta5: type: map description: | Groovy Map containing sample information diff --git a/modules/nf-core/sentieon/haplotyper/tests/main.nf.test.snap b/modules/nf-core/sentieon/haplotyper/tests/main.nf.test.snap index 0527f0fcbe..36cb969a23 100644 --- a/modules/nf-core/sentieon/haplotyper/tests/main.nf.test.snap +++ b/modules/nf-core/sentieon/haplotyper/tests/main.nf.test.snap @@ -2,49 +2,49 @@ "Sentieon Haplotyper VCF": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.unfiltered.vcf.gz.tbi", "cea0045051da7877b38a1e25df812a91" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:29:42.675527558" + "timestamp": "2025-05-09T08:17:36.620865412" }, "Sentieon Haplotyper Recalibration": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.unfiltered.vcf.gz.tbi", "10faa3b669c49826098e09784d8a4716" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:38.708688756" + "timestamp": "2025-05-09T08:20:04.959325404" }, "Sentieon Haplotyper GVCF": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.g.vcf.gz.tbi", "338fc3c37b208d6595948576833eb665" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:29:53.99302993" + "timestamp": "2025-05-09T08:18:03.860778094" }, "Sentieon Haplotyper BOTH": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.g.vcf.gz.tbi", "338fc3c37b208d6595948576833eb665", @@ -52,15 +52,15 @@ "cea0045051da7877b38a1e25df812a91" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:03.323463525" + "timestamp": "2025-05-09T08:18:31.069468545" }, "Sentieon Haplotyper DBSNP BOTH": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.g.vcf.gz.tbi", "228556b7921205f023fec51098feeb97", @@ -68,15 +68,15 @@ "cc1f3d4bd615f3640e7fd103cc39d2f8" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:25.917634004" + "timestamp": "2025-05-09T08:19:26.056658932" }, "Sentieon Haplotyper Intervals BOTH": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.g.vcf.gz.tbi", "338fc3c37b208d6595948576833eb665", @@ -84,10 +84,10 @@ "cea0045051da7877b38a1e25df812a91" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:14.249175276" + "timestamp": "2025-05-09T08:18:58.476833083" }, "Sentieon Haplotyper - stub": { "content": [ @@ -125,7 +125,7 @@ ] ], "4": [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "gvcf": [ [ @@ -160,28 +160,28 @@ ] ], "versions": [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ] } ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:56.435076872" + "timestamp": "2025-05-09T08:21:01.202952019" }, "Sentieon Haplotyper multiple CRAMs": { "content": [ [ - "versions.yml:md5,1a7b41acc44d0724c8dca247e6323877" + "versions.yml:md5,e2c7b9184c956fdaf6f5a75ec1f51342" ], "test.unfiltered.vcf.gz.tbi", "b5d6e09e336438e38f7bf5531799e3a" ], "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-10-02T10:30:49.266709749" + "timestamp": "2025-05-09T08:20:33.294255595" } } \ No newline at end of file diff --git a/modules/nf-core/sentieon/haplotyper/tests/tags.yml b/modules/nf-core/sentieon/haplotyper/tests/tags.yml deleted file mode 100644 index 3178c146c0..0000000000 --- a/modules/nf-core/sentieon/haplotyper/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -sentieon/haplotyper: - - "modules/nf-core/sentieon/haplotyper/**" diff --git a/nextflow.config b/nextflow.config index 11df5add10..f6039a904b 100644 --- a/nextflow.config +++ b/nextflow.config @@ -123,6 +123,7 @@ params { show_hidden = false version = false pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/' + trace_report_suffix = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') // Config options // Config options config_profile_name = null @@ -344,23 +345,23 @@ process.shell = [ // Disable process selector warnings by default. Use debug profile to enable warnings. nextflow.enable.configProcessNamesValidation = false -def trace_timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') timeline { enabled = true - file = "${params.outdir}/pipeline_info/execution_timeline_${trace_timestamp}.html" + file = "${params.outdir}/pipeline_info/execution_timeline_${params.trace_report_suffix}.html" } report { enabled = true - file = "${params.outdir}/pipeline_info/execution_report_${trace_timestamp}.html" + file = "${params.outdir}/pipeline_info/execution_report_${params.trace_report_suffix}.html" } trace { enabled = true - file = "${params.outdir}/pipeline_info/execution_trace_${trace_timestamp}.txt" + file = "${params.outdir}/pipeline_info/execution_trace_${params.trace_report_suffix}.txt" } dag { enabled = true - file = "${params.outdir}/pipeline_info/pipeline_dag_${trace_timestamp}.html" + file = "${params.outdir}/pipeline_info/pipeline_dag_${params.trace_report_suffix}.html" } + prov { enabled = true formats { diff --git a/subworkflows/local/bam_applybqsr/main.nf b/subworkflows/local/bam_applybqsr/main.nf index 48d169fb83..d887f61522 100644 --- a/subworkflows/local/bam_applybqsr/main.nf +++ b/subworkflows/local/bam_applybqsr/main.nf @@ -21,20 +21,20 @@ workflow BAM_APPLYBQSR { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, recal, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, recal, intervals ] } + .map{ meta, cram_, crai, recal, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, recal, intervals_ ] } // RUN APPLYBQSR - GATK4_APPLYBQSR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }) + GATK4_APPLYBQSR(cram_intervals, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }) // Gather the recalibrated cram files - cram_to_merge = GATK4_APPLYBQSR.out.cram.map{ meta, cram -> [ groupKey(meta, meta.num_intervals), cram ] }.groupTuple() + cram_to_merge = GATK4_APPLYBQSR.out.cram.map{ meta, cram_ -> [ groupKey(meta, meta.num_intervals), cram_ ] }.groupTuple() // Merge and index the recalibrated cram files - CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }) + CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }) cram_recal = CRAM_MERGE_INDEX_SAMTOOLS.out.cram_crai // Remove no longer necessary field: num_intervals - .map{ meta, cram, crai -> [ meta - meta.subMap('num_intervals'), cram, crai ] } + .map{ meta, cram_, crai -> [ meta - meta.subMap('num_intervals'), cram_, crai ] } // Gather versions of all tools used versions = versions.mix(GATK4_APPLYBQSR.out.versions) diff --git a/subworkflows/local/bam_applybqsr_spark/main.nf b/subworkflows/local/bam_applybqsr_spark/main.nf index 3b75fa74bc..5b6ae1f96e 100644 --- a/subworkflows/local/bam_applybqsr_spark/main.nf +++ b/subworkflows/local/bam_applybqsr_spark/main.nf @@ -21,20 +21,20 @@ workflow BAM_APPLYBQSR_SPARK { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, recal, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, recal, intervals ] } + .map{ meta, cram_, crai, recal, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, recal, intervals_ ] } // RUN APPLYBQSR SPARK - GATK4SPARK_APPLYBQSR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }) + GATK4SPARK_APPLYBQSR(cram_intervals, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }) // Gather the recalibrated cram files - cram_to_merge = GATK4SPARK_APPLYBQSR.out.cram.map{ meta, cram -> [ groupKey(meta, meta.num_intervals), cram ] }.groupTuple() + cram_to_merge = GATK4SPARK_APPLYBQSR.out.cram.map{ meta, cram_ -> [ groupKey(meta, meta.num_intervals), cram_ ] }.groupTuple() // Merge and index the recalibrated cram files - CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }) + CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }) cram_recal = CRAM_MERGE_INDEX_SAMTOOLS.out.cram_crai // Remove no longer necessary field: num_intervals - .map{ meta, cram, crai -> [ meta - meta.subMap('num_intervals'), cram, crai ] } + .map{ meta, cram_file, crai -> [ meta - meta.subMap('num_intervals'), cram_file, crai ] } // Gather versions of all tools used versions = versions.mix(GATK4SPARK_APPLYBQSR.out.versions) diff --git a/subworkflows/local/bam_baserecalibrator/main.nf b/subworkflows/local/bam_baserecalibrator/main.nf index 285ad6b856..71a7de5f69 100644 --- a/subworkflows/local/bam_baserecalibrator/main.nf +++ b/subworkflows/local/bam_baserecalibrator/main.nf @@ -23,10 +23,10 @@ workflow BAM_BASERECALIBRATOR { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] } + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, intervals_ ] } // RUN BASERECALIBRATOR - GATK4_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi) + GATK4_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }, known_sites, known_sites_tbi) // Figuring out if there is one or more table(s) from the same sample table_to_merge = GATK4_BASERECALIBRATOR.out.table.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple().branch{ diff --git a/subworkflows/local/bam_baserecalibrator_spark/main.nf b/subworkflows/local/bam_baserecalibrator_spark/main.nf index c31b1aa383..3db65c6cbe 100644 --- a/subworkflows/local/bam_baserecalibrator_spark/main.nf +++ b/subworkflows/local/bam_baserecalibrator_spark/main.nf @@ -23,10 +23,10 @@ workflow BAM_BASERECALIBRATOR_SPARK { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] } + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, intervals_ ] } // RUN BASERECALIBRATOR SPARK - GATK4SPARK_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi) + GATK4SPARK_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }, known_sites, known_sites_tbi) // Figuring out if there is one or more table(s) from the same sample table_to_merge = GATK4SPARK_BASERECALIBRATOR.out.table.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple().branch{ diff --git a/subworkflows/local/bam_joint_calling_germline_gatk/main.nf b/subworkflows/local/bam_joint_calling_germline_gatk/main.nf index 46357d6fbe..2611f585fe 100644 --- a/subworkflows/local/bam_joint_calling_germline_gatk/main.nf +++ b/subworkflows/local/bam_joint_calling_germline_gatk/main.nf @@ -71,18 +71,18 @@ workflow BAM_JOINT_CALLING_GERMLINE_GATK { resource_indels_vcf, resource_indels_tbi, indels_resource_label, - fasta.map{ meta, fasta -> [ fasta ] }, - fai.map{ meta, fai -> [ fai ] }, - dict.map{ meta, dict -> [ dict ] }) + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fai.map{ meta, fai_ -> [ fai_ ] }, + dict.map{ meta, dict_ -> [ dict_ ] }) VARIANTRECALIBRATOR_SNP( vqsr_input, resource_snps_vcf, resource_snps_tbi, snps_resource_label, - fasta.map{ meta, fasta -> [ fasta ] }, - fai.map{ meta, fai -> [ fai ] }, - dict.map{ meta, dict -> [ dict ] }) + fasta.map{ meta, fasta_file -> [ fasta_file ] }, + fai.map{ meta, fai_file -> [ fai_file ] }, + dict.map{ meta, dict_file -> [ dict_file ] }) //Prepare SNPs and INDELs for ApplyVQSR // Step 1. : ApplyVQSR to SNPs @@ -97,9 +97,9 @@ workflow BAM_JOINT_CALLING_GERMLINE_GATK { GATK4_APPLYVQSR_SNP( vqsr_input_snp, - fasta.map{ meta, fasta -> [ fasta ] }, - fai.map{ meta, fai -> [ fai ] }, - dict.map{ meta, dict -> [ dict ] }) + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fai.map{ meta, fai_ -> [ fai_ ] }, + dict.map{ meta, dict_ -> [ dict_ ] }) // Join results of ApplyVQSR_SNP and use as input for Indels to avoid duplicate entries in the result // Rework meta for variantscalled.csv and annotation tools @@ -111,9 +111,9 @@ workflow BAM_JOINT_CALLING_GERMLINE_GATK { GATK4_APPLYVQSR_INDEL( vqsr_input_indel, - fasta.map{ meta, fasta -> [ fasta ] }, - fai.map{ meta, fai -> [ fai ] }, - dict.map{ meta, dict -> [ dict ] }) + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fai.map{ meta, fai_ -> [ fai_ ] }, + dict.map{ meta, dict_ -> [ dict_ ] }) // The following is an ugly monster to achieve the following: @@ -134,7 +134,7 @@ workflow BAM_JOINT_CALLING_GERMLINE_GATK { genotype_vcf = merge_vcf_for_join.join(vqsr_vcf_for_join, remainder: true).map{ meta, joint_vcf, recal_vcf -> - vcf_out = recal_vcf ?: joint_vcf + def vcf_out = recal_vcf ?: joint_vcf [[id:"joint_variant_calling", patient:"all_samples", variantcaller:"haplotypecaller"], vcf_out] } @@ -142,7 +142,7 @@ workflow BAM_JOINT_CALLING_GERMLINE_GATK { genotype_index = merge_tbi_for_join.join(vqsr_tbi_for_join, remainder: true).map{ meta, joint_tbi, recal_tbi -> - tbi_out = recal_tbi ?: joint_tbi + def tbi_out = recal_tbi ?: joint_tbi [[id:"joint_variant_calling", patient:"all_samples", variantcaller:"haplotypecaller"], tbi_out] } diff --git a/subworkflows/local/bam_joint_calling_germline_sentieon/main.nf b/subworkflows/local/bam_joint_calling_germline_sentieon/main.nf index 0ac47a1e1e..916df3b149 100644 --- a/subworkflows/local/bam_joint_calling_germline_sentieon/main.nf +++ b/subworkflows/local/bam_joint_calling_germline_sentieon/main.nf @@ -68,16 +68,16 @@ workflow BAM_JOINT_CALLING_GERMLINE_SENTIEON { resource_indels_vcf, resource_indels_tbi, indels_resource_label, - fasta.map{meta, it -> [ it ]}, - fai.map{meta, it -> [ it ]}) + fasta.map{meta, fasta_ -> [ fasta_ ]}, + fai.map{meta, fai_ -> [ fai_ ]}) SENTIEON_VARCAL_SNP( vqsr_input, resource_snps_vcf, resource_snps_tbi, snps_resource_label, - fasta.map{meta, it -> [ it ]}, - fai.map{meta, it -> [ it ]}) + fasta.map{meta, fasta_ -> [ fasta_ ]}, + fai.map{meta, fai_ -> [ fai_ ]}) //Prepare SNPs and INDELs for Sentieon's applyvarcal // Step 1. : applyvarcal to SNPs @@ -117,7 +117,7 @@ workflow BAM_JOINT_CALLING_GERMLINE_SENTIEON { genotype_vcf = merged_vcf.join(vqsr_vcf_for_join, remainder: true).map{ meta, joint_vcf, recal_vcf -> - vcf_out = recal_vcf ?: joint_vcf + def vcf_out = recal_vcf ?: joint_vcf [[id:"joint_variant_calling", patient:"all_samples", variantcaller:"sentieon_haplotyper"], vcf_out] } @@ -125,7 +125,7 @@ workflow BAM_JOINT_CALLING_GERMLINE_SENTIEON { genotype_index = merged_tbi.join(vqsr_tbi_for_join, remainder: true).map{ meta, joint_tbi, recal_tbi -> - tbi_out = recal_tbi ?: joint_tbi + def tbi_out = recal_tbi ?: joint_tbi [[id:"joint_variant_calling", patient:"all_samples", variantcaller:"sentieon_haplotyper"], tbi_out] } diff --git a/subworkflows/local/bam_markduplicates/main.nf b/subworkflows/local/bam_markduplicates/main.nf index 9c6f15e0fc..6c61793c17 100644 --- a/subworkflows/local/bam_markduplicates/main.nf +++ b/subworkflows/local/bam_markduplicates/main.nf @@ -19,7 +19,7 @@ workflow BAM_MARKDUPLICATES { reports = Channel.empty() // RUN MARKUPDUPLICATES - GATK4_MARKDUPLICATES(bam, fasta.map{ meta, fasta -> [ fasta ] }, fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }) + GATK4_MARKDUPLICATES(bam, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }) // Join with the crai file cram = GATK4_MARKDUPLICATES.out.cram.join(GATK4_MARKDUPLICATES.out.crai, failOnDuplicate: true, failOnMismatch: true) diff --git a/subworkflows/local/bam_markduplicates_spark/main.nf b/subworkflows/local/bam_markduplicates_spark/main.nf index 75d57b6743..cffefa2a72 100644 --- a/subworkflows/local/bam_markduplicates_spark/main.nf +++ b/subworkflows/local/bam_markduplicates_spark/main.nf @@ -22,7 +22,7 @@ workflow BAM_MARKDUPLICATES_SPARK { reports = Channel.empty() // RUN MARKUPDUPLICATES SPARK - GATK4SPARK_MARKDUPLICATES(bam, fasta.map{ meta, fasta -> [ fasta ] }, fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, dict.map{ meta, dict -> [ dict ] }) + GATK4SPARK_MARKDUPLICATES(bam, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }) // Index cram INDEX_MARKDUPLICATES(GATK4SPARK_MARKDUPLICATES.out.output) @@ -34,7 +34,7 @@ workflow BAM_MARKDUPLICATES_SPARK { CRAM_QC_MOSDEPTH_SAMTOOLS(cram, fasta, intervals_bed_combined) // When running Marduplicates spark, and saving reports - GATK4_ESTIMATELIBRARYCOMPLEXITY(bam, fasta.map{ meta, fasta -> [ fasta ] }, fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, dict.map{ meta, dict -> [ dict ] }) + GATK4_ESTIMATELIBRARYCOMPLEXITY(bam, fasta.map{ meta, fasta_ -> [ fasta_ ] }, fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, dict.map{ meta, dict_ -> [ dict_ ] }) // Gather all reports generated reports = reports.mix(GATK4_ESTIMATELIBRARYCOMPLEXITY.out.metrics) diff --git a/subworkflows/local/bam_merge_index_samtools/main.nf b/subworkflows/local/bam_merge_index_samtools/main.nf index f615b1c3d2..2b359cb414 100644 --- a/subworkflows/local/bam_merge_index_samtools/main.nf +++ b/subworkflows/local/bam_merge_index_samtools/main.nf @@ -15,11 +15,11 @@ workflow BAM_MERGE_INDEX_SAMTOOLS { versions = Channel.empty() // Figuring out if there is one or more bam(s) from the same sample - bam_to_merge = bam.branch{ meta, bam -> + bam_to_merge = bam.branch{ meta, bam_ -> // bam is a list, so use bam.size() to asses number of intervals - single: bam.size() <= 1 + single: bam_.size() <= 1 return [ meta, bam[0] ] - multiple: bam.size() > 1 + multiple: bam_.size() > 1 } // Only when using intervals diff --git a/subworkflows/local/bam_sentieon_dedup/main.nf b/subworkflows/local/bam_sentieon_dedup/main.nf index 91e531438e..010e8db0be 100644 --- a/subworkflows/local/bam_sentieon_dedup/main.nf +++ b/subworkflows/local/bam_sentieon_dedup/main.nf @@ -16,8 +16,8 @@ workflow BAM_SENTIEON_DEDUP { versions = Channel.empty() reports = Channel.empty() - bam = bam.map{ meta, bam -> [ meta - meta.subMap('data_type'), bam ] } - bai = bai.map{ meta, bai -> [ meta - meta.subMap('data_type'), bai ] } + bam = bam.map{ meta, bam_ -> [ meta - meta.subMap('data_type'), bam_ ] } + bai = bai.map{ meta, bai_ -> [ meta - meta.subMap('data_type'), bai_ ] } bam_bai = bam.join(bai, failOnMismatch:true, failOnDuplicate:true) SENTIEON_DEDUP(bam_bai, fasta, fasta_fai) diff --git a/subworkflows/local/bam_variant_calling_deepvariant/main.nf b/subworkflows/local/bam_variant_calling_deepvariant/main.nf index 567050b505..c6ffe2faa2 100644 --- a/subworkflows/local/bam_variant_calling_deepvariant/main.nf +++ b/subworkflows/local/bam_variant_calling_deepvariant/main.nf @@ -23,7 +23,7 @@ workflow BAM_VARIANT_CALLING_DEEPVARIANT { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ]} + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, intervals_ ]} DEEPVARIANT_RUNDEEPVARIANT(cram_intervals, fasta, fasta_fai, [ [ id:'null' ], [] ], [ [ id:'null' ], [] ]) diff --git a/subworkflows/local/bam_variant_calling_freebayes/main.nf b/subworkflows/local/bam_variant_calling_freebayes/main.nf index e196881349..bca06ea87a 100644 --- a/subworkflows/local/bam_variant_calling_freebayes/main.nf +++ b/subworkflows/local/bam_variant_calling_freebayes/main.nf @@ -23,7 +23,7 @@ workflow BAM_VARIANT_CALLING_FREEBAYES { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map and reorganize channel for FREEBAYES module - .map{ meta, cram1, crai1, cram2, crai2, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram1, crai1, cram2, crai2, intervals ]} + .map{ meta, cram1, crai1, cram2, crai2, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram1, crai1, cram2, crai2, intervals_ ]} FREEBAYES(cram_intervals, fasta, fasta_fai, [[id:'null'], []], [[id:'null'], []], [[id:'null'], []]) diff --git a/subworkflows/local/bam_variant_calling_germline_all/main.nf b/subworkflows/local/bam_variant_calling_germline_all/main.nf index c7666d8fe4..caa74bf092 100644 --- a/subworkflows/local/bam_variant_calling_germline_all/main.nf +++ b/subworkflows/local/bam_variant_calling_germline_all/main.nf @@ -84,7 +84,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { if (tools.split(',').contains('cnvkit')) { BAM_VARIANT_CALLING_CNVKIT( // Remap channel to match module/subworkflow - cram.map{ meta, cram, crai -> [ meta, [], cram ] }, + cram.map{ meta, cram_, crai -> [ meta, [], cram_ ] }, fasta, fasta_fai, intervals_bed_combined.map{ it -> [[id:it[0].baseName], it] }, @@ -112,7 +112,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { // Input channel is remapped to match input of module/subworkflow BAM_VARIANT_CALLING_FREEBAYES( // Remap channel to match module/subworkflow - cram.map{ meta, cram, crai -> [ meta, cram, crai, [], [] ] }, + cram.map{ meta, cram_, crai -> [ meta, cram_, crai, [], [] ] }, dict, fasta, fasta_fai, @@ -164,9 +164,9 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { VCF_VARIANT_FILTERING_GATK( vcf_haplotypecaller.join(tbi_haplotypecaller, failOnDuplicate: true, failOnMismatch: true), - fasta.map{ meta, fasta -> [ fasta ] }, - fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, - dict.map{ meta, dict -> [ dict ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, + dict.map{ meta, dict_ -> [ dict_ ] }, intervals_bed_combined_haplotypec, known_sites_indels.concat(known_sites_snps).flatten().unique().collect(), known_sites_indels_tbi.concat(known_sites_snps_tbi).flatten().unique().collect()) @@ -224,7 +224,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { vcf_sentieon_dnascope = BAM_VARIANT_CALLING_SENTIEON_DNASCOPE.out.vcf vcf_tbi_sentieon_dnascope = BAM_VARIANT_CALLING_SENTIEON_DNASCOPE.out.vcf_tbi gvcf_sentieon_dnascope = BAM_VARIANT_CALLING_SENTIEON_DNASCOPE.out.gvcf - gvcf_tbi_sentieon_dnascope = BAM_VARIANT_CALLING_SENTIEON_DNASCOPE.out.gvcf_tbi + gvcf_tbi_sentieon_dnascope = BAM_VARIANT_CALLING_SENTIEON_DNASCOPE.out.gvcf_tbi // TODO Why is this not used if (joint_germline) { BAM_JOINT_CALLING_GERMLINE_SENTIEON( @@ -282,7 +282,7 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { vcf_sentieon_haplotyper = BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER.out.vcf vcf_tbi_sentieon_haplotyper = BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER.out.vcf_tbi gvcf_sentieon_haplotyper = BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER.out.gvcf - gvcf_tbi_sentieon_haplotyper = BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER.out.gvcf_tbi + gvcf_tbi_sentieon_haplotyper = BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER.out.gvcf_tbi // TODO Why is this not used if (joint_germline) { BAM_JOINT_CALLING_GERMLINE_SENTIEON( @@ -310,9 +310,9 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { SENTIEON_HAPLOTYPER_VCF_VARIANT_FILTERING_GATK( vcf_sentieon_haplotyper.join(vcf_tbi_sentieon_haplotyper, failOnDuplicate: true, failOnMismatch: true), - fasta.map{ meta, it -> [ it ] }, - fasta_fai.map{ meta, it -> [ it ] }, - dict.map{ meta, dict -> [ dict ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fasta_fai.map{ meta, fai_ -> [ fai_ ] }, + dict.map{ meta, dict_ -> [ dict_ ] }, intervals_bed_combined_haplotypec, known_sites_indels.concat(known_sites_snps).flatten().unique().collect(), known_sites_indels_tbi.concat(known_sites_snps_tbi).flatten().unique().collect()) @@ -331,8 +331,8 @@ workflow BAM_VARIANT_CALLING_GERMLINE_ALL { BAM_VARIANT_CALLING_SINGLE_STRELKA( cram, dict, - fasta.map{ meta, fasta -> [ fasta ] }, - fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, intervals_bed_gz_tbi ) diff --git a/subworkflows/local/bam_variant_calling_germline_manta/main.nf b/subworkflows/local/bam_variant_calling_germline_manta/main.nf index d27a999a68..91f8fe5036 100644 --- a/subworkflows/local/bam_variant_calling_germline_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_germline_manta/main.nf @@ -19,8 +19,8 @@ workflow BAM_VARIANT_CALLING_GERMLINE_MANTA { // Combine cram and intervals, account for 0 intervals cram_intervals = cram.combine(intervals).map{ it -> - bed_gz = it.size() > 3 ? it[3] : [] - bed_tbi = it.size() > 3 ? it[4] : [] + def bed_gz = it.size() > 3 ? it[3] : [] + def bed_tbi = it.size() > 3 ? it[4] : [] [it[0], it[1], it[2], bed_gz, bed_tbi] } diff --git a/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf b/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf index 72d80fd58e..894d029c21 100644 --- a/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf +++ b/subworkflows/local/bam_variant_calling_haplotypecaller/main.nf @@ -28,7 +28,7 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER { cram_intervals = cram.combine(intervals) // Move num_intervals to meta map // Add interval_name to allow correct merging with interval files - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ interval_name:intervals.baseName, num_intervals:num_intervals, variantcaller:'haplotypecaller' ], cram, crai, intervals, [] ] } + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ interval_name:intervals.baseName, num_intervals:num_intervals, variantcaller:'haplotypecaller' ], cram_, crai, intervals_, [] ] } GATK4_HAPLOTYPECALLER( cram_intervals, @@ -42,11 +42,11 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER { gvcf_tbi_intervals = GATK4_HAPLOTYPECALLER.out.vcf .join(GATK4_HAPLOTYPECALLER.out.tbi, failOnMismatch: true) .join(cram_intervals, failOnMismatch: true) - .map{ meta, gvcf, tbi, cram, crai, intervals, dragstr_model -> [ meta, gvcf, tbi, intervals ] } + .map{ meta, gvcf, tbi, _cram, crai, intervals_, dragstr_model -> [ meta, gvcf, tbi, intervals_ ] } // Figuring out if there is one or more vcf(s) from the same sample haplotypecaller_vcf = GATK4_HAPLOTYPECALLER.out.vcf.map{ - meta, vcf -> [ meta - meta.subMap('interval_name'), vcf] + meta, vcf_ -> [ meta - meta.subMap('interval_name'), vcf_ ] } .branch{ // Use meta.num_intervals to asses number of intervals @@ -73,7 +73,7 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER { } // Only when using intervals - MERGE_HAPLOTYPECALLER(haplotypecaller_vcf.intervals.map{ meta, vcf -> [ groupKey(meta, meta.num_intervals), vcf ] }.groupTuple(), dict) + MERGE_HAPLOTYPECALLER(haplotypecaller_vcf.intervals.map{ meta, vcf_ -> [ groupKey(meta, meta.num_intervals), vcf_ ] }.groupTuple(), dict) haplotypecaller_vcf = Channel.empty().mix( MERGE_HAPLOTYPECALLER.out.vcf, @@ -95,8 +95,8 @@ workflow BAM_VARIANT_CALLING_HAPLOTYPECALLER { versions = versions.mix(MERGE_HAPLOTYPECALLER.out.versions) // Remove no longer necessary field: num_intervals - vcf = haplotypecaller_vcf.map{ meta, vcf -> [ meta - meta.subMap('num_intervals'), vcf ] } - tbi = haplotypecaller_tbi.map{ meta, tbi -> [ meta - meta.subMap('num_intervals'), tbi ] } + vcf = haplotypecaller_vcf.map{ meta, vcf_ -> [ meta - meta.subMap('num_intervals'), vcf_ ] } + tbi = haplotypecaller_tbi.map{ meta, tbi_ -> [ meta - meta.subMap('num_intervals'), tbi_ ] } emit: gvcf_tbi_intervals // For joint genotyping diff --git a/subworkflows/local/bam_variant_calling_mpileup/main.nf b/subworkflows/local/bam_variant_calling_mpileup/main.nf index 9a3929504d..3f039e27b5 100644 --- a/subworkflows/local/bam_variant_calling_mpileup/main.nf +++ b/subworkflows/local/bam_variant_calling_mpileup/main.nf @@ -22,14 +22,14 @@ workflow BAM_VARIANT_CALLING_MPILEUP { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map and reorganize channel for BCFTOOLS_MPILEUP/SAMTOOLS_MPILEUP modules - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, intervals ] } + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, intervals_ ] } // Run, if --tools mpileup keep_bcftools_mpileup = false BCFTOOLS_MPILEUP(cram_intervals, fasta, keep_bcftools_mpileup) //Only run, if --tools ControlFreec - SAMTOOLS_MPILEUP(cram_intervals, fasta.map{ meta, fasta -> [ fasta ] }) + SAMTOOLS_MPILEUP(cram_intervals, fasta.map{ meta, fasta_ -> [ fasta_ ] }) // Figuring out if there is one or more vcf(s) from the same sample vcf_mpileup = BCFTOOLS_MPILEUP.out.vcf.branch{ diff --git a/subworkflows/local/bam_variant_calling_sentieon_dnascope/main.nf b/subworkflows/local/bam_variant_calling_sentieon_dnascope/main.nf index 7a2b3a6b5e..e687955da5 100644 --- a/subworkflows/local/bam_variant_calling_sentieon_dnascope/main.nf +++ b/subworkflows/local/bam_variant_calling_sentieon_dnascope/main.nf @@ -33,14 +33,14 @@ workflow BAM_VARIANT_CALLING_SENTIEON_DNASCOPE { // Combine cram and intervals for spread and gather strategy cram_intervals_for_sentieon = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, num_intervals -> [ + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals, intervals_name:intervals.simpleName, variantcaller:'sentieon_dnascope'], - cram, + cram_, crai, - intervals + intervals_ ] } @@ -63,12 +63,12 @@ workflow BAM_VARIANT_CALLING_SENTIEON_DNASCOPE { genotype_intervals = SENTIEON_DNASCOPE.out.gvcf .join(SENTIEON_DNASCOPE.out.gvcf_tbi, failOnMismatch: true) .join(cram_intervals_for_sentieon, failOnMismatch: true) - .map{ meta, gvcf, tbi, cram, crai, intervals -> [ meta, gvcf, tbi, intervals ] } + .map{ meta, gvcf_, tbi, _cram, crai, intervals_ -> [ meta, gvcf_, tbi, intervals_ ] } } // Figure out if using intervals or no_intervals dnascope_vcf_branch = SENTIEON_DNASCOPE.out.vcf.map{ - meta, vcf -> [ meta - meta.subMap('interval_name'), vcf] + meta, vcf_ -> [ meta - meta.subMap('interval_name'), vcf_] } .branch{ intervals: it[0].num_intervals > 1 @@ -84,7 +84,7 @@ workflow BAM_VARIANT_CALLING_SENTIEON_DNASCOPE { } haplotyper_gvcf_branch = SENTIEON_DNASCOPE.out.gvcf.map{ - meta, gvcf -> [ meta - meta.subMap('interval_name'), gvcf] + meta, gvcf_ -> [ meta - meta.subMap('interval_name'), gvcf_] } .branch{ intervals: it[0].num_intervals > 1 @@ -100,12 +100,12 @@ workflow BAM_VARIANT_CALLING_SENTIEON_DNASCOPE { } vcfs_for_merging = dnascope_vcf_branch.intervals.map{ - meta, vcf -> [ groupKey(meta, meta.num_intervals), vcf ]} + meta, vcf_ -> [ groupKey(meta, meta.num_intervals), vcf_ ]} vcfs_for_merging = vcfs_for_merging.map{ - meta, vcf -> [ + meta, vcf_ -> [ meta - meta.subMap('intervals_name'), - vcf]}.groupTuple() + vcf_ ]}.groupTuple() // VCFs // Only when using intervals @@ -120,16 +120,16 @@ workflow BAM_VARIANT_CALLING_SENTIEON_DNASCOPE { dnascope_vcf_tbi_branch.no_intervals) // Remove no longer necessary field: num_intervals - vcf = dnascope_vcf.map{ meta, vcf -> [ meta - meta.subMap('num_intervals'), vcf ] } + vcf = dnascope_vcf.map{ meta, vcf_ -> [ meta - meta.subMap('num_intervals'), vcf_ ] } vcf_tbi = haplotyper_tbi.map{ meta, tbi -> [ meta - meta.subMap('num_intervals'), tbi ] } // GVFs // Only when using intervals gvcfs_for_merging = haplotyper_gvcf_branch.intervals.map{ - meta, vcf -> [groupKey(meta, meta.num_intervals), vcf]} + meta, vcf_ -> [groupKey(meta, meta.num_intervals), vcf_ ]} gvcfs_for_merging = gvcfs_for_merging.map{ - meta, vcf -> [ meta - meta.subMap('intervals_name'), vcf ] + meta, vcf_ -> [ meta - meta.subMap('intervals_name'), vcf_ ] }.groupTuple() MERGE_SENTIEON_DNASCOPE_GVCFS(gvcfs_for_merging, dict) diff --git a/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf b/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf index 5c1f1338d2..4fcb225f8a 100644 --- a/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf +++ b/subworkflows/local/bam_variant_calling_sentieon_haplotyper/main.nf @@ -31,14 +31,14 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { // Combine cram and intervals for spread and gather strategy cram_intervals_for_sentieon = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, num_intervals -> [ + .map{ meta, cram_, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals, intervals_name:intervals.baseName, variantcaller:'sentieon_haplotyper'], - cram, + cram_, crai, - intervals + intervals_ ] } @@ -48,7 +48,7 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { emit_vcf = lst.size() > 0 ? lst[0] : '' SENTIEON_HAPLOTYPER( - cram_intervals_for_sentieon.map{ meta, cram, crai, intervals, num_intervals -> [ meta, cram, crai, intervals, [] ]}, + cram_intervals_for_sentieon.map{ meta, cram_, crai, intervals_, num_intervals -> [ meta, cram_, crai, intervals_, [] ]}, fasta, fasta_fai, dbsnp, @@ -60,12 +60,12 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { genotype_intervals = SENTIEON_HAPLOTYPER.out.gvcf .join(SENTIEON_HAPLOTYPER.out.gvcf_tbi, failOnMismatch: true) .join(cram_intervals_for_sentieon, failOnMismatch: true) - .map{ meta, gvcf, tbi, cram, crai, intervals -> [ meta, gvcf, tbi, intervals ] } + .map{ meta, gvcf_, tbi, _cram, crai, intervals_ -> [ meta, gvcf_, tbi, intervals_ ] } } // Figure out if using intervals or no_intervals haplotyper_vcf_branch = SENTIEON_HAPLOTYPER.out.vcf.map{ - meta, vcf -> [ meta - meta.subMap('interval_name'), vcf] + meta, vcf_ -> [ meta - meta.subMap('interval_name'), vcf_] } .branch{ intervals: it[0].num_intervals > 1 @@ -81,7 +81,7 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { } haplotyper_gvcf_branch = SENTIEON_HAPLOTYPER.out.gvcf.map{ - meta, gvcf -> [ meta - meta.subMap('interval_name'), gvcf] + meta, gvcf_ -> [ meta - meta.subMap('interval_name'), gvcf_] } .branch{ intervals: it[0].num_intervals > 1 @@ -97,12 +97,12 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { } vcfs_for_merging = haplotyper_vcf_branch.intervals.map{ - meta, vcf -> [ groupKey(meta, meta.num_intervals), vcf ]} + meta, vcf_ -> [ groupKey(meta, meta.num_intervals), vcf_ ]} vcfs_for_merging = vcfs_for_merging.map{ - meta, vcf -> [ + meta, vcf_ -> [ meta - meta.subMap('intervals_name'), - vcf]}.groupTuple() + vcf_ ]}.groupTuple() // VCFs // Only when using intervals @@ -117,16 +117,16 @@ workflow BAM_VARIANT_CALLING_SENTIEON_HAPLOTYPER { haplotyper_vcf_tbi_branch.no_intervals) // Remove no longer necessary field: num_intervals - vcf = haplotyper_vcf.map{ meta, vcf -> [ meta - meta.subMap('num_intervals'), vcf ] } + vcf = haplotyper_vcf.map{ meta, vcf_ -> [ meta - meta.subMap('num_intervals'), vcf_ ] } vcf_tbi = haplotyper_tbi.map{ meta, tbi -> [ meta - meta.subMap('num_intervals'), tbi ] } // GVFs // Only when using intervals gvcfs_for_merging = haplotyper_gvcf_branch.intervals.map{ - meta, vcf -> [groupKey(meta, meta.num_intervals), vcf]} + meta, vcf_ -> [groupKey(meta, meta.num_intervals), vcf_]} gvcfs_for_merging = gvcfs_for_merging.map{ - meta, vcf -> [ meta - meta.subMap('intervals_name'), vcf ] + meta, vcf_ -> [ meta - meta.subMap('intervals_name'), vcf_ ] }.groupTuple() MERGE_SENTIEON_HAPLOTYPER_GVCFS(gvcfs_for_merging, dict) diff --git a/subworkflows/local/bam_variant_calling_single_strelka/main.nf b/subworkflows/local/bam_variant_calling_single_strelka/main.nf index ab6b3373c3..07fc8694f9 100644 --- a/subworkflows/local/bam_variant_calling_single_strelka/main.nf +++ b/subworkflows/local/bam_variant_calling_single_strelka/main.nf @@ -22,7 +22,7 @@ workflow BAM_VARIANT_CALLING_SINGLE_STRELKA { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, cram, crai, intervals, intervals_index, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals, intervals_index ] } + .map{ meta, cram_, crai, intervals_, intervals_index, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram_, crai, intervals_, intervals_index ] } STRELKA_SINGLE(cram_intervals, fasta, fasta_fai) @@ -41,8 +41,8 @@ workflow BAM_VARIANT_CALLING_SINGLE_STRELKA { } // Only when using intervals - genome_vcf_to_merge = genome_vcf.intervals.map{ meta, vcf -> [ groupKey(meta, meta.num_intervals), vcf ]}.groupTuple() - vcf_to_merge = vcf.intervals.map{ meta, vcf -> [ groupKey(meta, meta.num_intervals), vcf ]}.groupTuple() + genome_vcf_to_merge = genome_vcf.intervals.map{ meta, vcf_ -> [ groupKey(meta, meta.num_intervals), vcf_ ]}.groupTuple() + vcf_to_merge = vcf.intervals.map{ meta, vcf_ -> [ groupKey(meta, meta.num_intervals), vcf_ ]}.groupTuple() MERGE_STRELKA(vcf_to_merge, dict) MERGE_STRELKA_GENOME(genome_vcf_to_merge, dict) @@ -51,7 +51,7 @@ workflow BAM_VARIANT_CALLING_SINGLE_STRELKA { // Only strelka variant vcf should get annotated vcf = Channel.empty().mix(MERGE_STRELKA.out.vcf, vcf.no_intervals) // add variantcaller to meta map and remove no longer necessary field: num_intervals - .map{ meta, vcf -> [ meta - meta.subMap('num_intervals') + [ variantcaller:'strelka' ], vcf ] } + .map{ meta, vcf_ -> [ meta - meta.subMap('num_intervals') + [ variantcaller:'strelka' ], vcf_ ] } versions = versions.mix(MERGE_STRELKA.out.versions) versions = versions.mix(MERGE_STRELKA_GENOME.out.versions) diff --git a/subworkflows/local/bam_variant_calling_somatic_all/main.nf b/subworkflows/local/bam_variant_calling_somatic_all/main.nf index 2942e08813..ed81478589 100644 --- a/subworkflows/local/bam_variant_calling_somatic_all/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_all/main.nf @@ -64,7 +64,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { allele_files, loci_files, (wes ? intervals_bed_combined : []), // No intervals needed if not WES - fasta.map{ meta, fasta -> [ fasta ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, gc_file, rt_file ) @@ -97,13 +97,13 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { // Remap channel to match module/subworkflow mpileup_pair = mpileup_normal.cross(mpileup_tumor).map{ normal, tumor -> [ normal[0], normal[1], tumor[1], [], [], [], [] ] } - length_file = cf_chrom_len ?: fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] } + length_file = cf_chrom_len ?: fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] } intervals_controlfreec = wes ? intervals_bed_combined : [] BAM_VARIANT_CALLING_SOMATIC_CONTROLFREEC( mpileup_pair, - fasta.map{ meta, fasta -> [ fasta ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, length_file, dbsnp, dbsnp_tbi, @@ -183,8 +183,8 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { cram_strelka, // Remap channel to match module/subworkflow dict, - fasta.map{ meta, fasta -> [ fasta ] }, - fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, + fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] }, intervals_bed_gz_tbi ) @@ -194,7 +194,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_ALL { // MSISENSOR if (tools.split(',').contains('msisensorpro')) { - MSISENSORPRO_MSISOMATIC(cram.combine(intervals_bed_combined), fasta.map{ meta, fasta -> [ fasta ] }, msisensorpro_scan) + MSISENSORPRO_MSISOMATIC(cram.combine(intervals_bed_combined), fasta.map{ meta, fasta_ -> [ fasta_ ] }, msisensorpro_scan) versions = versions.mix(MSISENSORPRO_MSISOMATIC.out.versions) out_msisensorpro = out_msisensorpro.mix(MSISENSORPRO_MSISOMATIC.out.output_report) diff --git a/subworkflows/local/bam_variant_calling_somatic_manta/main.nf b/subworkflows/local/bam_variant_calling_somatic_manta/main.nf index f6720c5406..589f05e5d3 100644 --- a/subworkflows/local/bam_variant_calling_somatic_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_manta/main.nf @@ -18,8 +18,8 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MANTA { // Combine cram and intervals, account for 0 intervals cram_intervals = cram.combine(intervals).map{ it -> - bed_gz = it.size() > 5 ? it[5] : [] - bed_tbi = it.size() > 5 ? it[6] : [] + def bed_gz = it.size() > 5 ? it[5] : [] + def bed_tbi = it.size() > 5 ? it[6] : [] [it[0], it[1], it[2], it[3], it[4], bed_gz, bed_tbi] } diff --git a/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf b/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf index 3f5b7d53ca..0f168baac8 100644 --- a/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_mutect2/main.nf @@ -37,7 +37,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { // Combine input and intervals for spread and gather strategy input_intervals = input.combine(intervals) // Move num_intervals to meta map and reorganize channel for MUTECT2_PAIRED module - .map{ meta, input_list, input_index_list, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], input_list, input_index_list, intervals ] } + .map{ meta, input_list, input_index_list, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], input_list, input_index_list, intervals_ ] } if (joint_mutect2) { @@ -54,7 +54,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { ch_tn_intervals = ch_tn_cram.combine(intervals) // Move num_intervals to meta map and reorganize channel for MUTECT2_PAIRED module // meta: [id:patient_id, num_intervals, patient, sex] - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] } + .map{ meta, cram, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals_ ] } MUTECT2_PAIRED( ch_tn_intervals, fasta, fai, dict, germline_resource, germline_resource_tbi, panel_of_normals, panel_of_normals_tbi) } @@ -118,17 +118,17 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { // Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2 LEARNREADORIENTATIONMODEL(f1r2) - pileup = input_intervals.multiMap{ meta, input_list, input_index_list, intervals -> - tumor: [ meta, input_list[1], input_index_list[1], intervals ] - normal: [ meta, input_list[0], input_index_list[0], intervals ] + pileup = input_intervals.multiMap{ meta, input_list, input_index_list, intervals_ -> + tumor: [ meta, input_list[1], input_index_list[1], intervals_ ] + normal: [ meta, input_list[0], input_index_list[0], intervals_ ] } // Prepare input channel for normal pileup summaries. // Remember, the input channel contains tumor-normal pairs, so there will be multiple copies of the normal sample for each tumor for a given patient. // Therefore, we use unique function to generate normal pileup summaries once for each patient for better efficiency. - pileup_normal = pileup.normal.map{ meta, cram, crai, intervals -> [ meta - meta.subMap('tumor_id') + [ id:meta.normal_id ], cram, crai, intervals] }.unique() + pileup_normal = pileup.normal.map{ meta, cram, crai, intervals_ -> [ meta - meta.subMap('tumor_id') + [ id:meta.normal_id ], cram, crai, intervals_] }.unique() // Prepare input channel for tumor pileup summaries. - pileup_tumor = pileup.tumor.map{ meta, cram, crai, intervals -> [ meta - meta.subMap('normal_id') + [ id:meta.tumor_id ], cram, crai, intervals ] } + pileup_tumor = pileup.tumor.map{ meta, cram, crai, intervals_ -> [ meta - meta.subMap('normal_id') + [ id:meta.tumor_id ], cram, crai, intervals_ ] } // Generate pileup summary tables using getepileupsummaries. tumor sample should always be passed in as the first input and input list entries of vcf_to_filter, GETPILEUPSUMMARIES_NORMAL(pileup_normal, fasta, fai, dict, germline_resource_pileup, germline_resource_pileup_tbi) @@ -153,8 +153,8 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { pileup_table_tumor_to_merge = pileup_table_tumor_branch.intervals.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple() // Merge Pileup Summaries - GATHERPILEUPSUMMARIES_NORMAL(pileup_table_normal_to_merge, dict.map{ meta, dict -> [ dict ] }) - GATHERPILEUPSUMMARIES_TUMOR(pileup_table_tumor_to_merge, dict.map{ meta, dict -> [ dict ] }) + GATHERPILEUPSUMMARIES_NORMAL(pileup_table_normal_to_merge, dict.map{ meta, dict_ -> [ dict_ ] }) + GATHERPILEUPSUMMARIES_TUMOR(pileup_table_tumor_to_merge, dict.map{ meta, dict_ -> [ dict_ ] }) // Do some channel magic to generate tumor-normal pairs again. // This is necessary because we generated one normal pileup summary for each patient but we need run calculate contamination for each tumor-normal pair. @@ -197,13 +197,13 @@ workflow BAM_VARIANT_CALLING_SOMATIC_MUTECT2 { .join(LEARNREADORIENTATIONMODEL.out.artifactprior, failOnDuplicate: true, failOnMismatch: true) .join(calculatecontamination_out_seg) .join(calculatecontamination_out_cont) - .map{ meta, vcf, tbi, stats, orientation, seg, cont -> [ meta, vcf, tbi, stats, orientation, seg, cont, [] ] } + .map{ meta, vcf_, tbi_, stats_, orientation, seg, cont -> [ meta, vcf_, tbi_, stats_, orientation, seg, cont, [] ] } FILTERMUTECTCALLS(vcf_to_filter, fasta, fai, dict) vcf_filtered = FILTERMUTECTCALLS.out.vcf // add variantcaller to meta map - .map{ meta, vcf -> [ meta + [ variantcaller:'mutect2' ], vcf ] } + .map{ meta, vcf_ -> [ meta + [ variantcaller:'mutect2' ], vcf_ ] } versions = versions.mix(MERGE_MUTECT2.out.versions) versions = versions.mix(CALCULATECONTAMINATION.out.versions) diff --git a/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf b/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf index 02c729f93e..3d4731826a 100644 --- a/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf +++ b/subworkflows/local/bam_variant_calling_somatic_strelka/main.nf @@ -22,7 +22,7 @@ workflow BAM_VARIANT_CALLING_SOMATIC_STRELKA { // Combine cram and intervals for spread and gather strategy cram_intervals = cram.combine(intervals) // Move num_intervals to meta map - .map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, manta_vcf, manta_tbi, intervals, intervals_index, num_intervals -> [ meta + [ num_intervals:num_intervals ], normal_cram, normal_crai, tumor_cram, tumor_crai, manta_vcf, manta_tbi, intervals, intervals_index ] } + .map{ meta, normal_cram, normal_crai, tumor_cram, tumor_crai, manta_vcf, manta_tbi, intervals_, intervals_index, num_intervals -> [ meta + [ num_intervals:num_intervals ], normal_cram, normal_crai, tumor_cram, tumor_crai, manta_vcf, manta_tbi, intervals_, intervals_index ] } STRELKA_SOMATIC(cram_intervals, fasta, fasta_fai ) diff --git a/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf index 8016391cfc..43fb2cba64 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_all/main.nf @@ -62,13 +62,13 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { // CONTROLFREEC (depends on MPILEUP) if (tools.split(',').contains('controlfreec')) { - length_file = cf_chrom_len ?: fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] } + length_file = cf_chrom_len ?: fasta_fai.map{ meta, fasta_fai_ -> [ fasta_fai_ ] } intervals_controlfreec = wes ? intervals_bed_combined : [] BAM_VARIANT_CALLING_TUMOR_ONLY_CONTROLFREEC( // Remap channel to match module/subworkflow BAM_VARIANT_CALLING_MPILEUP.out.mpileup.map{ meta, pileup_tumor -> [ meta, [], pileup_tumor, [], [], [], [] ] }, - fasta.map{ meta, fasta -> [ fasta ] }, + fasta.map{ meta, fasta_ -> [ fasta_ ] }, length_file, dbsnp, dbsnp_tbi, @@ -84,7 +84,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { if (tools.split(',').contains('cnvkit')) { BAM_VARIANT_CALLING_CNVKIT ( // Remap channel to match module/subworkflow - cram.map{ meta, cram, crai -> [ meta, cram, [] ] }, + cram.map{ meta, cram_, crai -> [ meta, cram_, [] ] }, fasta, fasta_fai, [[id:"null"], []], @@ -98,7 +98,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { if (tools.split(',').contains('freebayes')) { BAM_VARIANT_CALLING_FREEBAYES( // Remap channel to match module/subworkflow - cram.map{ meta, cram, crai -> [ meta, cram, crai, [], [] ] }, + cram.map{ meta, cram_, crai -> [ meta, cram_, crai, [], [] ] }, dict, fasta, fasta_fai, @@ -113,11 +113,11 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_ALL { if (tools.split(',').contains('mutect2')) { BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2( // Adjust meta.map to simplify joining channels - cram.map{ meta, cram, crai -> + cram.map{ meta, cram_, crai -> joint_mutect2 ? //we need to keep all fields and then remove on a per-tool-basis to ensure proper joining at the filtering step - [ meta - meta.subMap('data_type', 'status') + [ id:meta.patient ], cram, crai ] : - [ meta - meta.subMap('data_type', 'status'), cram, crai ] + [ meta - meta.subMap('data_type', 'status') + [ id:meta.patient ], cram_, crai ] : + [ meta - meta.subMap('data_type', 'status'), cram_, crai ] }, fasta, fasta_fai, diff --git a/subworkflows/local/bam_variant_calling_tumor_only_lofreq/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_lofreq/main.nf index b619c1f796..81cd2d211a 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_lofreq/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_lofreq/main.nf @@ -15,7 +15,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_LOFREQ { // Combine cram and intervals for spread and gather strategy input_intervals = input.combine(intervals) // Move num_intervals to meta map - .map {meta, tumor_cram, tumor_crai, intervals, num_intervals -> [meta + [ num_intervals:num_intervals ], tumor_cram, tumor_crai, intervals]} + .map {meta, tumor_cram, tumor_crai, intervals_, num_intervals -> [meta + [ num_intervals:num_intervals ], tumor_cram, tumor_crai, intervals_]} LOFREQ(input_intervals, fasta, fai) // Call variants with LoFreq diff --git a/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf index 38f5d4366c..81966d0624 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_manta/main.nf @@ -19,8 +19,8 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MANTA { // Combine cram and intervals, account for 0 intervals cram_intervals = cram.combine(intervals).map{ it -> - bed_gz = it.size() > 3 ? it[3] : [] - bed_tbi = it.size() > 3 ? it[4] : [] + def bed_gz = it.size() > 3 ? it[3] : [] + def bed_tbi = it.size() > 3 ? it[4] : [] [it[0], it[1], it[2], bed_gz, bed_tbi] } diff --git a/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf b/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf index 4e45a23ac6..d7ba0e8b6f 100644 --- a/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf +++ b/subworkflows/local/bam_variant_calling_tumor_only_mutect2/main.nf @@ -36,19 +36,19 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 { // Combine input and intervals for spread and gather strategy input_intervals = input.combine(intervals) // Move num_intervals to meta map and reorganize channel for MUTECT2 module - .map{ meta, input, index, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], input, index, intervals ] } + .map{ meta, input_, index, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], input_, index, intervals_ ] } if (joint_mutect2) { // Perform variant calling using mutect2 module in tumor single mode // Group cram files by patient input_joint = input - .map{ meta, input, index -> [ meta - meta.subMap('sample') + [ id:meta.patient ], input, index ] } + .map{ meta, input_, index -> [ meta - meta.subMap('sample') + [ id:meta.patient ], input_, index ] } .groupTuple() // Add intervals for scatter-gather scaling input_joint_intervals = input_joint.combine(intervals) // Move num_intervals to meta map and reorganize channel for MUTECT2 module - .map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] } + .map{ meta, cram, crai, intervals_, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals_ ] } MUTECT2(input_joint_intervals, fasta, fai, dict, germline_resource, germline_resource_tbi, panel_of_normals, panel_of_normals_tbi) } else { @@ -102,7 +102,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 { // Generate artifactpriors using learnreadorientationmodel on the f1r2 output of mutect2 LEARNREADORIENTATIONMODEL(f1r2) - pileup_input = input_intervals.map{ meta, cram, crai, intervals -> [ meta + [ id:meta.sample ], cram, crai, intervals] }.unique() + pileup_input = input_intervals.map{ meta, cram, crai, intervals_ -> [ meta + [ id:meta.sample ], cram, crai, intervals_] }.unique() // Generate pileup summary table using getepileupsummaries GETPILEUPSUMMARIES(pileup_input, fasta, fai, dict, germline_resource_pileup, germline_resource_pileup_tbi) @@ -117,7 +117,7 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 { // Only when using intervals pileup_table_to_merge = pileup_table_branch.intervals.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple() - GATHERPILEUPSUMMARIES(pileup_table_to_merge, dict.map{ meta, dict -> [ dict ] }) + GATHERPILEUPSUMMARIES(pileup_table_to_merge, dict.map{ meta, dict_ -> [ dict_ ] }) // Mix intervals and no_intervals channels together pileup_table = Channel.empty().mix(GATHERPILEUPSUMMARIES.out.table, pileup_table_branch.no_intervals).map{meta, table -> [ meta - meta.subMap('num_intervals') + [id:meta.sample], table ] } @@ -145,13 +145,13 @@ workflow BAM_VARIANT_CALLING_TUMOR_ONLY_MUTECT2 { .join(LEARNREADORIENTATIONMODEL.out.artifactprior, failOnDuplicate: true, failOnMismatch: true) .join(calculatecontamination_out_seg) .join(calculatecontamination_out_cont) - .map{ meta, vcf, tbi, stats, artifactprior, seg, cont -> [ meta, vcf, tbi, stats, artifactprior, seg, cont, [] ] } + .map{ meta, vcf_, tbi_, stats_, artifactprior, seg, cont -> [ meta, vcf_, tbi_, stats_, artifactprior, seg, cont, [] ] } FILTERMUTECTCALLS(vcf_to_filter, fasta, fai, dict) vcf_filtered = FILTERMUTECTCALLS.out.vcf // add variantcaller to meta map and remove no longer necessary field: num_intervals - .map{ meta, vcf -> [ meta + [ variantcaller:'mutect2' ], vcf ] } + .map{ meta, vcf_ -> [ meta + [ variantcaller:'mutect2' ], vcf_ ] } versions = versions.mix(MERGE_MUTECT2.out.versions) versions = versions.mix(CALCULATECONTAMINATION.out.versions) diff --git a/subworkflows/local/channel_align_create_csv/main.nf b/subworkflows/local/channel_align_create_csv/main.nf index 965b36d33d..76cf8534ad 100644 --- a/subworkflows/local/channel_align_create_csv/main.nf +++ b/subworkflows/local/channel_align_create_csv/main.nf @@ -11,16 +11,16 @@ workflow CHANNEL_ALIGN_CREATE_CSV { main: // Creating csv files to restart from this step bam_indexed.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, bam, bai -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - bam = "${outdir}/preprocessing/mapped/${sample}/${bam.name}" - bai = "${outdir}/preprocessing/mapped/${sample}/${bai.name}" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def bam_path = "${outdir}/preprocessing/mapped/${sample}/${bam.name}" + def bai_path = "${outdir}/preprocessing/mapped/${sample}/${bai.name}" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["mapped.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${bam},${bai}\n"] + ["mapped.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${bam_path},${bai_path}\n"] } } diff --git a/subworkflows/local/channel_applybqsr_create_csv/main.nf b/subworkflows/local/channel_applybqsr_create_csv/main.nf index faa9aa5293..a435d5364c 100644 --- a/subworkflows/local/channel_applybqsr_create_csv/main.nf +++ b/subworkflows/local/channel_applybqsr_create_csv/main.nf @@ -11,16 +11,16 @@ workflow CHANNEL_APPLYBQSR_CREATE_CSV { main: // Creating csv files to restart from this step cram_recalibrated_index.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, file, index -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - file = "${outdir}/preprocessing/recalibrated/${sample}/${file.name}" - index = "${outdir}/preprocessing/recalibrated/${sample}/${index.name}" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def file_path = "${outdir}/preprocessing/recalibrated/${sample}/${file.name}" + def index_path = "${outdir}/preprocessing/recalibrated/${sample}/${index.name}" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["recalibrated.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${file},${index}\n"] + ["recalibrated.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${file_path},${index_path}\n"] } } diff --git a/subworkflows/local/channel_baserecalibrator_create_csv/main.nf b/subworkflows/local/channel_baserecalibrator_create_csv/main.nf index 88ff0cfc38..0865e28b1d 100644 --- a/subworkflows/local/channel_baserecalibrator_create_csv/main.nf +++ b/subworkflows/local/channel_baserecalibrator_create_csv/main.nf @@ -15,55 +15,55 @@ workflow CHANNEL_BASERECALIBRATOR_CREATE_CSV { if ( tools && tools.split(',').contains('sentieon_dedup') ) { cram_table_bqsr.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, cram, crai, table -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - suffix_aligned = save_output_as_bam ? "bam" : "cram" - suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" - cram = "${outdir}/preprocessing/sentieon_dedup/${sample}/${cram.baseName}.${suffix_aligned}" - crai = "${outdir}/preprocessing/sentieon_dedup/${sample}/${crai.baseName.minus(".cram")}.${suffix_index}" - table = "${outdir}/preprocessing/recal_table/${sample}/${sample}.recal.table" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def suffix_aligned = save_output_as_bam ? "bam" : "cram" + def suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" + def file_path = "${outdir}/preprocessing/sentieon_dedup/${sample}/${cram.baseName}.${suffix_aligned}" + def index_path = "${outdir}/preprocessing/sentieon_dedup/${sample}/${crai.baseName.minus(".cram")}.${suffix_index}" + def table_path = "${outdir}/preprocessing/recal_table/${sample}/${sample}.recal.table" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["markduplicates.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${cram},${crai},${table}\n"] + ["markduplicates.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${file_path},${index_path},${table_path}\n"] } } else if (!(skip_tools && (skip_tools.split(',').contains('markduplicates')))) { cram_table_bqsr.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, cram, crai, table -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - suffix_aligned = save_output_as_bam ? "bam" : "cram" - suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" - cram = "${outdir}/preprocessing/markduplicates/${sample}/${cram.baseName}.${suffix_aligned}" - crai = "${outdir}/preprocessing/markduplicates/${sample}/${crai.baseName.minus(".cram")}.${suffix_index}" - table = "${outdir}/preprocessing/recal_table/${sample}/${sample}.recal.table" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def suffix_aligned = save_output_as_bam ? "bam" : "cram" + def suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" + def file_path = "${outdir}/preprocessing/markduplicates/${sample}/${cram.baseName}.${suffix_aligned}" + def index_path = "${outdir}/preprocessing/markduplicates/${sample}/${crai.baseName.minus(".cram")}.${suffix_index}" + def table_path = "${outdir}/preprocessing/recal_table/${sample}/${sample}.recal.table" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["markduplicates.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${cram},${crai},${table}\n"] + ["markduplicates.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${file_path},${index_path},${table_path}\n"] } } else { cram_table_bqsr.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, cram, crai, table -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - suffix_aligned = save_output_as_bam ? "bam" : "cram" - suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" - cram = "${outdir}/preprocessing/${sample}/mapped/${cram.baseName}.${suffix_aligned}" - crai = "${outdir}/preprocessing/${sample}/mapped/${crai.baseName.minus(".cram")}.${suffix_index}" - table = "${outdir}/preprocessing/${sample}/recal_table/${sample}.recal.table" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def suffix_aligned = save_output_as_bam ? "bam" : "cram" + def suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" + def file_path = "${outdir}/preprocessing/${sample}/mapped/${cram.baseName}.${suffix_aligned}" + def index_path = "${outdir}/preprocessing/${sample}/mapped/${crai.baseName.minus(".cram")}.${suffix_index}" + def table_path = "${outdir}/preprocessing/${sample}/recal_table/${sample}.recal.table" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["sorted.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${cram},${crai},${table}\n"] + ["sorted.csv", "patient,sex,status,sample,${type},${type_index},table\n${patient},${sex},${status},${sample},${file_path},${index_path},${table_path}\n"] } } } diff --git a/subworkflows/local/channel_markduplicates_create_csv/main.nf b/subworkflows/local/channel_markduplicates_create_csv/main.nf index 3cec161c02..0cc1591995 100644 --- a/subworkflows/local/channel_markduplicates_create_csv/main.nf +++ b/subworkflows/local/channel_markduplicates_create_csv/main.nf @@ -12,18 +12,18 @@ workflow CHANNEL_MARKDUPLICATES_CREATE_CSV { main: // Creating csv files to restart from this step cram_markduplicates.collectFile(keepHeader: true, skip: 1, sort: true, storeDir: "${outdir}/csv") { meta, file, index -> - patient = meta.patient - sample = meta.sample - sex = meta.sex - status = meta.status - suffix_aligned = save_output_as_bam ? "bam" : "cram" - suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" - file = "${outdir}/preprocessing/${csv_subfolder}/${sample}/${file.baseName}.${suffix_aligned}" - index = "${outdir}/preprocessing/${csv_subfolder}/${sample}/${index.baseName.minus(".cram")}.${suffix_index}" + def patient = meta.patient + def sample = meta.sample + def sex = meta.sex + def status = meta.status + def suffix_aligned = save_output_as_bam ? "bam" : "cram" + def suffix_index = save_output_as_bam ? "bam.bai" : "cram.crai" + def file_path = "${outdir}/preprocessing/${csv_subfolder}/${sample}/${file.baseName}.${suffix_aligned}" + def index_path = "${outdir}/preprocessing/${csv_subfolder}/${sample}/${index.baseName.minus(".cram")}.${suffix_index}" - type = save_output_as_bam ? "bam" : "cram" - type_index = save_output_as_bam ? "bai" : "crai" + def type = save_output_as_bam ? "bam" : "cram" + def type_index = save_output_as_bam ? "bai" : "crai" - ["markduplicates_no_table.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${file},${index}\n"] + ["markduplicates_no_table.csv", "patient,sex,status,sample,${type},${type_index}\n${patient},${sex},${status},${sample},${file_path},${index_path}\n"] } } diff --git a/subworkflows/local/channel_variant_calling_create_csv/main.nf b/subworkflows/local/channel_variant_calling_create_csv/main.nf index 9de3fa58ba..107402d0d9 100644 --- a/subworkflows/local/channel_variant_calling_create_csv/main.nf +++ b/subworkflows/local/channel_variant_calling_create_csv/main.nf @@ -10,10 +10,11 @@ workflow CHANNEL_VARIANT_CALLING_CREATE_CSV { main: // Creating csv files to restart from this step vcf_to_annotate.collectFile(keepHeader: true, skip: 1,sort: true, storeDir: "${outdir}/csv"){ meta, vcf -> - patient = meta.patient - sample = meta.id - variantcaller = meta.variantcaller - vcf = "${outdir}/variant_calling/${variantcaller}/${meta.id}/${vcf.getName()}" - ["variantcalled.csv", "patient,sample,variantcaller,vcf\n${patient},${sample},${variantcaller},${vcf}\n"] + def patient = meta.patient + def sample = meta.id + def variantcaller = meta.variantcaller + def vcf_file = "${outdir}/variant_calling/${variantcaller}/${meta.id}/${vcf.getName()}" + + ["variantcalled.csv", "patient,sample,variantcaller,vcf\n${patient},${sample},${variantcaller},${vcf_file}\n"] } } diff --git a/subworkflows/local/cram_merge_index_samtools/main.nf b/subworkflows/local/cram_merge_index_samtools/main.nf index b808c8edc6..360069cc40 100644 --- a/subworkflows/local/cram_merge_index_samtools/main.nf +++ b/subworkflows/local/cram_merge_index_samtools/main.nf @@ -17,11 +17,11 @@ workflow CRAM_MERGE_INDEX_SAMTOOLS { versions = Channel.empty() // Figuring out if there is one or more cram(s) from the same sample - cram_to_merge = cram.branch{ meta, cram -> + cram_to_merge = cram.branch{ meta, cram_ -> // cram is a list, so use cram.size() to asses number of intervals - single: cram.size() <= 1 - return [ meta, cram[0] ] - multiple: cram.size() > 1 + single: cram_.size() <= 1 + return [ meta, cram_[0] ] + multiple: cram_.size() > 1 } // Only when using intervals diff --git a/subworkflows/local/cram_sampleqc/main.nf b/subworkflows/local/cram_sampleqc/main.nf index 504dc0a735..03ad8190cb 100644 --- a/subworkflows/local/cram_sampleqc/main.nf +++ b/subworkflows/local/cram_sampleqc/main.nf @@ -29,7 +29,7 @@ workflow CRAM_SAMPLEQC { versions = versions.mix(CRAM_QC_RECAL.out.versions) } - BAM_NGSCHECKMATE(cram.map{meta, cram, crai -> [meta, cram]}, ngscheckmate_bed.map{bed -> [[id: "ngscheckmate"], bed]}, fasta) + BAM_NGSCHECKMATE(cram.map{meta, cram_, crai -> [meta, cram_]}, ngscheckmate_bed.map{bed -> [[id: "ngscheckmate"], bed]}, fasta) versions = versions.mix(BAM_NGSCHECKMATE.out.versions.first()) emit: diff --git a/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf b/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf index 0a711afc5e..8209514998 100644 --- a/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf +++ b/subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf @@ -35,9 +35,9 @@ workflow FASTQ_ALIGN_BWAMEM_MEM2_DRAGMAP_SENTIEON { bam = bam.mix(BWAMEM1_MEM.out.bam) bam = bam.mix(BWAMEM2_MEM.out.bam) bam = bam.mix(DRAGMAP_ALIGN.out.bam) - bam = bam.mix(SENTIEON_BWAMEM.out.bam_and_bai.map{ meta, bam, bai -> [ meta, bam ] }) + bam = bam.mix(SENTIEON_BWAMEM.out.bam_and_bai.map{ meta, bam_, bai -> [ meta, bam_ ] }) - bai = SENTIEON_BWAMEM.out.bam_and_bai.map{ meta, bam, bai -> [ meta, bai ] } + bai = SENTIEON_BWAMEM.out.bam_and_bai.map{ meta, _bam, bai -> [ meta, bai ] } // Gather reports of all tools used reports = reports.mix(DRAGMAP_ALIGN.out.log) diff --git a/subworkflows/local/prepare_intervals/main.nf b/subworkflows/local/prepare_intervals/main.nf index 27c4e9c145..b80f4c0564 100644 --- a/subworkflows/local/prepare_intervals/main.nf +++ b/subworkflows/local/prepare_intervals/main.nf @@ -13,6 +13,7 @@ include { TABIX_BGZIPTABIX as TABIX_BGZIPTABIX_INTERVAL_SPLIT } from '../../. include { TABIX_BGZIPTABIX as TABIX_BGZIPTABIX_INTERVAL_COMBINED } from '../../../modules/nf-core/tabix/bgziptabix/main' workflow PREPARE_INTERVALS { + take: fasta_fai // mandatory [ fasta_fai ] intervals // [ params.intervals ] @@ -73,12 +74,12 @@ workflow PREPARE_INTERVALS { intervals_bed = intervals_bed.flatten() .map{ intervalFile -> def duration = 0.0 - for (line in intervalFile.readLines()) { - final fields = line.split('\t') + intervalFile.eachLine { line -> + def fields = line.split('\t') if (fields.size() >= 5) duration += fields[4].toFloat() else { - start = fields[1].toInteger() - end = fields[2].toInteger() + def start = fields[1].toInteger() + def end = fields[2].toInteger() duration += (end - start) / nucleotides_per_second } } diff --git a/subworkflows/local/prepare_reference_cnvkit/main.nf b/subworkflows/local/prepare_reference_cnvkit/main.nf index 61424d1980..2e05dd83b7 100644 --- a/subworkflows/local/prepare_reference_cnvkit/main.nf +++ b/subworkflows/local/prepare_reference_cnvkit/main.nf @@ -19,7 +19,7 @@ workflow PREPARE_REFERENCE_CNVKIT { // prepare a antitarget reference files for tumor_only mode of cnvkit CNVKIT_ANTITARGET(intervals_bed_combined.flatten().map{ it -> [ [ id:'intervals' ], it ] }) - CNVKIT_REFERENCE(fasta.map{ meta, fasta -> [ fasta ] }, intervals_bed_combined, CNVKIT_ANTITARGET.out.bed.map{ meta, bed -> [ bed ] } ) + CNVKIT_REFERENCE(fasta.map{ meta, fasta_ -> [ fasta_ ] }, intervals_bed_combined, CNVKIT_ANTITARGET.out.bed.map{ meta, bed -> [ bed ] } ) versions = versions.mix(CNVKIT_ANTITARGET.out.versions) versions = versions.mix(CNVKIT_REFERENCE.out.versions) diff --git a/subworkflows/local/samplesheet_to_channel/main.nf b/subworkflows/local/samplesheet_to_channel/main.nf index 3160ef2f6d..cd8529fdfa 100644 --- a/subworkflows/local/samplesheet_to_channel/main.nf +++ b/subworkflows/local/samplesheet_to_channel/main.nf @@ -64,8 +64,8 @@ workflow SAMPLESHEET_TO_CHANNEL{ // get number of lanes per sample [ patient_sample, ch_items.size() ] }.combine(ch_with_patient_sample, by: 0) // for each entry add numLanes - .map { patient_sample, num_lanes, ch_items -> - (meta, fastq_1, fastq_2, spring_1, spring_2, table, cram, crai, bam, bai, vcf, variantcaller) = ch_items + .map { _patient_sample, num_lanes, ch_items -> + def (meta, fastq_1, fastq_2, spring_1, spring_2, table, cram, crai, bam, bai, vcf, variantcaller) = ch_items if (meta.lane && fastq_2) { meta = meta + [id: "${meta.sample}-${meta.lane}".toString(), data_type: "fastq_gz", num_lanes: num_lanes.toInteger(), size: 1] diff --git a/subworkflows/local/utils_nfcore_sarek_pipeline/main.nf b/subworkflows/local/utils_nfcore_sarek_pipeline/main.nf index ce568284c7..c2a2f60d02 100644 --- a/subworkflows/local/utils_nfcore_sarek_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_sarek_pipeline/main.nf @@ -14,13 +14,11 @@ include { UTILS_NFCORE_PIPELINE } from '../../nf-core/utils_nfcore_pipeline' include { UTILS_NFSCHEMA_PLUGIN } from '../../nf-core/utils_nfschema_plugin' include { completionEmail } from '../../nf-core/utils_nfcore_pipeline' include { completionSummary } from '../../nf-core/utils_nfcore_pipeline' -include { dashedLine } from '../../nf-core/utils_nfcore_pipeline' include { getWorkflowVersion } from '../../nf-core/utils_nfcore_pipeline' include { imNotification } from '../../nf-core/utils_nfcore_pipeline' include { logColours } from '../../nf-core/utils_nfcore_pipeline' include { paramsSummaryMap } from 'plugin/nf-schema' include { samplesheetToList } from 'plugin/nf-schema' -include { workflowCitation } from '../../nf-core/utils_nfcore_pipeline' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -117,8 +115,6 @@ workflow PIPELINE_INITIALISATION { if (params.tools && (params.tools.split(',').contains('snpeff') || params.tools.split(',').contains('merge'))) checkPathParamList.add(params.snpeff_cache) if (params.tools && (params.tools.split(',').contains('vep') || params.tools.split(',').contains('merge'))) checkPathParamList.add(params.vep_cache) - // def retrieveInput(need_input, step, outdir) { - params.input_restart = retrieveInput((!params.build_only_index && !params.input), params.step, params.outdir) ch_from_samplesheet = params.build_only_index ? Channel.empty() : params.input ? @@ -318,59 +314,49 @@ def methodsDescriptionText(mqc_methods_yaml) { return description_html.toString() } -// -// nf-core/sarek logo -// -def nfCoreLogo(monochrome_logs=true) { - Map colors = logColours(monochrome_logs) - String.format( - """\n - ${dashedLine(monochrome_logs)} - ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} - ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} - ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} - ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} - ${colors.green}`._,._,\'${colors.reset} - ${colors.white} ____${colors.reset} - ${colors.white} .´ _ `.${colors.reset} - ${colors.white} / ${colors.green}|\\${colors.reset}`-_ \\${colors.reset} ${colors.blue} __ __ ___ ${colors.reset} - ${colors.white} | ${colors.green}| \\${colors.reset} `-|${colors.reset} ${colors.blue}|__` /\\ |__) |__ |__/${colors.reset} - ${colors.white} \\ ${colors.green}| \\${colors.reset} /${colors.reset} ${colors.blue}.__| /¯¯\\ | \\ |___ | \\${colors.reset} - ${colors.white} `${colors.green}|${colors.reset}____${colors.green}\\${colors.reset}´${colors.reset} - - ${colors.purple} ${workflow.manifest.name} ${getWorkflowVersion()}${colors.reset} - ${dashedLine(monochrome_logs)} - """.stripIndent() - ) -} - // // retrieveInput // +//TODO why do we have `need_input` here. It is not used anywhere in the code def retrieveInput(need_input, step, outdir) { + def input = null + if (!params.input && !params.build_only_index) { - switch (step) { - case 'mapping': error("Can't start $step step without samplesheet") - break - case 'markduplicates': log.warn("Using file ${outdir}/csv/mapped.csv"); - input = outdir + "/csv/mapped.csv" - break - case 'prepare_recalibration': log.warn("Using file ${outdir}/csv/markduplicates_no_table.csv"); - input = outdir + "/csv/markduplicates_no_table.csv" - break - case 'recalibrate': log.warn("Using file ${outdir}/csv/markduplicates.csv"); - input = outdir + "/csv/markduplicates.csv" - break - case 'variant_calling': log.warn("Using file ${outdir}/csv/recalibrated.csv"); - input = outdir + "/csv/recalibrated.csv" - break - // case 'controlfreec': csv_file = file("${outdir}/variant_calling/csv/control-freec_mpileup.csv", checkIfExists: true); break - case 'annotate': log.warn("Using file ${outdir}/csv/variantcalled.csv"); - input = outdir + "/csv/variantcalled.csv" - break - default: log.warn("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'") - error("Unknown step $step") + if (step == 'mapping') { + + error("Can't start $step step without samplesheet") + + } else if (step == 'markduplicates') { + + log.warn("Using file ${outdir}/csv/mapped.csv"); + input = outdir + "/csv/mapped.csv" + + } else if (step == 'prepare_recalibration') { + + log.warn("Using file ${outdir}/csv/markduplicates_no_table.csv"); + input = outdir + "/csv/markduplicates_no_table.csv" + + } else if (step == 'recalibrate') { + + log.warn("Using file ${outdir}/csv/markduplicates.csv"); + input = outdir + "/csv/markduplicates.csv" + + } else if (step == 'variant_calling') { + + log.warn("Using file ${outdir}/csv/recalibrated.csv"); + input = outdir + "/csv/recalibrated.csv" + + } else if (step == 'annotate') { + + log.warn("Using file ${outdir}/csv/variantcalled.csv"); + input = outdir + "/csv/variantcalled.csv" + + } else { + + log.warn("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'") + error("Unknown step $step") + } } return input diff --git a/subworkflows/local/vcf_annotate_all/main.nf b/subworkflows/local/vcf_annotate_all/main.nf index 20cab4be1c..77fc345c92 100644 --- a/subworkflows/local/vcf_annotate_all/main.nf +++ b/subworkflows/local/vcf_annotate_all/main.nf @@ -41,13 +41,13 @@ workflow VCF_ANNOTATE_ALL { if (tools.split(',').contains('merge') || tools.split(',').contains('snpeff')) { VCF_ANNOTATE_SNPEFF(vcf, snpeff_db, snpeff_cache) - reports = reports.mix(VCF_ANNOTATE_SNPEFF.out.reports.map{ meta, reports -> [ reports ] }) + reports = reports.mix(VCF_ANNOTATE_SNPEFF.out.reports.map{ meta, reports_ -> [ reports_ ] }) vcf_ann = vcf_ann.mix(VCF_ANNOTATE_SNPEFF.out.vcf_tbi) versions = versions.mix(VCF_ANNOTATE_SNPEFF.out.versions) } if (tools.split(',').contains('merge')) { - vcf_ann_for_merge = VCF_ANNOTATE_SNPEFF.out.vcf_tbi.map{ meta, vcf, tbi -> [ meta, vcf, [] ] } + vcf_ann_for_merge = VCF_ANNOTATE_SNPEFF.out.vcf_tbi.map{ meta, vcf_, tbi -> [ meta, vcf_, [] ] } VCF_ANNOTATE_MERGE(vcf_ann_for_merge, fasta, vep_genome, vep_species, vep_cache_version, vep_cache, vep_extra_files) reports = reports.mix(VCF_ANNOTATE_MERGE.out.reports) @@ -56,7 +56,7 @@ workflow VCF_ANNOTATE_ALL { } if (tools.split(',').contains('vep')) { - vcf_for_vep = vcf.map{ meta, vcf -> [ meta, vcf, [] ] } + vcf_for_vep = vcf.map{ meta, vcf_ -> [ meta, vcf_, [] ] } VCF_ANNOTATE_ENSEMBLVEP(vcf_for_vep, fasta, vep_genome, vep_species, vep_cache_version, vep_cache, vep_extra_files) reports = reports.mix(VCF_ANNOTATE_ENSEMBLVEP.out.reports) diff --git a/subworkflows/local/vcf_annotate_bcftools/main.nf b/subworkflows/local/vcf_annotate_bcftools/main.nf index 9f23a426ca..5b2f29fdb2 100644 --- a/subworkflows/local/vcf_annotate_bcftools/main.nf +++ b/subworkflows/local/vcf_annotate_bcftools/main.nf @@ -16,7 +16,7 @@ workflow VCF_ANNOTATE_BCFTOOLS { main: ch_versions = Channel.empty() - BCFTOOLS_ANNOTATE(vcf.map{ meta, vcf -> [ meta, vcf, [] ] }, annotations, annotations_index, header_lines) + BCFTOOLS_ANNOTATE(vcf.map{ meta, vcf_ -> [ meta, vcf_, [] ] }, annotations, annotations_index, header_lines) ch_vcf_tbi = BCFTOOLS_ANNOTATE.out.vcf.join(BCFTOOLS_ANNOTATE.out.tbi, failOnDuplicate: true, failOnMismatch: true) diff --git a/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf b/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf index bcdc34e30d..ab69bdeb15 100644 --- a/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf +++ b/subworkflows/local/vcf_qc_bcftools_vcftools/main.nf @@ -12,7 +12,7 @@ workflow VCF_QC_BCFTOOLS_VCFTOOLS { versions = Channel.empty() - BCFTOOLS_STATS(vcf.map{ meta, vcf -> [ meta, vcf, [] ] }, [[:],[]], [[:],[]], [[:],[]], [[:],[]], [[:],[]]) + BCFTOOLS_STATS(vcf.map{ meta, vcf_ -> [ meta, vcf_, [] ] }, [[:],[]], [[:],[]], [[:],[]], [[:],[]], [[:],[]]) VCFTOOLS_TSTV_COUNT(vcf, target_bed, []) VCFTOOLS_TSTV_QUAL(vcf, target_bed, []) VCFTOOLS_SUMMARY(vcf, target_bed, []) diff --git a/subworkflows/local/vcf_variant_filtering_gatk/main.nf b/subworkflows/local/vcf_variant_filtering_gatk/main.nf index 1e0cbd210b..b671efe8f8 100644 --- a/subworkflows/local/vcf_variant_filtering_gatk/main.nf +++ b/subworkflows/local/vcf_variant_filtering_gatk/main.nf @@ -17,7 +17,7 @@ workflow VCF_VARIANT_FILTERING_GATK { versions = Channel.empty() // Don't scatter/gather by intervals, because especially for small regions (targeted or WGS), it easily fails with 0 SNPS in region - cnn_in = vcf.combine(intervals_bed_combined).map{ meta, vcf, tbi, intervals -> [ meta, vcf, tbi, [], intervals ] } + cnn_in = vcf.combine(intervals_bed_combined).map{ meta, vcf_, tbi, intervals -> [ meta, vcf_, tbi, [], intervals ] } CNNSCOREVARIANTS(cnn_in, fasta, fasta_fai, dict, [], []) @@ -25,7 +25,7 @@ workflow VCF_VARIANT_FILTERING_GATK { filtered_vcf = FILTERVARIANTTRANCHES.out.vcf // remove no longer necessary field: num_intervals - .map{ meta, vcf -> [ meta - meta.subMap('num_intervals'), vcf ] } + .map{ meta, vcf_ -> [ meta - meta.subMap('num_intervals'), vcf_ ] } versions = versions.mix(CNNSCOREVARIANTS.out.versions) versions = versions.mix(FILTERVARIANTTRANCHES.out.versions) diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/main.nf b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf index 0fcbf7b3f2..d6e593e852 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/main.nf +++ b/subworkflows/nf-core/utils_nextflow_pipeline/main.nf @@ -92,10 +92,12 @@ def checkCondaChannels() { channels = config.channels } catch (NullPointerException e) { + log.debug(e) log.warn("Could not verify conda channel configuration.") return null } catch (IOException e) { + log.debug(e) log.warn("Could not verify conda channel configuration.") return null } diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test index ca964ce8e1..02dbf094cd 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test @@ -52,10 +52,12 @@ nextflow_workflow { } then { - assertAll( - { assert workflow.success }, - { assert workflow.stdout.contains("nextflow_workflow v9.9.9") } - ) + expect { + with(workflow) { + assert success + assert "nextflow_workflow v9.9.9" in stdout + } + } } } diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml deleted file mode 100644 index f84761125a..0000000000 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -subworkflows/utils_nextflow_pipeline: - - subworkflows/nf-core/utils_nextflow_pipeline/** diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf index 5cb7bafef3..bfd258760d 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/main.nf +++ b/subworkflows/nf-core/utils_nfcore_pipeline/main.nf @@ -56,21 +56,6 @@ def checkProfileProvided(nextflow_cli_args) { } } -// -// Citation string for pipeline -// -def workflowCitation() { - def temp_doi_ref = "" - def manifest_doi = workflow.manifest.doi.tokenize(",") - // Handling multiple DOIs - // Removing `https://doi.org/` to handle pipelines using DOIs vs DOI resolvers - // Removing ` ` since the manifest.doi is a string and not a proper list - manifest_doi.each { doi_ref -> - temp_doi_ref += " https://doi.org/${doi_ref.replace('https://doi.org/', '').replace(' ', '')}\n" - } - return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" + "* The pipeline\n" + temp_doi_ref + "\n" + "* The nf-core framework\n" + " https://doi.org/10.1038/s41587-020-0439-x\n\n" + "* Software dependencies\n" + " https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md" -} - // // Generate workflow version string // @@ -150,33 +135,6 @@ def paramsSummaryMultiqc(summary_params) { return yaml_file_text } -// -// nf-core logo -// -def nfCoreLogo(monochrome_logs=true) { - def colors = logColours(monochrome_logs) as Map - String.format( - """\n - ${dashedLine(monochrome_logs)} - ${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} - ${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} - ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} - ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} - ${colors.green}`._,._,\'${colors.reset} - ${colors.purple} ${workflow.manifest.name} ${getWorkflowVersion()}${colors.reset} - ${dashedLine(monochrome_logs)} - """.stripIndent() - ) -} - -// -// Return dashed line -// -def dashedLine(monochrome_logs=true) { - def colors = logColours(monochrome_logs) as Map - return "-${colors.dim}----------------------------------------------------${colors.reset}-" -} - // // ANSII colours used for terminal logging // @@ -245,28 +203,24 @@ def logColours(monochrome_logs=true) { return colorcodes } -// -// Attach the multiqc report to email -// -def attachMultiqcReport(multiqc_report) { - def mqc_report = null - try { - if (workflow.success) { - mqc_report = multiqc_report.getVal() - if (mqc_report.getClass() == ArrayList && mqc_report.size() >= 1) { - if (mqc_report.size() > 1) { - log.warn("[${workflow.manifest.name}] Found multiple reports from process 'MULTIQC', will use only one") - } - mqc_report = mqc_report[0] - } +// Return a single report from an object that may be a Path or List +// +def getSingleReport(multiqc_reports) { + if (multiqc_reports instanceof Path) { + return multiqc_reports + } else if (multiqc_reports instanceof List) { + if (multiqc_reports.size() == 0) { + log.warn("[${workflow.manifest.name}] No reports found from process 'MULTIQC'") + return null + } else if (multiqc_reports.size() == 1) { + return multiqc_reports.first() + } else { + log.warn("[${workflow.manifest.name}] Found multiple reports from process 'MULTIQC', will use only one") + return multiqc_reports.first() } + } else { + return null } - catch (Exception all) { - if (multiqc_report) { - log.warn("[${workflow.manifest.name}] Could not attach MultiQC report to summary email") - } - } - return mqc_report } // @@ -320,7 +274,7 @@ def completionEmail(summary_params, email, email_on_fail, plaintext_email, outdi email_fields['summary'] = summary << misc_fields // On success try attach the multiqc report - def mqc_report = attachMultiqcReport(multiqc_report) + def mqc_report = getSingleReport(multiqc_report) // Check if we are only sending emails on failure def email_address = email @@ -340,7 +294,7 @@ def completionEmail(summary_params, email, email_on_fail, plaintext_email, outdi def email_html = html_template.toString() // Render the sendmail template - def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as nextflow.util.MemoryUnit + def max_multiqc_email_size = (params.containsKey('max_multiqc_email_size') ? params.max_multiqc_email_size : 0) as MemoryUnit def smail_fields = [email: email_address, subject: subject, email_txt: email_txt, email_html: email_html, projectDir: "${workflow.projectDir}", mqcFile: mqc_report, mqcMaxSize: max_multiqc_email_size.toBytes()] def sf = new File("${workflow.projectDir}/assets/sendmail_template.txt") def sendmail_template = engine.createTemplate(sf).make(smail_fields) @@ -351,14 +305,17 @@ def completionEmail(summary_params, email, email_on_fail, plaintext_email, outdi if (email_address) { try { if (plaintext_email) { -new org.codehaus.groovy.GroovyException('Send plaintext e-mail, not HTML') } + new org.codehaus.groovy.GroovyException('Send plaintext e-mail, not HTML') + } // Try to send HTML e-mail using sendmail def sendmail_tf = new File(workflow.launchDir.toString(), ".sendmail_tmp.html") sendmail_tf.withWriter { w -> w << sendmail_html } ['sendmail', '-t'].execute() << sendmail_html log.info("-${colors.purple}[${workflow.manifest.name}]${colors.green} Sent summary e-mail to ${email_address} (sendmail)-") } - catch (Exception all) { + catch (Exception msg) { + log.debug(msg.toString()) + log.debug("Trying with mail instead of sendmail") // Catch failures and try with plaintext def mail_cmd = ['mail', '-s', subject, '--content-type=text/html', email_address] mail_cmd.execute() << email_html diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test index 1dc317f8f7..f117040cbd 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test @@ -41,26 +41,14 @@ nextflow_function { } } - test("Test Function workflowCitation") { - - function "workflowCitation" - - then { - assertAll( - { assert function.success }, - { assert snapshot(function.result).match() } - ) - } - } - - test("Test Function nfCoreLogo") { + test("Test Function without logColours") { - function "nfCoreLogo" + function "logColours" when { function { """ - input[0] = false + input[0] = true """ } } @@ -73,9 +61,8 @@ nextflow_function { } } - test("Test Function dashedLine") { - - function "dashedLine" + test("Test Function with logColours") { + function "logColours" when { function { @@ -93,14 +80,13 @@ nextflow_function { } } - test("Test Function without logColours") { - - function "logColours" + test("Test Function getSingleReport with a single file") { + function "getSingleReport" when { function { """ - input[0] = true + input[0] = file(params.modules_testdata_base_path + '/generic/tsv/test.tsv', checkIfExists: true) """ } } @@ -108,18 +94,22 @@ nextflow_function { then { assertAll( { assert function.success }, - { assert snapshot(function.result).match() } + { assert function.result.contains("test.tsv") } ) } } - test("Test Function with logColours") { - function "logColours" + test("Test Function getSingleReport with multiple files") { + function "getSingleReport" when { function { """ - input[0] = false + input[0] = [ + file(params.modules_testdata_base_path + '/generic/tsv/test.tsv', checkIfExists: true), + file(params.modules_testdata_base_path + '/generic/tsv/network.tsv', checkIfExists: true), + file(params.modules_testdata_base_path + '/generic/tsv/expression.tsv', checkIfExists: true) + ] """ } } @@ -127,7 +117,9 @@ nextflow_function { then { assertAll( { assert function.success }, - { assert snapshot(function.result).match() } + { assert function.result.contains("test.tsv") }, + { assert !function.result.contains("network.tsv") }, + { assert !function.result.contains("expression.tsv") } ) } } diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap index 1037232c9e..02c6701413 100644 --- a/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap +++ b/subworkflows/nf-core/utils_nfcore_pipeline/tests/main.function.nf.test.snap @@ -17,26 +17,6 @@ }, "timestamp": "2024-02-28T12:02:59.729647" }, - "Test Function nfCoreLogo": { - "content": [ - "\n\n-\u001b[2m----------------------------------------------------\u001b[0m-\n \u001b[0;32m,--.\u001b[0;30m/\u001b[0;32m,-.\u001b[0m\n\u001b[0;34m ___ __ __ __ ___ \u001b[0;32m/,-._.--~'\u001b[0m\n\u001b[0;34m |\\ | |__ __ / ` / \\ |__) |__ \u001b[0;33m} {\u001b[0m\n\u001b[0;34m | \\| | \\__, \\__/ | \\ |___ \u001b[0;32m\\`-._,-`-,\u001b[0m\n \u001b[0;32m`._,._,'\u001b[0m\n\u001b[0;35m nextflow_workflow v9.9.9\u001b[0m\n-\u001b[2m----------------------------------------------------\u001b[0m-\n" - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-02-28T12:03:10.562934" - }, - "Test Function workflowCitation": { - "content": [ - "If you use nextflow_workflow for your analysis please cite:\n\n* The pipeline\n https://doi.org/10.5281/zenodo.5070524\n\n* The nf-core framework\n https://doi.org/10.1038/s41587-020-0439-x\n\n* Software dependencies\n https://github.com/nextflow_workflow/blob/master/CITATIONS.md" - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-02-28T12:03:07.019761" - }, "Test Function without logColours": { "content": [ { @@ -95,16 +75,6 @@ }, "timestamp": "2024-02-28T12:03:17.969323" }, - "Test Function dashedLine": { - "content": [ - "-\u001b[2m----------------------------------------------------\u001b[0m-" - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-02-28T12:03:14.366181" - }, "Test Function with logColours": { "content": [ { diff --git a/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml b/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml deleted file mode 100644 index ac8523c9a2..0000000000 --- a/subworkflows/nf-core/utils_nfcore_pipeline/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -subworkflows/utils_nfcore_pipeline: - - subworkflows/nf-core/utils_nfcore_pipeline/** From ab61b4e076aed9f540e51757fdc34a29cfeeb7a3 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Fri, 30 May 2025 19:59:13 +0200 Subject: [PATCH 2/2] fix trace suffix param --- nextflow.config | 2 +- nextflow_schema.json | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nextflow.config b/nextflow.config index f6039a904b..1408984e0f 100644 --- a/nextflow.config +++ b/nextflow.config @@ -366,7 +366,7 @@ prov { enabled = true formats { bco { - file = "${params.outdir}/pipeline_info/manifest_${trace_timestamp}.bco.json" + file = "${params.outdir}/pipeline_info/manifest_${params.trace_report_suffix}.bco.json" } } } diff --git a/nextflow_schema.json b/nextflow_schema.json index 0255d76668..fa2ffbd4cb 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -1085,6 +1085,12 @@ "description": "Base URL or local path to location of pipeline test dataset files", "default": "https://raw.githubusercontent.com/nf-core/test-datasets/", "hidden": true + }, + "trace_report_suffix": { + "type": "string", + "fa_icon": "far calendar", + "description": "Suffix to add to the trace report filename. Default is the date and time in the format yyyy-MM-dd_HH-mm-ss.", + "hidden": true } } }