From 2678803720da857f4db639b4d182157db080dbf6 Mon Sep 17 00:00:00 2001 From: louis Date: Tue, 3 Feb 2026 09:24:49 +0100 Subject: [PATCH 01/19] Create sbwf --- .../main.nf | 104 ++++++++++++++++ .../meta.yml | 88 +++++++++++++ .../tests/main.nf.test | 116 ++++++++++++++++++ .../tests/main.nf.test.snap | 94 ++++++++++++++ .../tests/nextflow.config | 34 +++++ 5 files changed, 436 insertions(+) create mode 100644 subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf create mode 100644 subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml create mode 100644 subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test create mode 100644 subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap create mode 100644 subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf new file mode 100644 index 000000000000..3111ebc23ba9 --- /dev/null +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -0,0 +1,104 @@ +include { BCFTOOLS_MPILEUP } from '../../../modules/nf-core/bcftools/mpileup' +include { BCFTOOLS_MERGE } from '../../../modules/nf-core/bcftools/merge' +include { BCFTOOLS_ANNOTATE } from '../../../modules/nf-core/bcftools/annotate' + +workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { + + take: + ch_bam // channel: [ [id], bam, bai ] + ch_posfile // channel: [ [panel_id, chr], posfile_comma] + ch_fasta // channel: [ [genome], fasta, fai] + merge_key // val : [ "id" ] + + main: + ch_versions = channel.empty() + ch_multiqc_files = channel.empty() + + ch_mpileup = ch_bam + .combine(ch_posfile) + .map{metaI, bam, _bai, metaPC, tsv -> + [metaI + metaPC, bam, tsv] + } + + BCFTOOLS_MPILEUP( + ch_mpileup, + ch_fasta, + false + ) + ch_versions = ch_versions.mix(BCFTOOLS_MPILEUP.out.versions.first()) + ch_multiqc_files = ch_multiqc_files.mix(BCFTOOLS_MPILEUP.out.stats.map{ it -> it[1] }) + + // Branch depending on number of files + ch_all_vcf = BCFTOOLS_MPILEUP.out.vcf + .join(BCFTOOLS_MPILEUP.out.tbi) + .map{ metaIPC, vcf, tbi -> // Get all keys except merge_key + def groupKeys = metaIPC.keySet().findAll { it != merge_key } + def groupMeta = metaIPC.subMap(groupKeys) + [groupMeta, [metaIPC, vcf, tbi]] + } + .groupTuple(sort: { it1, it2 -> it1[0][merge_key] <=> it2[0][merge_key] }) // Sort by id + .map{ metaPC, filestups -> + // Create new meta with merge_key set to merged_value + def newMeta = metaPC + [(merge_key): merged_value, metas: filestups.collect{it -> it[0]}] + [ + newMeta, + filestups.collect{it -> it[1]}, + filestups.collect{it -> it[2]}, + filestups.collect{it -> it[1]}.size() + ] + } // Compute number of records + .branch{it -> + one: it[3] == 1 + more: it[3] > 1 + } + + // Merge VCFs all individuals + BCFTOOLS_MERGE( + ch_all_vcf.more.map{it -> [it[0], it[1], it[2], []] }, + ch_fasta + ) + ch_versions = ch_versions.mix(BCFTOOLS_MERGE.out.versions.first()) + + // Mix all vcfs + ch_to_concat = ch_all_vcf.one + .map{it -> [it[0]["metas"][0], it[1][0], it[2][0]] } + .mix( + BCFTOOLS_MERGE.out.vcf + .join(BCFTOOLS_MERGE.out.tbi.mix( + BCFTOOLS_MERGE.out.csi + )) + ) + + // Mix all vcfs + ch_to_concat = ch_all_vcf.one + .map{it -> [it[0]["metas"][0], it[1][0], it[2][0]] } + .mix( + BCFTOOLS_MERGE.out.vcf + .join(BCFTOOLS_MERGE.out.tbi.mix( + BCFTOOLS_MERGE.out.csi + )) + ) + + // Merge all chromosomes + VCF_CONCATENATE_BCFTOOLS(ch_to_concat) + ch_versions = ch_versions.mix(VCF_CONCATENATE_BCFTOOLS.out.versions.first()) + + // Annotate the variants + BCFTOOLS_ANNOTATE(VCF_CONCATENATE_BCFTOOLS.out.vcf_index + .combine(channel.of([[], [], [], []])) + ) + ch_versions = ch_versions.mix(BCFTOOLS_ANNOTATE.out.versions.first()) + + // Output + ch_output = BCFTOOLS_ANNOTATE.out.vcf + .join(BCFTOOLS_ANNOTATE.out.tbi.mix( + BCFTOOLS_ANNOTATE.out.csi + )) + .map{ metaIPC, vcf, index -> [metaIPC + [ variantcaller:'bcftools' ], vcf, index] } + + + emit: + vcf_index = ch_output // channel: [ [id, panel], vcf, index ] + versions = ch_versions // channel: [ versions.yml ] + multiqc_files = ch_multiqc_files +} diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml new file mode 100644 index 000000000000..2456977ed977 --- /dev/null +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml @@ -0,0 +1,88 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "BAM_GL_BCFTOOLS" +description: | + Subworkflow to compute genotype likelihoods from BAM files using + bcftools/mpileup and bcftools/call variants using bcftools call + by chromosomes. + The resulting VCF files are then merged by chromosomes and + annotated with bcftools/annotate to give an ID for each variants. +keywords: + - BAM + - genotype likelihoods + - bcftools +components: + - gawk + - tabix/bgzip + - bcftools/mpileup + - bcftools/merge + - bcftools/annotate +input: + - ch_bam: + description: Channel with input data + structure: + - meta: + type: map + description: Metadata map + - bam: + type: file + description: Input BAM file + pattern: "*.bam" + - index: + type: file + description: Input BAM index file + pattern: "*.{bai,csi}" + - ch_posfile: + description: Channel with position to call variants by chromosomes + structure: + - meta: + type: map + description: | + Metadata map that will be combined with the input data map + Need to have the "chr" as chromosome name and "panel_id" as panel name + - legend: + type: file + description: Region to extract from the BAM file + pattern: "*.legend[.gz]+" + - ch_fasta: + description: Channel with reference genome data + structure: + - meta: + type: map + description: Metadata map + - fasta: + type: file + description: FASTA file of the reference genome + pattern: "*.fa[sta]+" + - fai: + type: file + description: FASTA index file of the reference genome + pattern: "*.fai" +output: + - vcf_tbi: + description: Channel with one VCF files by chromosomes + structure: + - meta: + type: map + description: | + Metadata map combined with the ch_posfile data map. + - vcf: + type: file + description: VCF file with all individuals merged by chromosomes + pattern: "*.{vcf,bcf,vcf.gz}" + - index: + type: file + description: VCF index file + pattern: "*.{tbi,csi}" + - versions: + description: Channel containing software versions file + structure: + - versions.yml: + type: file + description: File containing versions of the software used + - multiqc_files: + description: Channel containing stat files of bcftools mpileup and call + type: file +authors: + - "@louislenezet" +maintainers: + - "@louislenezet" diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test new file mode 100644 index 000000000000..23ba335edd3b --- /dev/null +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -0,0 +1,116 @@ +nextflow_workflow { + + name "Test Subworkflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS" + script "../main.nf" + config "./nextflow.config" + + workflow "BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS" + + tag "subworkflows" + tag "subworkflows_local" + tag "subworkflows/bam_variant_calling_mpileup_bcftools" + tag "bam_variant_calling_mpileup_bcftools" + + tag "gawk" + tag "tabix" + tag "tabix/bgzip" + tag "bcftools" + tag "bcftools/mpileup" + tag "bcftools/annotate" + + test("Compute genotype likelihood with merging and two chromosomes") { + when { + workflow { + """ + input[0] = channel.fromList([ + [ + [id: "NA12878"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + ], + [ + [id: "NA19401"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), + ], + ]) + input[1] = channel.of( + [ + [panel_id: "1000GP", chr: "22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) + ], + [ + [panel_id: "1000GP", chr: "21"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.posfile", checkIfExist:true) + ]) + input[2] = channel.of([ + [id: "GRCh38"], + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + ]).collect() + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_index.collect{ + path(it[1]).vcf.summary + }, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + + test("Compute genotype likelihood with only one input") { + when { + workflow { + """ + input[0] = channel.fromList([ + [ + [id: "NA12878"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + ], + ]) + input[1] = channel.of([ + [panel_id: "1000GP", chr: "22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) + ]).collect() + input[2] = channel.of([ + [id: "GRCh38"], + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + ]).collect() + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.versions, + workflow.out.vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString() + ] }, + workflow.out.vcf_index.collect{ + path(it[1]).vcf.summary + }, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap new file mode 100644 index 000000000000..a4b6a42ebfd1 --- /dev/null +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -0,0 +1,94 @@ +{ + "Compute genotype likelihood with merging and two chromosomes": { + "content": [ + [ + "versions.yml:md5,3b0fee3aa670345abd0d2f9058050d65", + "versions.yml:md5,5c1d0190110ff1887f49323dec613345", + "versions.yml:md5,627428fc0c462d764ef59f3f58cb4202", + "versions.yml:md5,85e298b4e9dd35ea49f5696b117f759b" + ], + [ + [ + { + "id": "all", + "panel_id": "1000GP", + "chr": "all", + "variantcaller": "bcftools" + }, + "all_all.annotate.vcf.gz", + "all_all.annotate.vcf.gz.tbi" + ] + ], + [ + "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=false, phasedAutodetect=false]" + ], + [ + { + "BAM_GL_BCFTOOLS:BCFTOOLS_ANNOTATE": { + "bcftools": 1.21 + } + }, + { + "BAM_GL_BCFTOOLS:BCFTOOLS_MERGE": { + "bcftools": 1.21 + } + }, + { + "BAM_GL_BCFTOOLS:BCFTOOLS_MPILEUP": { + "bcftools": 1.21 + } + }, + { + "BAM_GL_BCFTOOLS:VCF_CONCATENATE_BCFTOOLS:BCFTOOLS_CONCAT": { + "bcftools": 1.21 + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-20T17:05:10.755124761" + }, + "Compute genotype likelihood with only one input": { + "content": [ + [ + "versions.yml:md5,3b0fee3aa670345abd0d2f9058050d65", + "versions.yml:md5,627428fc0c462d764ef59f3f58cb4202" + ], + [ + [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "all", + "variantcaller": "bcftools" + }, + "NA12878_all.annotate.vcf.gz", + "NA12878_all.annotate.vcf.gz.tbi" + ] + ], + [ + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" + ], + [ + { + "BAM_GL_BCFTOOLS:BCFTOOLS_ANNOTATE": { + "bcftools": 1.21 + } + }, + { + "BAM_GL_BCFTOOLS:BCFTOOLS_MPILEUP": { + "bcftools": 1.21 + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-20T17:50:42.161993968" + } +} diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config new file mode 100644 index 000000000000..85c39264ec5c --- /dev/null +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config @@ -0,0 +1,34 @@ +process { + + resourceLimits = [ + cpus: 4, + memory: '2.GB', + time: '6.h' + ] + + withName: GAWK { + ext.args2 = "'NR>1 { split(\$1, a, \"[:-_]\"); print a[1], \$2, \$3 \",\" \$4 }'" + ext.suffix = "txt" + } + + withName: BCFTOOLS_MPILEUP { + ext.args = "-I -E -a 'FORMAT/DP'" + ext.args2 = "-Aim -C alleles" + ext.prefix = { "${meta.id}_${meta.chr}" } + } + + withName: BCFTOOLS_MERGE { + ext.args = "--write-index=tbi" + ext.prefix = { "${meta.id}_${meta.chr}" } + } + + withName: BCFTOOLS_CONCAT { + ext.args = ["--ligate", "-Oz", "--write-index=tbi"].join(' ') + ext.prefix = { "${meta.id}_${meta.chr}.concat" } + } + + withName: BCFTOOLS_ANNOTATE { + ext.args = ["--set-id '%CHROM:%POS:%REF:%ALT'", "-Oz", "--write-index=tbi"].join(' ') + ext.prefix = { "${meta.id}_${meta.chr}.annotate" } + } +} From 343dbc8416c4788301c9cc592e2f7f9517a88663 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 13:01:31 +0100 Subject: [PATCH 02/19] Fix sbwf --- .../main.nf | 102 +++++++------ .../tests/main.nf.test | 138 +++++++++++------- 2 files changed, 142 insertions(+), 98 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index 3111ebc23ba9..e61f9c94a83f 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -1,17 +1,21 @@ include { BCFTOOLS_MPILEUP } from '../../../modules/nf-core/bcftools/mpileup' include { BCFTOOLS_MERGE } from '../../../modules/nf-core/bcftools/merge' include { BCFTOOLS_ANNOTATE } from '../../../modules/nf-core/bcftools/annotate' +include { VCF_GATHER_BCFTOOLS } from '../../../subworkflows/nf-core/vcf_gather_bcftools' workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { take: - ch_bam // channel: [ [id], bam, bai ] - ch_posfile // channel: [ [panel_id, chr], posfile_comma] - ch_fasta // channel: [ [genome], fasta, fai] - merge_key // val : [ "id" ] + ch_bam // channel: [ [id], bam, bai ] + ch_posfile // channel: [ [panel_id, chr], posfile_comma] + ch_fasta // channel: [ [genome], fasta, fai ] + meta_sample_merge_key // val : [ "id" ] + meta_sample_merge_value // val : [ "all_samples" ] + meta_region_gather_keys // val : [ "panel_id", "id" ] + sort_region_gather // val : boolean + annotate // val : boolean main: - ch_versions = channel.empty() ch_multiqc_files = channel.empty() ch_mpileup = ch_bam @@ -20,58 +24,58 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { [metaI + metaPC, bam, tsv] } + def posfile_count = ch_posfile + .map{ _meta, posfile -> posfile} + .collect() + .map { posfile -> posfile.size() } + BCFTOOLS_MPILEUP( ch_mpileup, ch_fasta, false ) - ch_versions = ch_versions.mix(BCFTOOLS_MPILEUP.out.versions.first()) - ch_multiqc_files = ch_multiqc_files.mix(BCFTOOLS_MPILEUP.out.stats.map{ it -> it[1] }) + ch_multiqc_files = ch_multiqc_files.mix(BCFTOOLS_MPILEUP.out.stats.map{ _meta, stats -> stats }) // Branch depending on number of files ch_all_vcf = BCFTOOLS_MPILEUP.out.vcf .join(BCFTOOLS_MPILEUP.out.tbi) .map{ metaIPC, vcf, tbi -> // Get all keys except merge_key - def groupKeys = metaIPC.keySet().findAll { it != merge_key } + def groupKeys = metaIPC.keySet().findAll { key -> key != meta_sample_merge_key } def groupMeta = metaIPC.subMap(groupKeys) [groupMeta, [metaIPC, vcf, tbi]] } - .groupTuple(sort: { it1, it2 -> it1[0][merge_key] <=> it2[0][merge_key] }) // Sort by id + .groupTuple(sort: { it1, it2 -> it1[0][meta_sample_merge_key] <=> it2[0][meta_sample_merge_key] }) // Sort by id .map{ metaPC, filestups -> - // Create new meta with merge_key set to merged_value - def newMeta = metaPC + [(merge_key): merged_value, metas: filestups.collect{it -> it[0]}] + // Create new meta with meta_sample_merge_key set to meta_sample_merge_value + def newMeta = metaPC + [ + (meta_sample_merge_key): meta_sample_merge_value, + metas: filestups.collect{ meta, _vcf, _index -> meta } + ] [ newMeta, - filestups.collect{it -> it[1]}, - filestups.collect{it -> it[2]}, - filestups.collect{it -> it[1]}.size() + filestups.collect{_meta, vcf, _index -> vcf}, + filestups.collect{_meta, _vcf, index -> index}, + filestups.collect{_meta, vcf, _index -> vcf}.size() ] - } // Compute number of records - .branch{it -> - one: it[3] == 1 - more: it[3] > 1 + } + .branch{ _meta, _vcf, _index, size -> + one: size == 1 + more: size > 1 } // Merge VCFs all individuals BCFTOOLS_MERGE( - ch_all_vcf.more.map{it -> [it[0], it[1], it[2], []] }, + ch_all_vcf.more.map{ + meta, vcf_list, index_list, _size -> [ meta, vcf_list, index_list, [] ] + }, ch_fasta ) - ch_versions = ch_versions.mix(BCFTOOLS_MERGE.out.versions.first()) // Mix all vcfs ch_to_concat = ch_all_vcf.one - .map{it -> [it[0]["metas"][0], it[1][0], it[2][0]] } - .mix( - BCFTOOLS_MERGE.out.vcf - .join(BCFTOOLS_MERGE.out.tbi.mix( - BCFTOOLS_MERGE.out.csi - )) - ) - - // Mix all vcfs - ch_to_concat = ch_all_vcf.one - .map{it -> [it[0]["metas"][0], it[1][0], it[2][0]] } + .map{ meta, vcf_list, index_list, _size -> [ + meta, vcf_list[0], index_list[0] + ] } .mix( BCFTOOLS_MERGE.out.vcf .join(BCFTOOLS_MERGE.out.tbi.mix( @@ -80,25 +84,31 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ) // Merge all chromosomes - VCF_CONCATENATE_BCFTOOLS(ch_to_concat) - ch_versions = ch_versions.mix(VCF_CONCATENATE_BCFTOOLS.out.versions.first()) - - // Annotate the variants - BCFTOOLS_ANNOTATE(VCF_CONCATENATE_BCFTOOLS.out.vcf_index - .combine(channel.of([[], [], [], []])) + VCF_GATHER_BCFTOOLS( + ch_to_concat.combine(posfile_count), + meta_region_gather_keys, + sort_region_gather ) - ch_versions = ch_versions.mix(BCFTOOLS_ANNOTATE.out.versions.first()) - - // Output - ch_output = BCFTOOLS_ANNOTATE.out.vcf - .join(BCFTOOLS_ANNOTATE.out.tbi.mix( - BCFTOOLS_ANNOTATE.out.csi - )) - .map{ metaIPC, vcf, index -> [metaIPC + [ variantcaller:'bcftools' ], vcf, index] } + if (annotate) { + // Annotate the variants + BCFTOOLS_ANNOTATE(VCF_GATHER_BCFTOOLS.out.vcf_index + .combine(channel.of([[], [], [], []])) + ) + // Output + ch_output = BCFTOOLS_ANNOTATE.out.vcf + .join(BCFTOOLS_ANNOTATE.out.tbi.mix( + BCFTOOLS_ANNOTATE.out.csi + )) + } else { + // Output without annotation + ch_output = VCF_GATHER_BCFTOOLS.out.vcf_index + .join(VCF_GATHER_BCFTOOLS.out.tbi.mix( + VCF_GATHER_BCFTOOLS.out.csi + )) + } emit: vcf_index = ch_output // channel: [ [id, panel], vcf, index ] - versions = ch_versions // channel: [ versions.yml ] multiqc_files = ch_multiqc_files } diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test index 23ba335edd3b..3fc520174b1a 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -18,21 +18,19 @@ nextflow_workflow { tag "bcftools/mpileup" tag "bcftools/annotate" - test("Compute genotype likelihood with merging and two chromosomes") { + test("two individuals and two chromosomes, sort and annotate") { + tag "test" when { workflow { """ - input[0] = channel.fromList([ - [ - [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - ], - [ - [id: "NA19401"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), - ], + input[0] = channel.of([ + [id: "NA12878"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + ], [ + [id: "NA19401"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), ]) input[1] = channel.of( [ @@ -48,69 +46,105 @@ nextflow_workflow { file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), ]).collect() + input[3] = "id" + input[4] = "all_samples" + input[5] = ["panel_id", "id"] + input[6] = true + input[7] = true """ } } then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.versions, - workflow.out.vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString() - ] }, - workflow.out.vcf_index.collect{ - path(it[1]).vcf.summary - }, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) + assert workflow.success + assert snapshot( + workflow.out.vcf_index.collect{ meta, vcf, index -> [ + meta, + path(vcf).getFileName().toString(), + path(vcf).vcf.variantsMD5, + path(index).getFileName().toString() + ] }, + workflow.out.multiqc_files + ).match() } } - test("Compute genotype likelihood with only one input") { + test("One individual and one chromosome") { when { workflow { """ - input[0] = channel.fromList([ - [ - [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - ], + input[0] = channel.of([ + [id: "NA12878"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), ]) input[1] = channel.of([ - [panel_id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) - ]).collect() + [panel_id: "1000GP", chr: "22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) + ]) + input[2] = channel.of([ + [id: "GRCh38"], + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + ]).collect() + """ + } + } + + then { + assert workflow.success + assert snapshot( + workflow.out.vcf_index.collect{ meta, vcf, index -> [ + meta, + path(vcf).getFileName().toString(), + path(vcf).vcf.variantsMD5, + path(index).getFileName().toString() + ] }, + workflow.out.multiqc_files + ).match() + } + } + + test("One individual and two chromosomes") { + when { + workflow { + """ + input[0] = channel.of([ + [id: "NA12878"], + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + ]) + input[1] = channel.of([ + [panel_id: "1000GP", chr: "22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) + ],[ + [panel_id: "1000GP", chr: "21"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.posfile", checkIfExist:true) + ]) input[2] = channel.of([ [id: "GRCh38"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), ]).collect() + input[3] = "id" + input[4] = "all_samples" + input[5] = ["panel_id", "id"] + input[6] = true """ } } then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.versions, - workflow.out.vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString() - ] }, - workflow.out.vcf_index.collect{ - path(it[1]).vcf.summary - }, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) + assert workflow.success + assert snapshot( + workflow.out.vcf_index.collect{ meta, vcf, index -> [ + meta, + path(vcf).getFileName().toString(), + path(vcf).vcf.variantsMD5, + path(index).getFileName().toString() + ] }, + workflow.out.multiqc_files + ).match() } } } From 41748d9cace183e3598cc18452a9041e3b473b7f Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 13:28:33 +0100 Subject: [PATCH 03/19] Update merge --- modules/nf-core/bcftools/merge/main.nf | 6 +- modules/nf-core/bcftools/merge/meta.yml | 20 +- .../nf-core/bcftools/merge/tests/bcf.config | 3 - .../bcftools/merge/tests/bcf_gz.config | 3 - .../nf-core/bcftools/merge/tests/main.nf.test | 342 ++++++------------ .../bcftools/merge/tests/main.nf.test.snap | 141 -------- .../bcftools/merge/tests/nextflow.config | 2 +- .../bcftools/merge/tests/nextflow.gvcf.config | 5 - .../nf-core/bcftools/merge/tests/vcf.config | 3 - .../bcftools/merge/tests/vcf_gz.config | 3 - .../bcftools/merge/tests/vcf_gz_index.config | 3 - .../merge/tests/vcf_gz_index_csi.config | 3 - .../merge/tests/vcf_gz_index_tbi.config | 3 - 13 files changed, 123 insertions(+), 414 deletions(-) delete mode 100644 modules/nf-core/bcftools/merge/tests/bcf.config delete mode 100644 modules/nf-core/bcftools/merge/tests/bcf_gz.config delete mode 100644 modules/nf-core/bcftools/merge/tests/nextflow.gvcf.config delete mode 100644 modules/nf-core/bcftools/merge/tests/vcf.config delete mode 100644 modules/nf-core/bcftools/merge/tests/vcf_gz.config delete mode 100644 modules/nf-core/bcftools/merge/tests/vcf_gz_index.config delete mode 100644 modules/nf-core/bcftools/merge/tests/vcf_gz_index_csi.config delete mode 100644 modules/nf-core/bcftools/merge/tests/vcf_gz_index_tbi.config diff --git a/modules/nf-core/bcftools/merge/main.nf b/modules/nf-core/bcftools/merge/main.nf index 6c944151b6a1..f1acbd3da4b1 100644 --- a/modules/nf-core/bcftools/merge/main.nf +++ b/modules/nf-core/bcftools/merge/main.nf @@ -8,10 +8,8 @@ process BCFTOOLS_MERGE { : 'community.wave.seqera.io/library/bcftools_htslib:0a3fa2654b52006f'}" input: - tuple val(meta), path(vcfs), path(tbis) - tuple val(meta2), path(fasta) - tuple val(meta3), path(fai) - tuple val(meta4), path(bed) + tuple val(meta), path(vcfs), path(tbis), path(bed) + tuple val(meta2), path(fasta), path(fai) output: tuple val(meta), path("*.{bcf,vcf}{,.gz}"), emit: vcf diff --git a/modules/nf-core/bcftools/merge/meta.yml b/modules/nf-core/bcftools/merge/meta.yml index f66b688456e8..445e5c56be97 100644 --- a/modules/nf-core/bcftools/merge/meta.yml +++ b/modules/nf-core/bcftools/merge/meta.yml @@ -31,6 +31,11 @@ input: List containing the tbi index files corresponding to the vcfs input files e.g. [ 'file1.vcf.tbi', 'file2.vcf.tbi' ] ontologies: [] + - bed: + type: file + description: "(Optional) The bed regions to merge on" + pattern: "*.bed" + ontologies: [] - - meta2: type: map description: | @@ -42,27 +47,12 @@ input: FILE` parameter)" pattern: "*.{fasta,fa}" ontologies: [] - - - meta3: - type: map - description: | - Groovy Map containing reference information - e.g. [ id:'genome' ] - fai: type: file description: "(Optional) The fasta reference file index (only necessary for the `--gvcf FILE` parameter)" pattern: "*.fai" ontologies: [] - - - meta4: - type: map - description: | - Groovy Map containing bed information - e.g. [ id:'genome' ] - - bed: - type: file - description: "(Optional) The bed regions to merge on" - pattern: "*.bed" - ontologies: [] output: vcf: - - meta: diff --git a/modules/nf-core/bcftools/merge/tests/bcf.config b/modules/nf-core/bcftools/merge/tests/bcf.config deleted file mode 100644 index 4467d07d96a0..000000000000 --- a/modules/nf-core/bcftools/merge/tests/bcf.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = '--output-type u --no-version' -} diff --git a/modules/nf-core/bcftools/merge/tests/bcf_gz.config b/modules/nf-core/bcftools/merge/tests/bcf_gz.config deleted file mode 100644 index 280de8db094e..000000000000 --- a/modules/nf-core/bcftools/merge/tests/bcf_gz.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = '--output-type b --no-version' -} diff --git a/modules/nf-core/bcftools/merge/tests/main.nf.test b/modules/nf-core/bcftools/merge/tests/main.nf.test index e863f1816beb..3a1f12206b17 100644 --- a/modules/nf-core/bcftools/merge/tests/main.nf.test +++ b/modules/nf-core/bcftools/merge/tests/main.nf.test @@ -2,6 +2,8 @@ nextflow_process { name "Test Process BCFTOOLS_MERGE" script "../main.nf" + config "./nextflow.config" + process "BCFTOOLS_MERGE" tag "modules" @@ -11,9 +13,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], []") { - config "./nextflow.config" - when { + params { + args_modules = "--force-samples --force-single --no-version" + } process { """ input[0] = [ @@ -25,11 +28,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -48,9 +50,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf output") { - config "./vcf.config" - when { + params { + args_modules = "--output-type v --no-version" + } process { """ input[0] = [ @@ -62,11 +65,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -85,9 +87,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output") { - config "./vcf_gz.config" - when { + params { + args_modules = "--output-type z --no-version" + } process { """ input[0] = [ @@ -99,11 +102,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -122,9 +124,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - bcf output") { - config "./bcf.config" - when { + params { + args_modules = "--output-type u --no-version" + } process { """ input[0] = [ @@ -136,11 +139,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -159,9 +161,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - bcf.gz output") { - config "./bcf_gz.config" - when { + params { + args_modules = "--output-type b --no-version" + } process { """ input[0] = [ @@ -173,11 +176,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -196,9 +198,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - index") { - config "./vcf_gz_index.config" - when { + params { + args_modules = "--output-type z --write-index --no-version" + } process { """ input[0] = [ @@ -210,11 +213,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -235,10 +237,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - csi index") { - config "./vcf_gz_index_csi.config" - when { - + params { + args_modules = "--output-type z --write-index=csi --no-version" + } process { """ input[0] = [ @@ -250,11 +252,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -275,9 +276,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - tbi index") { - config "./vcf_gz_index_tbi.config" - when { + params { + args_modules = "--output-type z --write-index=tbi --no-version" + } process { """ input[0] = [ @@ -289,11 +291,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -314,9 +315,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], bed") { - config "./nextflow.config" - when { + params { + args_modules = "--force-samples --force-single --no-version" + } process { """ input[0] = [ @@ -328,14 +330,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] - ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) ] + ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) ] + input[1] = [[],[],[]] """ } } @@ -354,9 +352,10 @@ nextflow_process { test("homo_sapiens - [vcf, tbi], fasta, fai, bed - vcf.gz output") { - config "./nextflow.gvcf.config" - when { + params { + args_modules = "--force-samples --no-version --output-type z --gvcf genome.fasta" + } process { """ input[0] = [ @@ -368,20 +367,14 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz.tbi', checkIfExists: true), - ] + ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true) ] input[1] = [ [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ] - ] - input[2] = [ - [ id:'test' ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ], [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) ] ] - input[3] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true) ] - ] """ } } @@ -400,8 +393,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - one sample") { - config "./nextflow.config" when { + params { + args_modules = "--force-samples --force-single --no-version" + } process { """ input[0] = [ @@ -411,11 +406,10 @@ nextflow_process { ], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -435,9 +429,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - stub") { options "-stub" - config "./nextflow.config" when { + params { + args_modules = "--force-samples --force-single --no-version" + } process { """ input[0] = [ @@ -449,11 +445,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -470,9 +465,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf output - stub") { options "-stub" - config "./vcf.config" when { + params { + args_modules = "--output-type v --no-version" + } process { """ input[0] = [ @@ -484,11 +481,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -505,9 +501,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - stub") { options "-stub" - config "./vcf_gz.config" when { + params { + args_modules = "--output-type z --no-version" + } process { """ input[0] = [ @@ -519,11 +517,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -540,9 +537,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - bcf output - stub") { options "-stub" - config "./bcf.config" when { + params { + args_modules = "--output-type u --no-version" + } process { """ input[0] = [ @@ -554,11 +553,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -575,9 +573,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - bcf.gz output - stub") { options "-stub" - config "./bcf_gz.config" when { + params { + args_modules = "--output-type b --no-version" + } process { """ input[0] = [ @@ -589,11 +589,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -610,9 +609,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - index - stub") { options "-stub" - config "./vcf_gz_index.config" when { + params { + args_modules = "--output-type z --write-index --no-version" + } process { """ input[0] = [ @@ -624,11 +625,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -646,9 +646,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - csi index - stub") { options "-stub" - config "./vcf_gz_index_csi.config" when { + params { + args_modules = "--output-type z --write-index=csi --no-version" + } process { """ input[0] = [ @@ -660,11 +662,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] + ], + [] ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] + input[1] = [[],[],[]] """ } } @@ -682,45 +683,11 @@ nextflow_process { test("sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - tbi index - stub") { options "-stub" - config "./vcf_gz_index_tbi.config" when { - process { - """ - input[0] = [ - [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz', checkIfExists: true) - ], - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] - ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] - """ + params { + args_modules = "--output-type z --write-index=tbi --no-version" } - } - - then { - assertAll( - { assert process.success }, - { assert process.out.vcf.get(0).get(1).endsWith("vcf.gz") }, - { assert process.out.index.get(0).get(1).endsWith("tbi") }, - { assert snapshot(process.out).match() } - ) - } - } - - test("sarscov2 - [vcf, tbi], [], [], bed - stub") { - - options "-stub" - config "./nextflow.config" - - when { process { """ input[0] = [ @@ -732,57 +699,10 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test3.vcf.gz.tbi', checkIfExists: true), - ] - ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) ] - ] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert process.out.vcf.get(0).get(1).endsWith("vcf") }, - { assert snapshot(process.out).match() } - ) - } - } - - test("homo_sapiens - [vcf, tbi], fasta, fai, bed - vcf.gz output - stub") { - - options "-stub" - config "./nextflow.gvcf.config" - when { - process { - """ - input[0] = [ - [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true) ], - [ - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz.tbi', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz.tbi', checkIfExists: true), - ] - ] - input[1] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ] - ] - input[2] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true) ] - ] - input[3] = [ - [ id:'test' ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true) ] + [] ] + input[1] = [[],[],[]] """ } } @@ -791,39 +711,7 @@ nextflow_process { assertAll( { assert process.success }, { assert process.out.vcf.get(0).get(1).endsWith("vcf.gz") }, - { assert snapshot(process.out).match() } - ) - } - } - - test("sarscov2 - [vcf, tbi], [], [], [] - one sample - stub") { - - options "-stub" - config "./nextflow.config" - - when { - process { - """ - input[0] = [ - [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true) - ], - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) - ] - ] - input[1] = [[],[]] - input[2] = [[],[]] - input[3] = [[],[]] - """ - } - } - - then { - assertAll( - { assert process.success }, - { assert process.out.vcf.get(0).get(1).endsWith("vcf") }, + { assert process.out.index.get(0).get(1).endsWith("tbi") }, { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/bcftools/merge/tests/main.nf.test.snap b/modules/nf-core/bcftools/merge/tests/main.nf.test.snap index 8f925a8e2ae0..9dd0917830f7 100644 --- a/modules/nf-core/bcftools/merge/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/merge/tests/main.nf.test.snap @@ -351,53 +351,6 @@ }, "timestamp": "2026-01-20T12:04:22.660557224" }, - "sarscov2 - [vcf, tbi], [], [], bed - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - - ], - "2": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ], - "index": [ - - ], - "vcf": [ - [ - { - "id": "test" - }, - "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions_bcftools": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.2" - }, - "timestamp": "2026-01-20T12:06:42.799574825" - }, "sarscov2 - [vcf, tbi], [], [], [] - bcf output": { "content": [ "test.bcf", @@ -464,100 +417,6 @@ }, "timestamp": "2026-01-20T12:05:59.932077434" }, - "sarscov2 - [vcf, tbi], [], [], [] - one sample - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - - ], - "2": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ], - "index": [ - - ], - "vcf": [ - [ - { - "id": "test" - }, - "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions_bcftools": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.2" - }, - "timestamp": "2026-01-20T12:07:00.260709958" - }, - "homo_sapiens - [vcf, tbi], fasta, fai, bed - vcf.gz output - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "1": [ - - ], - "2": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ], - "index": [ - - ], - "vcf": [ - [ - { - "id": "test" - }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "versions_bcftools": [ - [ - "BCFTOOLS_MERGE", - "bcftools", - "1.22" - ] - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.2" - }, - "timestamp": "2026-01-20T12:06:52.181671234" - }, "sarscov2 - [vcf, tbi], [], [], [] - vcf.gz output - index": { "content": [ "e0de448dc8e712956a03ce68d79a0b3a", diff --git a/modules/nf-core/bcftools/merge/tests/nextflow.config b/modules/nf-core/bcftools/merge/tests/nextflow.config index c3f0b7159956..36f2fa1a506f 100644 --- a/modules/nf-core/bcftools/merge/tests/nextflow.config +++ b/modules/nf-core/bcftools/merge/tests/nextflow.config @@ -1,5 +1,5 @@ process { withName: BCFTOOLS_MERGE { - ext.args = '--force-samples --force-single --no-version' + ext.args = "${params.args_modules}" } } diff --git a/modules/nf-core/bcftools/merge/tests/nextflow.gvcf.config b/modules/nf-core/bcftools/merge/tests/nextflow.gvcf.config deleted file mode 100644 index 8c457b716dbe..000000000000 --- a/modules/nf-core/bcftools/merge/tests/nextflow.gvcf.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - withName: BCFTOOLS_MERGE { - ext.args = { "--force-samples --no-version --output-type z --gvcf $fasta" } - } -} diff --git a/modules/nf-core/bcftools/merge/tests/vcf.config b/modules/nf-core/bcftools/merge/tests/vcf.config deleted file mode 100644 index 759222e58ca7..000000000000 --- a/modules/nf-core/bcftools/merge/tests/vcf.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = '--output-type v --no-version' -} diff --git a/modules/nf-core/bcftools/merge/tests/vcf_gz.config b/modules/nf-core/bcftools/merge/tests/vcf_gz.config deleted file mode 100644 index 8b6ad8b4fdcf..000000000000 --- a/modules/nf-core/bcftools/merge/tests/vcf_gz.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = '--output-type z --no-version' -} diff --git a/modules/nf-core/bcftools/merge/tests/vcf_gz_index.config b/modules/nf-core/bcftools/merge/tests/vcf_gz_index.config deleted file mode 100644 index 9f1e9b1d8f2b..000000000000 --- a/modules/nf-core/bcftools/merge/tests/vcf_gz_index.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = "--output-type z --write-index --no-version" -} diff --git a/modules/nf-core/bcftools/merge/tests/vcf_gz_index_csi.config b/modules/nf-core/bcftools/merge/tests/vcf_gz_index_csi.config deleted file mode 100644 index 8308ee1aed4f..000000000000 --- a/modules/nf-core/bcftools/merge/tests/vcf_gz_index_csi.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = "--output-type z --write-index=csi --no-version" -} diff --git a/modules/nf-core/bcftools/merge/tests/vcf_gz_index_tbi.config b/modules/nf-core/bcftools/merge/tests/vcf_gz_index_tbi.config deleted file mode 100644 index 9be4075bc17b..000000000000 --- a/modules/nf-core/bcftools/merge/tests/vcf_gz_index_tbi.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - ext.args = "--output-type z --write-index=tbi --no-version" -} From 9c0f9fe9e37816af458b993c3cc166fb63cdc195 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 13:29:11 +0100 Subject: [PATCH 04/19] Update merge --- .../nf-core/vcf_extract_relate_somalier/tests/main.nf.test | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subworkflows/nf-core/vcf_extract_relate_somalier/tests/main.nf.test b/subworkflows/nf-core/vcf_extract_relate_somalier/tests/main.nf.test index 119fd7efffbc..fe71eda43c70 100644 --- a/subworkflows/nf-core/vcf_extract_relate_somalier/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_extract_relate_somalier/tests/main.nf.test @@ -210,11 +210,10 @@ nextflow_workflow { [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878_GIAB.chr21_22.vcf.gz.csi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi', checkIfExists: true) - ] + ], + [] ]) - input[1] = [[], []] - input[2] = [[], []] - input[3] = [[], []] + input[1] = [[], [], []] """ } } From b684b637f15697d450b0dbfafb80cb4aefd3544c Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 15:30:10 +0100 Subject: [PATCH 05/19] Update bcftools annotate --- modules/nf-core/bcftools/annotate/main.nf | 5 +- modules/nf-core/bcftools/annotate/meta.yml | 26 +-- .../bcftools/annotate/tests/bcf.config | 4 - .../bcftools/annotate/tests/main.nf.test | 158 +++++++++--------- .../bcftools/annotate/tests/main.nf.test.snap | 82 ++++----- .../bcftools/annotate/tests/nextflow.config | 4 + .../bcftools/annotate/tests/vcf.config | 4 - .../annotate/tests/vcf_gz_index.config | 4 - .../annotate/tests/vcf_gz_index_csi.config | 4 - .../annotate/tests/vcf_gz_index_tbi.config | 4 - 10 files changed, 138 insertions(+), 157 deletions(-) delete mode 100644 modules/nf-core/bcftools/annotate/tests/bcf.config create mode 100644 modules/nf-core/bcftools/annotate/tests/nextflow.config delete mode 100644 modules/nf-core/bcftools/annotate/tests/vcf.config delete mode 100644 modules/nf-core/bcftools/annotate/tests/vcf_gz_index.config delete mode 100644 modules/nf-core/bcftools/annotate/tests/vcf_gz_index_csi.config delete mode 100644 modules/nf-core/bcftools/annotate/tests/vcf_gz_index_tbi.config diff --git a/modules/nf-core/bcftools/annotate/main.nf b/modules/nf-core/bcftools/annotate/main.nf index 28964d2a72e4..18778cc2b0cb 100644 --- a/modules/nf-core/bcftools/annotate/main.nf +++ b/modules/nf-core/bcftools/annotate/main.nf @@ -8,10 +8,7 @@ process BCFTOOLS_ANNOTATE { : 'community.wave.seqera.io/library/bcftools_htslib:0a3fa2654b52006f'}" input: - tuple val(meta), path(input), path(index), path(annotations), path(annotations_index) - path columns - path header_lines - path rename_chrs + tuple val(meta), path(input), path(index), path(annotations), path(annotations_index), path(columns), path(header_lines), path(rename_chrs) output: tuple val(meta), path("${prefix}.${extension}"), emit: vcf diff --git a/modules/nf-core/bcftools/annotate/meta.yml b/modules/nf-core/bcftools/annotate/meta.yml index af8bcf84de80..863316616098 100644 --- a/modules/nf-core/bcftools/annotate/meta.yml +++ b/modules/nf-core/bcftools/annotate/meta.yml @@ -36,19 +36,19 @@ input: type: file description: Index of the annotations file ontologies: [] - - columns: - type: file - description: List of columns in the annotations file, one name per row - ontologies: [] - - header_lines: - type: file - description: Contains lines to append to the output VCF header - ontologies: [] - - rename_chrs: - type: file - description: Rename annotations according to this file containing "old_name new_name\n" - pairs separated by whitespaces, each on a separate line. - ontologies: [] + - columns: + type: file + description: List of columns in the annotations file, one name per row + ontologies: [] + - header_lines: + type: file + description: Contains lines to append to the output VCF header + ontologies: [] + - rename_chrs: + type: file + description: Rename annotations according to this file containing "old_name new_name\n" + pairs separated by whitespaces, each on a separate line. + ontologies: [] output: vcf: - - meta: diff --git a/modules/nf-core/bcftools/annotate/tests/bcf.config b/modules/nf-core/bcftools/annotate/tests/bcf.config deleted file mode 100644 index 79d26779da90..000000000000 --- a/modules/nf-core/bcftools/annotate/tests/bcf.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - ext.args = "-x ID,INFO/DP,FORMAT/DP --output-type u" - ext.prefix = { "${meta.id}_ann" } -} diff --git a/modules/nf-core/bcftools/annotate/tests/main.nf.test b/modules/nf-core/bcftools/annotate/tests/main.nf.test index 39010bdc323a..3e1d257338c1 100644 --- a/modules/nf-core/bcftools/annotate/tests/main.nf.test +++ b/modules/nf-core/bcftools/annotate/tests/main.nf.test @@ -2,6 +2,7 @@ nextflow_process { name "Test Process BCFTOOLS_ANNOTATE" script "../main.nf" + config "./nextflow.config" process "BCFTOOLS_ANNOTATE" tag "modules" @@ -11,9 +12,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_output") { - config "./vcf.config" - when { + params { + args_modules = "-x ID,INFO/DP,FORMAT/DP --output-type z" + } process { """ input[0] = [ @@ -21,11 +23,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -45,9 +45,10 @@ nextflow_process { test("sarscov2 - [vcf, [], annotation, annotation_tbi], [], [], [] - vcf_output") { - config "./vcf.config" - when { + params { + args_modules = "-x ID,INFO/DP,FORMAT/DP --output-type z" + } process { """ input[0] = [ @@ -55,11 +56,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), [], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -79,9 +78,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index") { - config "./vcf_gz_index.config" - when { + params { + args_modules = "--output-type z --write-index --no-version" + } process { """ input[0] = [ @@ -89,11 +89,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -113,9 +111,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_csi") { - config "./vcf_gz_index_csi.config" - when { + params { + args_modules = "--output-type z --write-index=csi --no-version" + } process { """ input[0] = [ @@ -123,11 +122,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -147,9 +144,10 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_tbi") { - config "./vcf_gz_index_tbi.config" - when { + params { + args_modules = "--output-type z --write-index=tbi --no-version" + } process { """ input[0] = [ @@ -157,11 +155,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -181,24 +177,26 @@ nextflow_process { test("sarscov2 - [vcf, [], annotation, annotation_tbi], [], header, [] - bcf_output") { - config "./bcf.config" - when { + params { + args_modules = "-x ID,INFO/DP,FORMAT/DP --output-type u" + } process { """ - input[0] = [ + header = channel.of( + '##INFO=', + '##INFO=' + ).collectFile(name:"headers.vcf", newLine:true) + input[0] = channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), [], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) - ] - input[1] = [] - input[2] = Channel.of( - '##INFO=', - '##INFO=' - ).collectFile(name:"headers.vcf", newLine:true) - input[3] = [] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [] + ]) + .combine(header) + .combine(channel.of([[]])) """ } } @@ -218,21 +216,21 @@ nextflow_process { test("sarscov2 - [vcf, [], annotation, annotation_tbi], columns, [], [] - bcf_output") { - config "./bcf.config" - when { + params { + args_modules = "-x ID,INFO/DP,FORMAT/DP --output-type u" + } process { """ - input[0] = [ + columns = channel.of('INFO/ICB', 'INFO/HOB', 'INFO/DP4').collectFile(name:"columns.txt", newLine:true) + input[0] = channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), [], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) - ] - input[1] = Channel.of('INFO/ICB', 'INFO/HOB', 'INFO/DP4').collectFile(name:"columns.txt", newLine:true) - input[2] = [] - input[3] = [] + ]).combine(columns) + .combine(channel.of([[], []])) """ } } @@ -252,24 +250,26 @@ nextflow_process { test("sarscov2 - [vcf, [], annotation, annotation_tbi], [], header, rename_chrs - vcf_gz_index") { - config "./vcf_gz_index.config" - when { + params { + args_modules = "--output-type z --write-index --no-version" + } process { """ - input[0] = [ + headers = channel.of( + '##INFO=', + '##INFO=' + ).collectFile(name:"headers.vcf", newLine:true) + rename = channel.of('MT192765.1 renamed').collectFile(name:"rename.txt", newLine:true) + input[0] = channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), [], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) - ] - input[1] = [] - input[2] = Channel.of( - '##INFO=', - '##INFO=' - ).collectFile(name:"headers.vcf", newLine:true) - input[3] = Channel.of('MT192765.1 renamed').collectFile(name:"rename.txt", newLine:true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [] + ]).combine(headers) + .combine(rename) """ } } @@ -289,10 +289,12 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - stub") { - config "./vcf.config" options "-stub" when { + params { + args_modules = "-x ID,INFO/DP,FORMAT/DP --output-type z" + } process { """ input[0] = [ @@ -300,11 +302,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -324,10 +324,12 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index - stub") { - config "./vcf_gz_index.config" options "-stub" when { + params { + args_modules = "--output-type z --write-index --no-version" + } process { """ input[0] = [ @@ -335,11 +337,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -359,10 +359,12 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_csi - stub") { - config "./vcf_gz_index_csi.config" options "-stub" when { + params { + args_modules = "--output-type z --write-index=csi --no-version" + } process { """ input[0] = [ @@ -370,11 +372,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } @@ -394,10 +394,12 @@ nextflow_process { test("sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_tbi - stub") { - config "./vcf_gz_index_tbi.config" options "-stub" when { + params { + args_modules = "--output-type z --write-index=tbi --no-version" + } process { """ input[0] = [ @@ -405,11 +407,9 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test2.vcf.gz.tbi', checkIfExists: true), + [], [], [] ] - input[1] = [] - input[2] = [] - input[3] = [] """ } } diff --git a/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap b/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap index 4d57dfbb1bf3..10af196a1857 100644 --- a/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/annotate/tests/main.nf.test.snap @@ -7,7 +7,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz" + "test_ann.vcf.gz" ] ], [ @@ -19,7 +19,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.csi" + "test_ann.vcf.gz.csi" ] ], { @@ -34,9 +34,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:46:28.350541494" + "timestamp": "2026-02-27T15:29:19.618749659" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_tbi": { "content": [ @@ -46,7 +46,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" + "test_ann.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" ] ], [ @@ -55,7 +55,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.tbi" + "test_ann.vcf.gz.tbi" ] ], [ @@ -73,9 +73,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T17:35:23.346991616" + "timestamp": "2026-02-27T15:28:43.350060834" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_csi": { "content": [ @@ -85,7 +85,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" + "test_ann.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" ] ], [ @@ -97,7 +97,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.csi" + "test_ann.vcf.gz.csi" ] ], { @@ -112,9 +112,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T17:35:15.126643898" + "timestamp": "2026-02-27T15:28:36.101003418" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_tbi - stub": { "content": [ @@ -124,7 +124,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz" + "test_ann.vcf.gz" ] ], [ @@ -133,7 +133,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.tbi" + "test_ann.vcf.gz.tbi" ] ], [ @@ -151,9 +151,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:46:46.844515012" + "timestamp": "2026-02-27T15:29:34.19449127" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index_csi - stub": { "content": [ @@ -163,7 +163,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz" + "test_ann.vcf.gz" ] ], [ @@ -175,7 +175,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.csi" + "test_ann.vcf.gz.csi" ] ], { @@ -190,9 +190,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:46:37.561478889" + "timestamp": "2026-02-27T15:29:26.927815399" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_gz_index": { "content": [ @@ -202,7 +202,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" + "test_ann.vcf.gz:variantsMD5,bc7bf3ee9e8430e064c539eb81e59bf9" ] ], [ @@ -214,7 +214,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.csi" + "test_ann.vcf.gz.csi" ] ], { @@ -229,9 +229,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T17:35:06.608740206" + "timestamp": "2026-02-27T15:28:28.891823681" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - stub": { "content": [ @@ -241,7 +241,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz" + "test_ann.vcf.gz" ] ], [ @@ -262,9 +262,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:46:18.623176402" + "timestamp": "2026-02-27T15:29:12.400301681" }, "sarscov2 - [vcf, [], annotation, annotation_tbi], [], header, [] - bcf_output": { "content": [ @@ -295,9 +295,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:57:59.109447684" + "timestamp": "2026-02-27T15:28:50.375384421" }, "sarscov2 - [vcf, [], annotation, annotation_tbi], [], [], [] - vcf_output": { "content": [ @@ -307,7 +307,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz:variantsMD5,250b64289ab9d48f76359d01699fdf7d" + "test_ann.vcf.gz:variantsMD5,250b64289ab9d48f76359d01699fdf7d" ] ], [ @@ -328,9 +328,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T17:34:58.100296619" + "timestamp": "2026-02-27T15:28:21.320211288" }, "sarscov2 - [vcf, tbi, annotation, annotation_tbi], [], [], [] - vcf_output": { "content": [ @@ -340,7 +340,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz:variantsMD5,250b64289ab9d48f76359d01699fdf7d" + "test_ann.vcf.gz:variantsMD5,250b64289ab9d48f76359d01699fdf7d" ] ], [ @@ -361,9 +361,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T17:34:49.49779004" + "timestamp": "2026-02-27T15:28:13.274072987" }, "sarscov2 - [vcf, [], annotation, annotation_tbi], [], header, rename_chrs - vcf_gz_index": { "content": [ @@ -373,7 +373,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz" + "test_ann.vcf.gz" ] ], [ @@ -385,7 +385,7 @@ "id": "test", "single_end": false }, - "test_vcf.vcf.gz.csi" + "test_ann.vcf.gz.csi" ] ], { @@ -400,9 +400,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:58:16.686295153" + "timestamp": "2026-02-27T15:29:05.094685409" }, "sarscov2 - [vcf, [], annotation, annotation_tbi], columns, [], [] - bcf_output": { "content": [ @@ -433,8 +433,8 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2026-01-15T16:58:07.908352766" + "timestamp": "2026-02-27T15:28:57.906382655" } } \ No newline at end of file diff --git a/modules/nf-core/bcftools/annotate/tests/nextflow.config b/modules/nf-core/bcftools/annotate/tests/nextflow.config new file mode 100644 index 000000000000..102351009b58 --- /dev/null +++ b/modules/nf-core/bcftools/annotate/tests/nextflow.config @@ -0,0 +1,4 @@ +process { + ext.args = "${params.args_modules}" + ext.prefix = { "${meta.id}_ann" } +} diff --git a/modules/nf-core/bcftools/annotate/tests/vcf.config b/modules/nf-core/bcftools/annotate/tests/vcf.config deleted file mode 100644 index 611868d55ca1..000000000000 --- a/modules/nf-core/bcftools/annotate/tests/vcf.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - ext.args = "-x ID,INFO/DP,FORMAT/DP --output-type z" - ext.prefix = { "${meta.id}_vcf" } -} diff --git a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index.config b/modules/nf-core/bcftools/annotate/tests/vcf_gz_index.config deleted file mode 100644 index 2fd9a225f03e..000000000000 --- a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - ext.args = "--output-type z --write-index --no-version" - ext.prefix = { "${meta.id}_vcf" } -} diff --git a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_csi.config b/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_csi.config deleted file mode 100644 index 512c1dfb0548..000000000000 --- a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_csi.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - ext.args = "--output-type z --write-index=csi --no-version" - ext.prefix = { "${meta.id}_vcf" } -} diff --git a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_tbi.config b/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_tbi.config deleted file mode 100644 index 7feb5ebbed38..000000000000 --- a/modules/nf-core/bcftools/annotate/tests/vcf_gz_index_tbi.config +++ /dev/null @@ -1,4 +0,0 @@ -process { - ext.args = "--output-type z --write-index=tbi --no-version" - ext.prefix = { "${meta.id}_vcf" } -} From 7900e479bc2b172a81bec027f35939260220006b Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 16:19:16 +0100 Subject: [PATCH 06/19] Update sbwf --- modules/nf-core/bcftools/mpileup/main.nf | 4 +- modules/nf-core/bcftools/mpileup/meta.yml | 5 + .../main.nf | 11 +- .../meta.yml | 56 ++++-- .../tests/main.nf.test | 122 +++++++++---- .../tests/main.nf.test.snap | 172 +++++++++++------- .../tests/nextflow.config | 16 +- 7 files changed, 250 insertions(+), 136 deletions(-) diff --git a/modules/nf-core/bcftools/mpileup/main.nf b/modules/nf-core/bcftools/mpileup/main.nf index 27fc67ce9dd9..487cebae99fb 100644 --- a/modules/nf-core/bcftools/mpileup/main.nf +++ b/modules/nf-core/bcftools/mpileup/main.nf @@ -9,7 +9,7 @@ process BCFTOOLS_MPILEUP { input: tuple val(meta), path(bam), path(intervals) - tuple val(meta2), path(fasta) + tuple val(meta2), path(fasta), path(fai) val save_mpileup output: @@ -40,7 +40,7 @@ process BCFTOOLS_MPILEUP { ${bam} \\ ${intervals_cmd} \\ ${mpileup} \\ - | bcftools call --output-type v ${args2} \\ + | bcftools call --output-type v ${args2} ${intervals_cmd} \\ | bcftools reheader --samples sample_name.list \\ | bcftools view --output-file ${prefix}.vcf.gz --output-type z ${args3} diff --git a/modules/nf-core/bcftools/mpileup/meta.yml b/modules/nf-core/bcftools/mpileup/meta.yml index b90ff762dbd0..32c6211d8dae 100644 --- a/modules/nf-core/bcftools/mpileup/meta.yml +++ b/modules/nf-core/bcftools/mpileup/meta.yml @@ -39,6 +39,11 @@ input: description: FASTA reference file pattern: "*.{fasta,fa}" ontologies: [] + - fai: + type: file + description: FASTA reference file index + pattern: "*.fai" + ontologies: [] - save_mpileup: type: boolean description: Save mpileup file generated by bcftools mpileup diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index e61f9c94a83f..6a7be664d29d 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -6,7 +6,7 @@ include { VCF_GATHER_BCFTOOLS } from '../../../subworkflows/nf-core workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { take: - ch_bam // channel: [ [id], bam, bai ] + ch_bam // channel: [ [id], bam, bai ] ch_posfile // channel: [ [panel_id, chr], posfile_comma] ch_fasta // channel: [ [genome], fasta, fai ] meta_sample_merge_key // val : [ "id" ] @@ -78,9 +78,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ] } .mix( BCFTOOLS_MERGE.out.vcf - .join(BCFTOOLS_MERGE.out.tbi.mix( - BCFTOOLS_MERGE.out.csi - )) + .join(BCFTOOLS_MERGE.out.index) ) // Merge all chromosomes @@ -93,7 +91,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { if (annotate) { // Annotate the variants BCFTOOLS_ANNOTATE(VCF_GATHER_BCFTOOLS.out.vcf_index - .combine(channel.of([[], [], [], []])) + .combine(channel.of([[], [], [], [], []])) ) // Output ch_output = BCFTOOLS_ANNOTATE.out.vcf @@ -103,9 +101,6 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { } else { // Output without annotation ch_output = VCF_GATHER_BCFTOOLS.out.vcf_index - .join(VCF_GATHER_BCFTOOLS.out.tbi.mix( - VCF_GATHER_BCFTOOLS.out.csi - )) } emit: diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml index 2456977ed977..c00f1f68fc80 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml @@ -1,11 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json -name: "BAM_GL_BCFTOOLS" +name: "BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS" description: | Subworkflow to compute genotype likelihoods from BAM files using - bcftools/mpileup and bcftools/call variants using bcftools call - by chromosomes. + bcftools/mpileup and bcftools/call variants by chromosomes. The resulting VCF files are then merged by chromosomes and annotated with bcftools/annotate to give an ID for each variants. + During samples merging and region concatenation, all metadata will + be preserved and stored in the key `metas` at each step. keywords: - BAM - genotype likelihoods @@ -16,6 +17,8 @@ components: - bcftools/mpileup - bcftools/merge - bcftools/annotate + - bcftools/concat + - vcf_gather_bcftools input: - ch_bam: description: Channel with input data @@ -38,11 +41,10 @@ input: type: map description: | Metadata map that will be combined with the input data map - Need to have the "chr" as chromosome name and "panel_id" as panel name - - legend: + - posfile: type: file - description: Region to extract from the BAM file - pattern: "*.legend[.gz]+" + description: Region to extract from the BAM file in the format + "CHR\tPOS\tREF,ALT" - ch_fasta: description: Channel with reference genome data structure: @@ -57,8 +59,37 @@ input: type: file description: FASTA index file of the reference genome pattern: "*.fai" + - meta_sample_merge_key: + type: list + description: | + List of keys that define the sample. + All file sharing the same values for these keys will be merged together. + e.g. [ "id" ] + - meta_sample_merge_value: + description: | + Shared value that will be set to `meta_sample_merge_key` for all samples to be merged together. + e.g. "all_samples" + - meta_region_gather_keys: + type: list + description: | + List of keys to be used to gather the VCF files by region with vcf_gather_bcftools. + All file sharing the same values for these keys will be gathered together. + e.g. [ "id", "panel_id" ] + - sort_region_gather: + type: boolean + description: | + Whether to sort the VCF files by region after concatenation with + vcf_gather_bcftools. + - annotate: + type: boolean + description: | + Whether to annotate the merged VCF file with bcftools/annotate to give + an ID for each variants output: - - vcf_tbi: + - multiqc_files: + description: Channel containing stat files of bcftools mpileup and call + type: file + - vcf_index: description: Channel with one VCF files by chromosomes structure: - meta: @@ -73,15 +104,6 @@ output: type: file description: VCF index file pattern: "*.{tbi,csi}" - - versions: - description: Channel containing software versions file - structure: - - versions.yml: - type: file - description: File containing versions of the software used - - multiqc_files: - description: Channel containing stat files of bcftools mpileup and call - type: file authors: - "@louislenezet" maintainers: diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test index 3fc520174b1a..27a24f0a6d1f 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -17,34 +17,49 @@ nextflow_workflow { tag "bcftools" tag "bcftools/mpileup" tag "bcftools/annotate" + tag "bcftools/merge" + tag "bcftools/concat" + + tag "subworkflows_nfcore" + tag "vcf_gather_bcftools" + + test("Two individuals and two chromosomes, sort and annotate") { + setup { // Change CHR\tPOS\tREF\tALT to CHR\tPOS\tREF,tALT + run("GAWK") { + script "../../../../modules/nf-core/gawk/main.nf" + process { + """ + input[0] = channel.of([ + [panel_id: "1000GP", chr: "22"], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + ], [ + [panel_id: "1000GP", chr: "21"], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExist:true) + ]) + input[1] = [] + input[2] = false + """ + } + } + } - test("two individuals and two chromosomes, sort and annotate") { - tag "test" when { workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), ], [ [id: "NA19401"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true), - ]) - input[1] = channel.of( - [ - [panel_id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) - ], - [ - [panel_id: "1000GP", chr: "21"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.posfile", checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam.bai', checkIfExist:true), ]) + input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), ]).collect() input[3] = "id" input[4] = "all_samples" @@ -61,6 +76,7 @@ nextflow_workflow { workflow.out.vcf_index.collect{ meta, vcf, index -> [ meta, path(vcf).getFileName().toString(), + path(vcf).vcf.summary, // Two individuals and 1739 variants path(vcf).vcf.variantsMD5, path(index).getFileName().toString() ] }, @@ -70,23 +86,40 @@ nextflow_workflow { } test("One individual and one chromosome") { + setup { + run("GAWK") { + script "../../../../modules/nf-core/gawk/main.nf" + process { + """ + input[0] = channel.of([ + [panel_id: "1000GP", chr: "22"], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + ]) + input[1] = [] + input[2] = false + """ + } + } + } when { workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - ]) - input[1] = channel.of([ - [panel_id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), ]) + input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), ]).collect() + input[3] = "id" + input[4] = "all_samples" + input[5] = ["panel_id", "id"] + input[6] = false + input[7] = false """ } } @@ -97,6 +130,7 @@ nextflow_workflow { workflow.out.vcf_index.collect{ meta, vcf, index -> [ meta, path(vcf).getFileName().toString(), + path(vcf).vcf.summary, // One individuals and 902 variants path(vcf).vcf.variantsMD5, path(index).getFileName().toString() ] }, @@ -106,30 +140,43 @@ nextflow_workflow { } test("One individual and two chromosomes") { + setup { + run("GAWK") { + script "../../../../modules/nf-core/gawk/main.nf" + process { + """ + input[0] = channel.of([ + [panel_id: "1000GP", chr: "22"], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + ], [ + [panel_id: "1000GP", chr: "21"], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExist:true) + ]) + input[1] = [] + input[2] = false + """ + } + } + } when { workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - ]) - input[1] = channel.of([ - [panel_id: "1000GP", chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.posfile", checkIfExist:true) - ],[ - [panel_id: "1000GP", chr: "21"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.posfile", checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), ]) + input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38.s.fa.gz.fai", checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), ]).collect() input[3] = "id" input[4] = "all_samples" input[5] = ["panel_id", "id"] - input[6] = true + input[6] = false + input[7] = false """ } } @@ -140,6 +187,7 @@ nextflow_workflow { workflow.out.vcf_index.collect{ meta, vcf, index -> [ meta, path(vcf).getFileName().toString(), + path(vcf).vcf.summary, // One individuals and 1737 variants path(vcf).vcf.variantsMD5, path(index).getFileName().toString() ] }, diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap index a4b6a42ebfd1..455809f7a605 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -1,94 +1,144 @@ { - "Compute genotype likelihood with merging and two chromosomes": { + "One individual and one chromosome": { "content": [ - [ - "versions.yml:md5,3b0fee3aa670345abd0d2f9058050d65", - "versions.yml:md5,5c1d0190110ff1887f49323dec613345", - "versions.yml:md5,627428fc0c462d764ef59f3f58cb4202", - "versions.yml:md5,85e298b4e9dd35ea49f5696b117f759b" - ], [ [ { - "id": "all", "panel_id": "1000GP", - "chr": "all", - "variantcaller": "bcftools" + "id": "all_samples", + "metas": [ + { + "chr": "22", + "metas": [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "22" + } + ] + } + ] }, - "all_all.annotate.vcf.gz", - "all_all.annotate.vcf.gz.tbi" + "NA12878_22.vcf.gz", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=902, phased=false, phasedAutodetect=false]", + "b852b1cae943360e00ab93004509808a", + "NA12878_22.vcf.gz.tbi" ] ], [ - "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=false, phasedAutodetect=false]" - ], - [ - { - "BAM_GL_BCFTOOLS:BCFTOOLS_ANNOTATE": { - "bcftools": 1.21 - } - }, - { - "BAM_GL_BCFTOOLS:BCFTOOLS_MERGE": { - "bcftools": 1.21 - } - }, - { - "BAM_GL_BCFTOOLS:BCFTOOLS_MPILEUP": { - "bcftools": 1.21 - } - }, - { - "BAM_GL_BCFTOOLS:VCF_CONCATENATE_BCFTOOLS:BCFTOOLS_CONCAT": { - "bcftools": 1.21 - } - } + "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10" ] ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.0" + "nextflow": "25.10.3" }, - "timestamp": "2025-12-20T17:05:10.755124761" + "timestamp": "2026-02-27T16:03:00.743836227" }, - "Compute genotype likelihood with only one input": { + "Two individuals and two chromosomes, sort and annotate": { "content": [ - [ - "versions.yml:md5,3b0fee3aa670345abd0d2f9058050d65", - "versions.yml:md5,627428fc0c462d764ef59f3f58cb4202" - ], [ [ { - "id": "NA12878", "panel_id": "1000GP", - "chr": "all", - "variantcaller": "bcftools" + "id": "all_samples", + "metas": [ + { + "chr": "21", + "metas": [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "21" + }, + { + "id": "NA19401", + "panel_id": "1000GP", + "chr": "21" + } + ] + }, + { + "chr": "22", + "metas": [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "22" + }, + { + "id": "NA19401", + "panel_id": "1000GP", + "chr": "22" + } + ] + } + ] }, - "NA12878_all.annotate.vcf.gz", - "NA12878_all.annotate.vcf.gz.tbi" + "all_samples_all_chr.annotate.vcf.gz", + "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1737, phased=false, phasedAutodetect=false]", + "96e0517b17306ab297c8ac87d753d4d9", + "all_samples_all_chr.annotate.vcf.gz.tbi" ] ], [ - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=false, phasedAutodetect=false]" + "NA12878_21.bcftools_stats.txt:md5,29f310e5ed86cc2d3f6f77eb5da2a7e0", + "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10", + "NA19401_21.bcftools_stats.txt:md5,16730f1e8df6e0446ed2779d87c98168", + "NA19401_22.bcftools_stats.txt:md5,e9b457859517dcfaf886335cbbe442b3" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.3" + }, + "timestamp": "2026-02-27T16:02:46.171730624" + }, + "One individual and two chromosomes": { + "content": [ + [ + [ + { + "panel_id": "1000GP", + "id": "all_samples", + "metas": [ + { + "chr": "22", + "metas": [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "22" + } + ] + }, + { + "chr": "21", + "metas": [ + { + "id": "NA12878", + "panel_id": "1000GP", + "chr": "21" + } + ] + } + ] + }, + "all_samples_all_chr.concat.vcf.gz", + "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1737, phased=false, phasedAutodetect=false]", + "2e125158b5531e9325cc00f004cebeeb", + "all_samples_all_chr.concat.vcf.gz.tbi" + ] ], [ - { - "BAM_GL_BCFTOOLS:BCFTOOLS_ANNOTATE": { - "bcftools": 1.21 - } - }, - { - "BAM_GL_BCFTOOLS:BCFTOOLS_MPILEUP": { - "bcftools": 1.21 - } - } + "NA12878_21.bcftools_stats.txt:md5,29f310e5ed86cc2d3f6f77eb5da2a7e0", + "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10" ] ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.0" + "nextflow": "25.10.3" }, - "timestamp": "2025-12-20T17:50:42.161993968" + "timestamp": "2026-02-27T16:03:17.799447553" } -} +} \ No newline at end of file diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config index 85c39264ec5c..fcf1ad2e65b1 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/nextflow.config @@ -1,13 +1,7 @@ process { - - resourceLimits = [ - cpus: 4, - memory: '2.GB', - time: '6.h' - ] - withName: GAWK { - ext.args2 = "'NR>1 { split(\$1, a, \"[:-_]\"); print a[1], \$2, \$3 \",\" \$4 }'" + ext.args2 = "'BEGIN { OFS=\"\\t\" } NR>1 { split(\$1, a, \"[:-_]\"); print a[1], \$2, \$3\",\"\$4 }'" + ext.prefix = { "${meta.panel_id}.${meta.chr}.posfile.comma" } ext.suffix = "txt" } @@ -18,17 +12,17 @@ process { } withName: BCFTOOLS_MERGE { - ext.args = "--write-index=tbi" + ext.args = "--write-index=tbi --output-type z" ext.prefix = { "${meta.id}_${meta.chr}" } } withName: BCFTOOLS_CONCAT { ext.args = ["--ligate", "-Oz", "--write-index=tbi"].join(' ') - ext.prefix = { "${meta.id}_${meta.chr}.concat" } + ext.prefix = { "${meta.id}_all_chr.concat" } } withName: BCFTOOLS_ANNOTATE { ext.args = ["--set-id '%CHROM:%POS:%REF:%ALT'", "-Oz", "--write-index=tbi"].join(' ') - ext.prefix = { "${meta.id}_${meta.chr}.annotate" } + ext.prefix = { "${meta.id}_all_chr.annotate" } } } From 648ff71445186740d77ed63c1f153afa2abed6d8 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 16:47:29 +0100 Subject: [PATCH 07/19] Fix test --- .../bcftools/mpileup/tests/main.nf.test | 69 ++++++------- .../bcftools/mpileup/tests/main.nf.test.snap | 97 +------------------ .../bcftools/mpileup/tests/nextflow.config | 10 +- 3 files changed, 43 insertions(+), 133 deletions(-) diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test b/modules/nf-core/bcftools/mpileup/tests/main.nf.test index 0b9c86c3f07b..c61ddecc73fb 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test @@ -8,6 +8,7 @@ nextflow_process { tag "modules_nfcore" tag "bcftools" tag "bcftools/mpileup" + tag "bcftools/query" config "./nextflow.config" @@ -23,7 +24,8 @@ nextflow_process { ] input[1] = [ [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = false """ @@ -57,7 +59,8 @@ nextflow_process { ] input[1] = [ [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = false """ @@ -84,7 +87,8 @@ nextflow_process { ] input[1] = [ [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = true """ @@ -119,7 +123,8 @@ nextflow_process { ] input[1] = [ [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = true """ @@ -136,18 +141,35 @@ nextflow_process { } test("sarscov2 - [bam, bed], fasta, false") { + setup { + run("BCFTOOLS_QUERY") { + script "../../query/main.nf" + process { + """ + input[0] = channel.of([ + [id: "test", chr: "MT192765.1"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExist:true), + [] + ]) + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + } when { process { """ - input[0] = [ + input[0] = channel.of([ [ id:'test' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ]).combine(BCFTOOLS_QUERY.out.output.map{meta, tsv -> [tsv]}) input[1] = [ [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = false """ @@ -166,33 +188,4 @@ nextflow_process { ) } } - - test("sarscov2 - [bam, bed], fasta, false stub") { - - options "-stub" - - when { - process { - """ - input[0] = [ - [ id:'test' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) - ] - input[1] = [ - [ id:'sarscov2' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - ] - input[2] = false - """ - } - } - - then { - assert process.success - assertAll( - { assert snapshot(process.out).match()} - ) - } - } } diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap index 806d18056d98..e5923576fec9 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap @@ -126,14 +126,14 @@ }, "sarscov2 - [bam, bed], fasta, false": { "content": [ - "7341fd584a827cddfc5f181a81ed5076", + "c3e829c86ad6ce72945789383bb0108f", "test.vcf.gz.tbi", [ [ { "id": "test" }, - "test.bcftools_stats.txt:md5,ddfe3704ece40c8d3b8a8beb31cfbcf9" + "test.bcftools_stats.txt:md5,163481111816620f6b76a5e96976e93a" ] ], { @@ -148,9 +148,9 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nextflow": "25.10.3" }, - "timestamp": "2025-12-21T14:06:32.030402944" + "timestamp": "2026-02-27T16:45:46.038811362" }, "sarscov2 - [bam, []], fasta, true stub": { "content": [ @@ -241,95 +241,6 @@ }, "timestamp": "2025-12-22T09:01:37.014405367" }, - "sarscov2 - [bam, bed], fasta, false stub": { - "content": [ - { - "0": [ - [ - { - "id": "test" - }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "1": [ - [ - { - "id": "test" - }, - "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - [ - { - "id": "test" - }, - "test.bcftools_stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "3": [ - [ - { - "id": "test" - }, - "test.mpileup.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "4": [ - [ - "BCFTOOLS_MPILEUP", - "bcftools", - "1.22" - ] - ], - "mpileup": [ - [ - { - "id": "test" - }, - "test.mpileup.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "stats": [ - [ - { - "id": "test" - }, - "test.bcftools_stats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "tbi": [ - [ - { - "id": "test" - }, - "test.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "vcf": [ - [ - { - "id": "test" - }, - "test.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "versions_bcftools": [ - [ - "BCFTOOLS_MPILEUP", - "bcftools", - "1.22" - ] - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.2" - }, - "timestamp": "2025-12-22T09:01:50.667461984" - }, "sarscov2 - [bam, []], fasta, false": { "content": [ "d2a6624d03c450aa382ab889563ac29", diff --git a/modules/nf-core/bcftools/mpileup/tests/nextflow.config b/modules/nf-core/bcftools/mpileup/tests/nextflow.config index e9cc0a0b4974..39b718cbb879 100644 --- a/modules/nf-core/bcftools/mpileup/tests/nextflow.config +++ b/modules/nf-core/bcftools/mpileup/tests/nextflow.config @@ -1,4 +1,10 @@ process { - ext.args2 = '--no-version --ploidy 1 --multiallelic-caller' - ext.args3 = '--no-version' + withName: "BCFTOOLS_MPILEUP" { + ext.args2 = '--no-version --ploidy 1 --multiallelic-caller' + ext.args3 = '--no-version' + } + + withName: "BCFTOOLS_QUERY" { + ext.args = "-f'%CHROM\t%POS\t%REF,%ALT\n'" + } } From 61421a7eed83a88e8e374791095dab46af6d9caf Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 17:15:55 +0100 Subject: [PATCH 08/19] Update mpileup --- modules/nf-core/bcftools/mpileup/main.nf | 9 +-- modules/nf-core/bcftools/mpileup/meta.yml | 9 ++- .../bcftools/mpileup/tests/main.nf.test | 44 ++++++++++++++- .../bcftools/mpileup/tests/main.nf.test.snap | 56 +++++++++++++++++++ modules/nf-core/ngscheckmate/ncm/main.nf | 2 +- .../ngscheckmate/ncm/tests/main.nf.test | 27 +++++---- .../ngscheckmate/ncm/tests/nextflow.config | 4 -- .../nf-core/ngscheckmate/ncm/tests/vcf.config | 4 +- subworkflows/nf-core/bam_ngscheckmate/main.nf | 11 ++-- .../nf-core/bam_ngscheckmate/meta.yml | 4 ++ .../bam_ngscheckmate/tests/main.nf.test | 9 ++- .../main.nf | 2 +- 12 files changed, 147 insertions(+), 34 deletions(-) diff --git a/modules/nf-core/bcftools/mpileup/main.nf b/modules/nf-core/bcftools/mpileup/main.nf index 487cebae99fb..aa3c80298ae4 100644 --- a/modules/nf-core/bcftools/mpileup/main.nf +++ b/modules/nf-core/bcftools/mpileup/main.nf @@ -8,7 +8,7 @@ process BCFTOOLS_MPILEUP { : 'community.wave.seqera.io/library/bcftools_htslib:0a3fa2654b52006f'}" input: - tuple val(meta), path(bam), path(intervals) + tuple val(meta), path(bam), path(intervals_mpileup), path(intervals_call) tuple val(meta2), path(fasta), path(fai) val save_mpileup @@ -29,7 +29,8 @@ process BCFTOOLS_MPILEUP { def prefix = task.ext.prefix ?: "${meta.id}" def mpileup = save_mpileup ? "| tee ${prefix}.mpileup" : "" def bgzip_mpileup = save_mpileup ? "bgzip ${prefix}.mpileup" : "" - def intervals_cmd = intervals ? "-T ${intervals}" : "" + def intervals_mpileup_cmd = intervals_mpileup ? "-T ${intervals_mpileup}" : "" + def intervals_call_cmd = intervals_call ? "-T ${intervals_call}" : "" """ echo "${meta.id}" > sample_name.list @@ -38,9 +39,9 @@ process BCFTOOLS_MPILEUP { --fasta-ref ${fasta} \\ ${args} \\ ${bam} \\ - ${intervals_cmd} \\ + ${intervals_mpileup_cmd} \\ ${mpileup} \\ - | bcftools call --output-type v ${args2} ${intervals_cmd} \\ + | bcftools call --output-type v ${args2} ${intervals_call_cmd} \\ | bcftools reheader --samples sample_name.list \\ | bcftools view --output-file ${prefix}.vcf.gz --output-type z ${args3} diff --git a/modules/nf-core/bcftools/mpileup/meta.yml b/modules/nf-core/bcftools/mpileup/meta.yml index 32c6211d8dae..53d38ca42dbc 100644 --- a/modules/nf-core/bcftools/mpileup/meta.yml +++ b/modules/nf-core/bcftools/mpileup/meta.yml @@ -24,10 +24,15 @@ input: description: Input BAM file pattern: "*.{bam}" ontologies: [] - - intervals: + - intervals_mpileup: type: file description: Input intervals file. A file (commonly '.bed') containing regions - to subset + to subset used by mpileup + ontologies: [] + - intervals_call: + type: file + description: Input intervals file. A file (commonly '.bed') containing regions + to subset used by call but need a fourth column with REF,ALT ontologies: [] - - meta2: type: map diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test b/modules/nf-core/bcftools/mpileup/tests/main.nf.test index c61ddecc73fb..dc47aeba9c04 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test @@ -20,6 +20,7 @@ nextflow_process { input[0] = [ [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [], [] ] input[1] = [ @@ -55,6 +56,7 @@ nextflow_process { input[0] = [ [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [], [] ] input[1] = [ @@ -83,6 +85,7 @@ nextflow_process { input[0] = [ [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [], [] ] input[1] = [ @@ -119,6 +122,7 @@ nextflow_process { input[0] = [ [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [], [] ] input[1] = [ @@ -140,7 +144,42 @@ nextflow_process { } } - test("sarscov2 - [bam, bed], fasta, false") { + test("sarscov2 - [bam], fasta, false") { + + when { + process { + """ + input[0] = channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true), + [] + ]) + input[1] = [ + [ id:'sarscov2' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] + ] + input[2] = false + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, + file(process.out.tbi[0][1]).name, + process.out.stats, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } + + test("sarscov2 - [bam, bed_call], fasta, false") { + setup { run("BCFTOOLS_QUERY") { script "../../query/main.nf" @@ -164,7 +203,8 @@ nextflow_process { """ input[0] = channel.of([ [ id:'test' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] ]).combine(BCFTOOLS_QUERY.out.output.map{meta, tsv -> [tsv]}) input[1] = [ [ id:'sarscov2' ], // meta map diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap index e5923576fec9..478d1141767d 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap @@ -241,6 +241,62 @@ }, "timestamp": "2025-12-22T09:01:37.014405367" }, + "sarscov2 - [bam, bed_call], fasta, false": { + "content": [ + "46cbd80967ad92b1d603492e503e6a06", + "test.vcf.gz.tbi", + [ + [ + { + "id": "test" + }, + "test.bcftools_stats.txt:md5,6ae3528d5393335f19135bd0e39f80e8" + ] + ], + { + "versions_bcftools": [ + [ + "BCFTOOLS_MPILEUP", + "bcftools", + "1.22" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.3" + }, + "timestamp": "2026-02-27T17:05:45.469300576" + }, + "sarscov2 - [bam], fasta, false": { + "content": [ + "7341fd584a827cddfc5f181a81ed5076", + "test.vcf.gz.tbi", + [ + [ + { + "id": "test" + }, + "test.bcftools_stats.txt:md5,ddfe3704ece40c8d3b8a8beb31cfbcf9" + ] + ], + { + "versions_bcftools": [ + [ + "BCFTOOLS_MPILEUP", + "bcftools", + "1.22" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.3" + }, + "timestamp": "2026-02-27T17:05:36.496458264" + }, "sarscov2 - [bam, []], fasta, false": { "content": [ "d2a6624d03c450aa382ab889563ac29", diff --git a/modules/nf-core/ngscheckmate/ncm/main.nf b/modules/nf-core/ngscheckmate/ncm/main.nf index 56e5d18fbab9..3c4ee39e56e6 100644 --- a/modules/nf-core/ngscheckmate/ncm/main.nf +++ b/modules/nf-core/ngscheckmate/ncm/main.nf @@ -9,7 +9,7 @@ process NGSCHECKMATE_NCM { input: tuple val(meta), path(files) tuple val(meta2), path(snp_bed) - tuple val(meta3), path(fasta) + tuple val(meta3), path(fasta), path(fai) output: tuple val(meta), path("*_corr_matrix.txt"), emit: corr_matrix diff --git a/modules/nf-core/ngscheckmate/ncm/tests/main.nf.test b/modules/nf-core/ngscheckmate/ncm/tests/main.nf.test index 525399ac67e9..65a0c1309777 100644 --- a/modules/nf-core/ngscheckmate/ncm/tests/main.nf.test +++ b/modules/nf-core/ngscheckmate/ncm/tests/main.nf.test @@ -20,10 +20,12 @@ nextflow_process { input[0] = [ [ id:'test1' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true), + [] ] input[1] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = false """ @@ -37,10 +39,12 @@ nextflow_process { input[0] = [ [ id:'test2' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true), + [] ] input[1] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] input[2] = false """ @@ -49,7 +53,6 @@ nextflow_process { } - test("sarscov2 - bam") { config "./bam.config" when { @@ -68,7 +71,8 @@ nextflow_process { ] input[1] = Channel.of([ [id:'test_bed'], bed_file]) input[2] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] """ } @@ -100,7 +104,8 @@ nextflow_process { input[0] = BCFTOOLS_MPILEUP1.out.vcf.combine(BCFTOOLS_MPILEUP2.out.vcf.map{it[1]}).map{meta, one, two -> [meta, [one, two]]}.map{meta, stuff -> [meta, stuff.flatten()]} input[1] = Channel.of([ [id:'test_bed'], bed_file]) input[2] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] """ } @@ -139,7 +144,8 @@ nextflow_process { ] input[1] = [ [ id:'bed' ], []] input[2] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] """ } @@ -162,10 +168,11 @@ nextflow_process { when { process { """ - input[0] = BCFTOOLS_MPILEUP1.out.vcf.combine(BCFTOOLS_MPILEUP2.out.vcf.map{it[1]}) + input[0] = BCFTOOLS_MPILEUP1.out.vcf.combine(BCFTOOLS_MPILEUP2.out.vcf.map{it[1]}).map{meta, one, two -> [meta, [one, two]]}.map{meta, stuff -> [meta, stuff.flatten()]} input[1] = [ [ id:'bed' ], []] input[2] = [ [ id:'sarscov2' ], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ] """ } diff --git a/modules/nf-core/ngscheckmate/ncm/tests/nextflow.config b/modules/nf-core/ngscheckmate/ncm/tests/nextflow.config index cf3d42a0e98e..0d50c161b7b9 100644 --- a/modules/nf-core/ngscheckmate/ncm/tests/nextflow.config +++ b/modules/nf-core/ngscheckmate/ncm/tests/nextflow.config @@ -1,8 +1,4 @@ process { - withName: BEDTOOLS_MAKEWINDOWS { - ext.args = '-w 1' - ext.prefix = 'test_split' - } withName: BCFTOOLS_MPILEUP1 { ext.args2 = '--no-version --ploidy 1 --multiallelic-caller' ext.args3 = '--no-version' diff --git a/modules/nf-core/ngscheckmate/ncm/tests/vcf.config b/modules/nf-core/ngscheckmate/ncm/tests/vcf.config index 67053c14dabc..c5f2543aa28e 100644 --- a/modules/nf-core/ngscheckmate/ncm/tests/vcf.config +++ b/modules/nf-core/ngscheckmate/ncm/tests/vcf.config @@ -1,5 +1,5 @@ - process { +process { withName: NGSCHECKMATE_NCM { ext.args = '-V' } - } +} diff --git a/subworkflows/nf-core/bam_ngscheckmate/main.nf b/subworkflows/nf-core/bam_ngscheckmate/main.nf index c68c1c9e9a99..71f3e7b12f92 100644 --- a/subworkflows/nf-core/bam_ngscheckmate/main.nf +++ b/subworkflows/nf-core/bam_ngscheckmate/main.nf @@ -6,13 +6,14 @@ workflow BAM_NGSCHECKMATE { take: ch_input // channel: [ val(meta1), bam/cram ] ch_snp_bed // channel: [ val(meta2), bed ] - ch_fasta // channel: [ val(meta3), fasta ] + ch_fasta // channel: [ val(meta3), fasta, fai ] main: - ch_input_bed = ch_input.combine(ch_snp_bed) - .map{ input_meta, input_file, _bed_meta, bed_file -> - [input_meta, input_file, bed_file] - } + ch_input_bed = ch_input + .combine(ch_snp_bed) + .map{ input_meta, input_file, _bed_meta, bed_file -> + [input_meta, input_file, bed_file, []] + } BCFTOOLS_MPILEUP (ch_input_bed, ch_fasta.collect(), false) diff --git a/subworkflows/nf-core/bam_ngscheckmate/meta.yml b/subworkflows/nf-core/bam_ngscheckmate/meta.yml index 7de0a114d404..ce45cbba2cea 100644 --- a/subworkflows/nf-core/bam_ngscheckmate/meta.yml +++ b/subworkflows/nf-core/bam_ngscheckmate/meta.yml @@ -37,6 +37,10 @@ input: type: file description: fasta file for the genome pattern: "*.{fasta}" + - fai: + type: file + description: fasta file index for the genome + pattern: "*.{fai}" output: - pdf: type: file diff --git a/subworkflows/nf-core/bam_ngscheckmate/tests/main.nf.test b/subworkflows/nf-core/bam_ngscheckmate/tests/main.nf.test index 9452ec104013..3f502a186002 100644 --- a/subworkflows/nf-core/bam_ngscheckmate/tests/main.nf.test +++ b/subworkflows/nf-core/bam_ngscheckmate/tests/main.nf.test @@ -35,7 +35,8 @@ nextflow_workflow { input[1] = Channel.of([ [id:'test_bed'], bed_file]) input[2] = Channel.of([ [ id:'sarscov2'], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ]) """ } @@ -75,7 +76,8 @@ nextflow_workflow { input[1] = Channel.of([ [id:'test_bed'], bed_file]) input[2] = Channel.of([ [ id:'homo_sapiens'], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true), + [] ]) """ } @@ -118,7 +120,8 @@ nextflow_workflow { input[1] = Channel.of([ [id:'test_bed'], bed_file]) input[2] = Channel.of([ [ id:'sarscov2'], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] ]) """ } diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index 6a7be664d29d..d2289e8e8bc3 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -21,7 +21,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ch_mpileup = ch_bam .combine(ch_posfile) .map{metaI, bam, _bai, metaPC, tsv -> - [metaI + metaPC, bam, tsv] + [metaI + metaPC, bam, tsv, tsv] } def posfile_count = ch_posfile From 32cd6d00d9e83213d8243065c54f13a3fc07096e Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 17:36:34 +0100 Subject: [PATCH 09/19] Update tests --- modules/nf-core/ngscheckmate/ncm/meta.yml | 7 ++++++- .../nf-core/bam_variant_calling_mpileup_bcftools/main.nf | 2 +- .../tests/main.nf.test.snap | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/nf-core/ngscheckmate/ncm/meta.yml b/modules/nf-core/ngscheckmate/ncm/meta.yml index 176208e40705..ea031b4aa9a0 100644 --- a/modules/nf-core/ngscheckmate/ncm/meta.yml +++ b/modules/nf-core/ngscheckmate/ncm/meta.yml @@ -46,7 +46,12 @@ input: - fasta: type: file description: fasta file for the genome, only used in the bam mode - pattern: "*.{bed}" + pattern: "*.{fasta}" + ontologies: [] + - fai: + type: file + description: fasta index file for the genome, only used in the bam mode + pattern: "*.{fai}" ontologies: [] output: corr_matrix: diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index d2289e8e8bc3..85df4cc7ee17 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -21,7 +21,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ch_mpileup = ch_bam .combine(ch_posfile) .map{metaI, bam, _bai, metaPC, tsv -> - [metaI + metaPC, bam, tsv, tsv] + [metaI + metaPC, bam, [], tsv] } def posfile_count = ch_posfile diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap index 455809f7a605..3592dab453e2 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -77,7 +77,7 @@ }, "all_samples_all_chr.annotate.vcf.gz", "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1737, phased=false, phasedAutodetect=false]", - "96e0517b17306ab297c8ac87d753d4d9", + "ff43b61fb59588c05a79c4d1768c03c7", "all_samples_all_chr.annotate.vcf.gz.tbi" ] ], @@ -85,14 +85,14 @@ "NA12878_21.bcftools_stats.txt:md5,29f310e5ed86cc2d3f6f77eb5da2a7e0", "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10", "NA19401_21.bcftools_stats.txt:md5,16730f1e8df6e0446ed2779d87c98168", - "NA19401_22.bcftools_stats.txt:md5,e9b457859517dcfaf886335cbbe442b3" + "NA19401_22.bcftools_stats.txt:md5,dd2bd50724e9df455d64ca7e55b3e1ad" ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.3" }, - "timestamp": "2026-02-27T16:02:46.171730624" + "timestamp": "2026-02-27T17:35:12.967272904" }, "One individual and two chromosomes": { "content": [ From ac93c7c22d91623cde0381d74037ecfc10c177d8 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 17:58:10 +0100 Subject: [PATCH 10/19] Sort metas --- .../bam_variant_calling_mpileup_bcftools/main.nf | 4 +++- .../tests/main.nf.test.snap | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index 85df4cc7ee17..c4f7d470fa24 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -49,7 +49,9 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { // Create new meta with meta_sample_merge_key set to meta_sample_merge_value def newMeta = metaPC + [ (meta_sample_merge_key): meta_sample_merge_value, - metas: filestups.collect{ meta, _vcf, _index -> meta } + metas: filestups + .collect{ meta, _vcf, _index -> meta } + .sort() ] [ newMeta, diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap index 3592dab453e2..ca1afb22aa1a 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -44,32 +44,32 @@ "id": "all_samples", "metas": [ { - "chr": "21", + "chr": "22", "metas": [ { "id": "NA12878", "panel_id": "1000GP", - "chr": "21" + "chr": "22" }, { "id": "NA19401", "panel_id": "1000GP", - "chr": "21" + "chr": "22" } ] }, { - "chr": "22", + "chr": "21", "metas": [ { "id": "NA12878", "panel_id": "1000GP", - "chr": "22" + "chr": "21" }, { "id": "NA19401", "panel_id": "1000GP", - "chr": "22" + "chr": "21" } ] } @@ -92,7 +92,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.3" }, - "timestamp": "2026-02-27T17:35:12.967272904" + "timestamp": "2026-02-27T17:53:09.566954514" }, "One individual and two chromosomes": { "content": [ From 888532ebed93d810ff904785490324b6b84aea19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:58:32 +0100 Subject: [PATCH 11/19] Update subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- .../nf-core/bam_variant_calling_mpileup_bcftools/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml index c00f1f68fc80..b580f9eb0066 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml @@ -18,7 +18,7 @@ components: - bcftools/merge - bcftools/annotate - bcftools/concat - - vcf_gather_bcftools + - subworkflows/vcf_gather_bcftools input: - ch_bam: description: Channel with input data From 05eed4e8d07013e84ce0a3f4efd1007b19b1abda Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 18:01:04 +0100 Subject: [PATCH 12/19] Update tags --- .../tests/main.nf.test | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test index 27a24f0a6d1f..dc414cc4fc77 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -7,9 +7,11 @@ nextflow_workflow { workflow "BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS" tag "subworkflows" - tag "subworkflows_local" + tag "subworkflows_nfcore" tag "subworkflows/bam_variant_calling_mpileup_bcftools" + tag "subworkflows/vcf_gather_bcftools" tag "bam_variant_calling_mpileup_bcftools" + tag "vcf_gather_bcftools" tag "gawk" tag "tabix" @@ -20,9 +22,6 @@ nextflow_workflow { tag "bcftools/merge" tag "bcftools/concat" - tag "subworkflows_nfcore" - tag "vcf_gather_bcftools" - test("Two individuals and two chromosomes, sort and annotate") { setup { // Change CHR\tPOS\tREF\tALT to CHR\tPOS\tREF,tALT run("GAWK") { From 575fba825b0bad009a432ea562f3c6756e0af6e8 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Fri, 27 Feb 2026 18:27:23 +0100 Subject: [PATCH 13/19] Update snapshot --- .../main.nf | 2 +- .../tests/main.nf.test | 30 ++++++-- .../tests/main.nf.test.snap | 75 ++----------------- 3 files changed, 31 insertions(+), 76 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index c4f7d470fa24..6cb929f759c7 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -44,7 +44,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { def groupMeta = metaIPC.subMap(groupKeys) [groupMeta, [metaIPC, vcf, tbi]] } - .groupTuple(sort: { it1, it2 -> it1[0][meta_sample_merge_key] <=> it2[0][meta_sample_merge_key] }) // Sort by id + .groupTuple() .map{ metaPC, filestups -> // Create new meta with meta_sample_merge_key set to meta_sample_merge_value def newMeta = metaPC + [ diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test index dc414cc4fc77..4d2284f58b64 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -72,8 +72,14 @@ nextflow_workflow { then { assert workflow.success assert snapshot( - workflow.out.vcf_index.collect{ meta, vcf, index -> [ - meta, + workflow.out.vcf_index.collect{ meta, vcf, index -> + def metaForSnapshot = meta.findAll { key, value -> key != 'metas' } + // Add a deterministic count instead of the full metas list + if (meta.metas) { + metaForSnapshot.metas_count = meta.metas.size() + } + [ + metaForSnapshot, path(vcf).getFileName().toString(), path(vcf).vcf.summary, // Two individuals and 1739 variants path(vcf).vcf.variantsMD5, @@ -126,8 +132,14 @@ nextflow_workflow { then { assert workflow.success assert snapshot( - workflow.out.vcf_index.collect{ meta, vcf, index -> [ - meta, + workflow.out.vcf_index.collect{ meta, vcf, index -> + def metaForSnapshot = meta.findAll { key, value -> key != 'metas' } + // Add a deterministic count instead of the full metas list + if (meta.metas) { + metaForSnapshot.metas_count = meta.metas.size() + } + [ + metaForSnapshot, path(vcf).getFileName().toString(), path(vcf).vcf.summary, // One individuals and 902 variants path(vcf).vcf.variantsMD5, @@ -183,8 +195,14 @@ nextflow_workflow { then { assert workflow.success assert snapshot( - workflow.out.vcf_index.collect{ meta, vcf, index -> [ - meta, + workflow.out.vcf_index.collect{ meta, vcf, index -> + def metaForSnapshot = meta.findAll { key, value -> key != 'metas' } + // Add a deterministic count instead of the full metas list + if (meta.metas) { + metaForSnapshot.metas_count = meta.metas.size() + } + [ + metaForSnapshot, path(vcf).getFileName().toString(), path(vcf).vcf.summary, // One individuals and 1737 variants path(vcf).vcf.variantsMD5, diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap index ca1afb22aa1a..bf61bcb8d131 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -6,18 +6,7 @@ { "panel_id": "1000GP", "id": "all_samples", - "metas": [ - { - "chr": "22", - "metas": [ - { - "id": "NA12878", - "panel_id": "1000GP", - "chr": "22" - } - ] - } - ] + "metas_count": 1 }, "NA12878_22.vcf.gz", "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=902, phased=false, phasedAutodetect=false]", @@ -33,7 +22,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.3" }, - "timestamp": "2026-02-27T16:03:00.743836227" + "timestamp": "2026-02-27T18:26:40.379067986" }, "Two individuals and two chromosomes, sort and annotate": { "content": [ @@ -42,38 +31,7 @@ { "panel_id": "1000GP", "id": "all_samples", - "metas": [ - { - "chr": "22", - "metas": [ - { - "id": "NA12878", - "panel_id": "1000GP", - "chr": "22" - }, - { - "id": "NA19401", - "panel_id": "1000GP", - "chr": "22" - } - ] - }, - { - "chr": "21", - "metas": [ - { - "id": "NA12878", - "panel_id": "1000GP", - "chr": "21" - }, - { - "id": "NA19401", - "panel_id": "1000GP", - "chr": "21" - } - ] - } - ] + "metas_count": 2 }, "all_samples_all_chr.annotate.vcf.gz", "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1737, phased=false, phasedAutodetect=false]", @@ -92,7 +50,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.3" }, - "timestamp": "2026-02-27T17:53:09.566954514" + "timestamp": "2026-02-27T18:26:25.829877767" }, "One individual and two chromosomes": { "content": [ @@ -101,28 +59,7 @@ { "panel_id": "1000GP", "id": "all_samples", - "metas": [ - { - "chr": "22", - "metas": [ - { - "id": "NA12878", - "panel_id": "1000GP", - "chr": "22" - } - ] - }, - { - "chr": "21", - "metas": [ - { - "id": "NA12878", - "panel_id": "1000GP", - "chr": "21" - } - ] - } - ] + "metas_count": 2 }, "all_samples_all_chr.concat.vcf.gz", "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1737, phased=false, phasedAutodetect=false]", @@ -139,6 +76,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.3" }, - "timestamp": "2026-02-27T16:03:17.799447553" + "timestamp": "2026-02-27T18:26:57.619510735" } } \ No newline at end of file From 63e908e37148f66cbd6f5e792866e49ffb0cfd4d Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 2 Mar 2026 13:25:49 +0100 Subject: [PATCH 14/19] Update intervals --- modules/nf-core/bcftools/mpileup/main.nf | 2 +- .../bcftools/mpileup/tests/main.nf.test | 53 +++++++++++++++++- .../bcftools/mpileup/tests/main.nf.test.snap | 54 +++++++++---------- .../main.nf | 18 +++---- .../tests/main.nf.test.snap | 20 +++---- 5 files changed, 99 insertions(+), 48 deletions(-) diff --git a/modules/nf-core/bcftools/mpileup/main.nf b/modules/nf-core/bcftools/mpileup/main.nf index aa3c80298ae4..0b35ddac402a 100644 --- a/modules/nf-core/bcftools/mpileup/main.nf +++ b/modules/nf-core/bcftools/mpileup/main.nf @@ -8,7 +8,7 @@ process BCFTOOLS_MPILEUP { : 'community.wave.seqera.io/library/bcftools_htslib:0a3fa2654b52006f'}" input: - tuple val(meta), path(bam), path(intervals_mpileup), path(intervals_call) + tuple val(meta), path(bam), path(intervals_mpileup, stageAs: 'mpileup_intervals/*'), path(intervals_call, stageAs: 'call_intervals/*') tuple val(meta2), path(fasta), path(fai) val save_mpileup diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test b/modules/nf-core/bcftools/mpileup/tests/main.nf.test index dc47aeba9c04..d97d655991c8 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test @@ -144,7 +144,7 @@ nextflow_process { } } - test("sarscov2 - [bam], fasta, false") { + test("sarscov2 - [bam, bed_mpileup], fasta, false") { when { process { @@ -228,4 +228,55 @@ nextflow_process { ) } } + + test("sarscov2 - [bam, bed_mpileup, bed_call], fasta, false") { + + setup { + run("BCFTOOLS_QUERY") { + script "../../query/main.nf" + process { + """ + input[0] = channel.of([ + [id: "test", chr: "MT192765.1"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExist:true), + [] + ]) + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + } + + when { + process { + """ + input[0] = channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ]).combine(BCFTOOLS_QUERY.out.output.map{meta, tsv -> [tsv]}) + .combine(BCFTOOLS_QUERY.out.output.map{meta, tsv -> [tsv]}) + input[1] = [ + [ id:'sarscov2' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] + ] + input[2] = false + """ + } + } + + then { + assert process.success + assertAll( + { assert snapshot( + path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, + file(process.out.tbi[0][1]).name, + process.out.stats, + process.out.findAll { key, val -> key.startsWith("versions") } + ).match() } + ) + } + } } diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap index 478d1141767d..b7091f997939 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test.snap @@ -29,11 +29,11 @@ ] } ], + "timestamp": "2025-12-21T14:06:18.298267588", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.2" - }, - "timestamp": "2025-12-21T14:06:18.298267588" + } }, "sarscov2 - [bam, []], fasta, false stub": { "content": [ @@ -118,22 +118,22 @@ ] } ], + "timestamp": "2025-12-22T09:01:23.428267089", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.2" - }, - "timestamp": "2025-12-22T09:01:23.428267089" + } }, - "sarscov2 - [bam, bed], fasta, false": { + "sarscov2 - [bam, bed_mpileup], fasta, false": { "content": [ - "c3e829c86ad6ce72945789383bb0108f", + "7341fd584a827cddfc5f181a81ed5076", "test.vcf.gz.tbi", [ [ { "id": "test" }, - "test.bcftools_stats.txt:md5,163481111816620f6b76a5e96976e93a" + "test.bcftools_stats.txt:md5,ddfe3704ece40c8d3b8a8beb31cfbcf9" ] ], { @@ -146,11 +146,11 @@ ] } ], + "timestamp": "2026-03-02T13:20:19.914560249", "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T16:45:46.038811362" + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } }, "sarscov2 - [bam, []], fasta, true stub": { "content": [ @@ -235,22 +235,22 @@ ] } ], + "timestamp": "2025-12-22T09:01:37.014405367", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.2" - }, - "timestamp": "2025-12-22T09:01:37.014405367" + } }, - "sarscov2 - [bam, bed_call], fasta, false": { + "sarscov2 - [bam, bed_mpileup, bed_call], fasta, false": { "content": [ - "46cbd80967ad92b1d603492e503e6a06", + "c3e829c86ad6ce72945789383bb0108f", "test.vcf.gz.tbi", [ [ { "id": "test" }, - "test.bcftools_stats.txt:md5,6ae3528d5393335f19135bd0e39f80e8" + "test.bcftools_stats.txt:md5,163481111816620f6b76a5e96976e93a" ] ], { @@ -263,22 +263,22 @@ ] } ], + "timestamp": "2026-03-02T13:20:37.262876642", "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T17:05:45.469300576" + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } }, - "sarscov2 - [bam], fasta, false": { + "sarscov2 - [bam, bed_call], fasta, false": { "content": [ - "7341fd584a827cddfc5f181a81ed5076", + "46cbd80967ad92b1d603492e503e6a06", "test.vcf.gz.tbi", [ [ { "id": "test" }, - "test.bcftools_stats.txt:md5,ddfe3704ece40c8d3b8a8beb31cfbcf9" + "test.bcftools_stats.txt:md5,6ae3528d5393335f19135bd0e39f80e8" ] ], { @@ -291,11 +291,11 @@ ] } ], + "timestamp": "2026-02-27T17:05:45.469300576", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T17:05:36.496458264" + } }, "sarscov2 - [bam, []], fasta, false": { "content": [ @@ -319,10 +319,10 @@ ] } ], + "timestamp": "2025-12-21T14:06:04.63975552", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.2" - }, - "timestamp": "2025-12-21T14:06:04.63975552" + } } } \ No newline at end of file diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index 6cb929f759c7..e014b95ff736 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -20,8 +20,8 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ch_mpileup = ch_bam .combine(ch_posfile) - .map{metaI, bam, _bai, metaPC, tsv -> - [metaI + metaPC, bam, [], tsv] + .map{meta_bam, bam, _bai, meta_posfile, tsv -> + [meta_bam + meta_posfile, bam, tsv, tsv] } def posfile_count = ch_posfile @@ -39,15 +39,15 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { // Branch depending on number of files ch_all_vcf = BCFTOOLS_MPILEUP.out.vcf .join(BCFTOOLS_MPILEUP.out.tbi) - .map{ metaIPC, vcf, tbi -> // Get all keys except merge_key - def groupKeys = metaIPC.keySet().findAll { key -> key != meta_sample_merge_key } - def groupMeta = metaIPC.subMap(groupKeys) - [groupMeta, [metaIPC, vcf, tbi]] + .map{ meta, vcf, tbi -> // Get all keys except merge_key + def groupKeys = meta.keySet().findAll { key -> key != meta_sample_merge_key } + def groupMeta = meta.subMap(groupKeys) + [groupMeta, [meta, vcf, tbi]] } - .groupTuple() - .map{ metaPC, filestups -> + .groupTuple().view() + .map{ meta_group, filestups -> // Create new meta with meta_sample_merge_key set to meta_sample_merge_value - def newMeta = metaPC + [ + def newMeta = meta_group + [ (meta_sample_merge_key): meta_sample_merge_value, metas: filestups .collect{ meta, _vcf, _index -> meta } diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap index bf61bcb8d131..505389781c8e 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test.snap @@ -18,11 +18,11 @@ "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10" ] ], + "timestamp": "2026-02-27T18:26:40.379067986", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T18:26:40.379067986" + } }, "Two individuals and two chromosomes, sort and annotate": { "content": [ @@ -35,7 +35,7 @@ }, "all_samples_all_chr.annotate.vcf.gz", "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1737, phased=false, phasedAutodetect=false]", - "ff43b61fb59588c05a79c4d1768c03c7", + "96e0517b17306ab297c8ac87d753d4d9", "all_samples_all_chr.annotate.vcf.gz.tbi" ] ], @@ -43,14 +43,14 @@ "NA12878_21.bcftools_stats.txt:md5,29f310e5ed86cc2d3f6f77eb5da2a7e0", "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10", "NA19401_21.bcftools_stats.txt:md5,16730f1e8df6e0446ed2779d87c98168", - "NA19401_22.bcftools_stats.txt:md5,dd2bd50724e9df455d64ca7e55b3e1ad" + "NA19401_22.bcftools_stats.txt:md5,e9b457859517dcfaf886335cbbe442b3" ] ], + "timestamp": "2026-03-02T13:24:14.07373231", "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T18:26:25.829877767" + "nf-test": "0.9.4", + "nextflow": "25.10.4" + } }, "One individual and two chromosomes": { "content": [ @@ -72,10 +72,10 @@ "NA12878_22.bcftools_stats.txt:md5,e35386eaea9c0047d0c9ce56ae966d10" ] ], + "timestamp": "2026-02-27T18:26:57.619510735", "meta": { "nf-test": "0.9.3", "nextflow": "25.10.3" - }, - "timestamp": "2026-02-27T18:26:57.619510735" + } } } \ No newline at end of file From 07ebf16937c7421d0bc725bc81859bfc2b1d605b Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 2 Mar 2026 14:19:15 +0100 Subject: [PATCH 15/19] Fix comments --- .../bcftools/mpileup/tests/main.nf.test | 4 +- .../main.nf | 4 +- .../meta.yml | 2 +- .../tests/main.nf.test | 38 +++++++++---------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/nf-core/bcftools/mpileup/tests/main.nf.test b/modules/nf-core/bcftools/mpileup/tests/main.nf.test index d97d655991c8..2bbb355298cc 100644 --- a/modules/nf-core/bcftools/mpileup/tests/main.nf.test +++ b/modules/nf-core/bcftools/mpileup/tests/main.nf.test @@ -187,7 +187,7 @@ nextflow_process { """ input[0] = channel.of([ [id: "test", chr: "MT192765.1"], - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists:true), [] ]) input[1] = [] @@ -238,7 +238,7 @@ nextflow_process { """ input[0] = channel.of([ [id: "test", chr: "MT192765.1"], - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists:true), [] ]) input[1] = [] diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index e014b95ff736..ec9d0244a1fd 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -1,7 +1,7 @@ include { BCFTOOLS_MPILEUP } from '../../../modules/nf-core/bcftools/mpileup' include { BCFTOOLS_MERGE } from '../../../modules/nf-core/bcftools/merge' include { BCFTOOLS_ANNOTATE } from '../../../modules/nf-core/bcftools/annotate' -include { VCF_GATHER_BCFTOOLS } from '../../../subworkflows/nf-core/vcf_gather_bcftools' +include { VCF_GATHER_BCFTOOLS } from '../vcf_gather_bcftools' workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { @@ -44,7 +44,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { def groupMeta = meta.subMap(groupKeys) [groupMeta, [meta, vcf, tbi]] } - .groupTuple().view() + .groupTuple() .map{ meta_group, filestups -> // Create new meta with meta_sample_merge_key set to meta_sample_merge_value def newMeta = meta_group + [ diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml index b580f9eb0066..c00f1f68fc80 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/meta.yml @@ -18,7 +18,7 @@ components: - bcftools/merge - bcftools/annotate - bcftools/concat - - subworkflows/vcf_gather_bcftools + - vcf_gather_bcftools input: - ch_bam: description: Channel with input data diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test index 4d2284f58b64..27fdc93b8366 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/tests/main.nf.test @@ -30,10 +30,10 @@ nextflow_workflow { """ input[0] = channel.of([ [panel_id: "1000GP", chr: "22"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExists:true) ], [ [panel_id: "1000GP", chr: "21"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExists:true) ]) input[1] = [] input[2] = false @@ -47,18 +47,18 @@ nextflow_workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists:true), ], [ [id: "NA19401"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam.bai', checkIfExists:true), ]) input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExists:true), ]).collect() input[3] = "id" input[4] = "all_samples" @@ -98,7 +98,7 @@ nextflow_workflow { """ input[0] = channel.of([ [panel_id: "1000GP", chr: "22"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExists:true) ]) input[1] = [] input[2] = false @@ -111,14 +111,14 @@ nextflow_workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists:true), ]) input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExists:true), ]).collect() input[3] = "id" input[4] = "all_samples" @@ -158,10 +158,10 @@ nextflow_workflow { """ input[0] = channel.of([ [panel_id: "1000GP", chr: "22"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr22.posfile', checkIfExists:true) ], [ [panel_id: "1000GP", chr: "21"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExist:true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/popgen/1000GP.chr21.posfile', checkIfExists:true) ]) input[1] = [] input[2] = false @@ -174,14 +174,14 @@ nextflow_workflow { """ input[0] = channel.of([ [id: "NA12878"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai', checkIfExists:true), ]) input[1] = GAWK.out.output input[2] = channel.of([ [id: "GRCh38"], - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExist:true), - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExist:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz', checkIfExists:true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genomeGRCh38_chr21_22.fa.gz.fai', checkIfExists:true), ]).collect() input[3] = "id" input[4] = "all_samples" From bba525866e31634b14c5f94b03babd841d044473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:50:12 +0100 Subject: [PATCH 16/19] Update subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf Co-authored-by: Maxime U Garcia --- .../nf-core/bam_variant_calling_mpileup_bcftools/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index ec9d0244a1fd..89a8c560b6a4 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -62,12 +62,12 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { } .branch{ _meta, _vcf, _index, size -> one: size == 1 - more: size > 1 + multiple: size > 1 } // Merge VCFs all individuals BCFTOOLS_MERGE( - ch_all_vcf.more.map{ + ch_all_vcf.multiple.map{ meta, vcf_list, index_list, _size -> [ meta, vcf_list, index_list, [] ] }, ch_fasta From 4947a4f96cf6d0eaf77a8458a73715a4ab8655dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:50:29 +0100 Subject: [PATCH 17/19] Update subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf Co-authored-by: Maxime U Garcia --- .../nf-core/bam_variant_calling_mpileup_bcftools/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index 89a8c560b6a4..fa52655e431b 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -74,7 +74,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ) // Mix all vcfs - ch_to_concat = ch_all_vcf.one + ch_to_concat = ch_all_vcf.single .map{ meta, vcf_list, index_list, _size -> [ meta, vcf_list[0], index_list[0] ] } From a54c7f75fd80a4a6174b1e995894e39187083e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Mon, 2 Mar 2026 15:51:26 +0100 Subject: [PATCH 18/19] Update subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf Co-authored-by: Maxime U Garcia --- .../bam_variant_calling_mpileup_bcftools/main.nf | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index fa52655e431b..b19a8ec0ec5a 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -45,16 +45,15 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { [groupMeta, [meta, vcf, tbi]] } .groupTuple() - .map{ meta_group, filestups -> - // Create new meta with meta_sample_merge_key set to meta_sample_merge_value - def newMeta = meta_group + [ + .map{ meta, filestups -> + // Assign meta_sample_merge_key to meta_sample_merge_value + [ + meta + [ (meta_sample_merge_key): meta_sample_merge_value, metas: filestups .collect{ meta, _vcf, _index -> meta } .sort() - ] - [ - newMeta, + ], filestups.collect{_meta, vcf, _index -> vcf}, filestups.collect{_meta, _vcf, index -> index}, filestups.collect{_meta, vcf, _index -> vcf}.size() From 58d82c0206b8786dc4393dfdbfc2cb39c738a595 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 2 Mar 2026 15:55:55 +0100 Subject: [PATCH 19/19] Fix sbwf --- .../nf-core/bam_variant_calling_mpileup_bcftools/main.nf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf index b19a8ec0ec5a..e21cf57644bc 100644 --- a/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf +++ b/subworkflows/nf-core/bam_variant_calling_mpileup_bcftools/main.nf @@ -45,10 +45,11 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { [groupMeta, [meta, vcf, tbi]] } .groupTuple() - .map{ meta, filestups -> + .view() + .map{ meta_group, filestups -> // Assign meta_sample_merge_key to meta_sample_merge_value [ - meta + [ + meta_group + [ (meta_sample_merge_key): meta_sample_merge_value, metas: filestups .collect{ meta, _vcf, _index -> meta } @@ -60,7 +61,7 @@ workflow BAM_VARIANT_CALLING_MPILEUP_BCFTOOLS { ] } .branch{ _meta, _vcf, _index, size -> - one: size == 1 + single: size == 1 multiple: size > 1 }