From 03a1f54c3c4805a60d969139bf069c9d2352aade Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 4 Dec 2025 16:18:38 +0100 Subject: [PATCH 01/15] Update glimpse2 sbwf --- .../nf-core/glimpse2/splitreference/main.nf | 3 +- .../nf-core/glimpse2/splitreference/meta.yml | 5 - .../splitreference/tests/main.nf.test | 13 +- .../nf-core/bam_vcf_impute_glimpse2/main.nf | 125 +++++ .../meta.yml | 41 +- .../tests/main.nf.test | 471 ++++++++++++++++ .../tests/main.nf.test.snap | 524 ++++++++++++++++++ .../tests/nextflow.config | 41 ++ .../nf-core/multiple_impute_glimpse2/main.nf | 75 --- .../tests/main.nf.test | 173 ------ .../tests/main.nf.test.snap | 169 ------ .../tests/nextflow.config | 12 - 12 files changed, 1195 insertions(+), 457 deletions(-) create mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf rename subworkflows/nf-core/{multiple_impute_glimpse2 => bam_vcf_impute_glimpse2}/meta.yml (56%) create mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test create mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap create mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config delete mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/main.nf delete mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test delete mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap delete mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config diff --git a/modules/nf-core/glimpse2/splitreference/main.nf b/modules/nf-core/glimpse2/splitreference/main.nf index 019072b8689d..0311e09dabc2 100644 --- a/modules/nf-core/glimpse2/splitreference/main.nf +++ b/modules/nf-core/glimpse2/splitreference/main.nf @@ -18,8 +18,7 @@ process GLIMPSE2_SPLITREFERENCE { 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" input: - tuple val(meta) , path(reference), path(reference_index), val(input_region), val(output_region) - tuple val(meta2), path(map) + tuple val(meta) , path(reference), path(reference_index), val(input_region), val(output_region), path(map) output: diff --git a/modules/nf-core/glimpse2/splitreference/meta.yml b/modules/nf-core/glimpse2/splitreference/meta.yml index 161dab0d5781..ed6b63ee03ad 100644 --- a/modules/nf-core/glimpse2/splitreference/meta.yml +++ b/modules/nf-core/glimpse2/splitreference/meta.yml @@ -42,11 +42,6 @@ input: type: string description: Target imputed region, excluding left and right buffers (e.g. chr20:1000000-2000000). pattern: "chrXX:leftBufferPosition-rightBufferPosition" - - - meta2: - type: map - description: | - Groovy Map containing genomic map information - e.g. `[ map:'GRCh38' ]` - map: type: file description: File containing the genetic map. diff --git a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test index e95febde9a3c..9c353df2f643 100644 --- a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test +++ b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test @@ -20,9 +20,9 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000" + "chr22:16600000-16800000", + [] ] - input[1]= [[ id:'map'],[]] """ } } @@ -48,10 +48,7 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000" - ] - input[1]= [ - [ id:'map'], + "chr22:16600000-16800000", file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists:true) ] """ @@ -80,9 +77,9 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000" + "chr22:16600000-16800000", + [] ] - input[1]= [[ id:'map'],[]] """ } } diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf b/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf new file mode 100644 index 000000000000..c40698f0fb20 --- /dev/null +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf @@ -0,0 +1,125 @@ +include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' +include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' +include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index/main.nf' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index/main.nf' + +workflow BAM_VCF_IMPUTE_GLIMPSE2 { + + take: + ch_input // channel (mandatory): [ meta, vcf, csi, list, infos ] + ch_ref // channel (mandatory): [ meta, vcf, csi, region ] + ch_chunks // channel (optional) : [ meta, regionin, regionout ] + ch_map // channel (optional) : [ meta, map ] + ch_fasta // channel (optional) : [ meta, fasta, index ] + chunk // val (optional) : boolean to activate/deactivate chunking step + chunk_model // val (optional) : model file for chunking + splitreference // val (optional) : boolean to activate/deactivate split reference step + + main: + + ch_versions = channel.empty() + + if ( chunk == true ){ + // Error if pre-defined chunks are provided when chunking is activated + ch_chunks + .filter { _meta, regionin, regionout -> regionin.size() > 0 || regionout.size() > 0 } + .subscribe { + error "ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking." + } + + // Chunk reference panel + ch_ref_map = ch_ref + .combine(ch_map, by: 0) + GLIMPSE2_CHUNK ( ch_ref_map, chunk_model ) + ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) + + ch_chunks = GLIMPSE2_CHUNK.out.chunk_chr + .splitCsv(header: [ + 'ID', 'Chr', 'RegionBuf', 'RegionCnk', 'WindowCm', + 'WindowMb', 'NbTotVariants', 'NbComVariants' + ], sep: "\t", skip: 0) + .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]]} + } + + ch_chunks + .filter { _meta, regionin, regionout -> regionin.size() == 0 || regionout.size() == 0 } + .subscribe { + error "ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true." + } + + if ( splitreference == true ) { + // Split reference panel in bin files + split_input = ch_ref + .combine(ch_chunks, by: 0) + .combine(ch_map, by: 0) + .map{ meta, ref, index, _region, regionin, regionout, gmap -> [ + meta + ["regionin": regionin, "regionout": regionout], + ref, index, regionin, regionout, gmap + ] } + + GLIMPSE2_SPLITREFERENCE( split_input ) + ch_versions = ch_versions.mix( GLIMPSE2_SPLITREFERENCE.out.versions.first() ) + + ch_chunks_panel_map = GLIMPSE2_SPLITREFERENCE.out.bin_ref + .map{ meta, bin_ref -> [ meta, [], [], bin_ref, [], [] ] } // Everything is provided by the bin file + } else { + ch_chunks_panel_map = ch_chunks + .combine(ch_ref, by:0) + .combine(ch_map, by:0) + .map{ meta, regionin, regionout, ref, ref_index, _region, gmap -> [ + meta + ["regionin": regionin, "regionout": regionout], + regionin, regionout, ref, ref_index, gmap + ] } + } + + ch_chunks_panel_map.ifEmpty{ + error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." + } + + ch_phase_input = ch_input + .combine(ch_chunks_panel_map) + .map{ metaI, input, index, list, infos, metaCPM, regionin, regionout, panel, panel_index, gmap -> [ + metaI + metaCPM, // combined metadata + input, index, list, infos, // input files + regionin, regionout, // chunk regions + panel, panel_index, gmap // panel and map files + ] } + + // Impute with Glimpse2 + GLIMPSE2_PHASE(ch_phase_input, ch_fasta) + ch_versions = ch_versions.mix( GLIMPSE2_PHASE.out.versions.first() ) + + // Index phased file + BCFTOOLS_INDEX_1(GLIMPSE2_PHASE.out.phased_variants) + ch_versions = ch_versions.mix( BCFTOOLS_INDEX_1.out.versions.first() ) + + // Ligate all phased files in one and index it + ligate_input = GLIMPSE2_PHASE.out.phased_variants + .join( BCFTOOLS_INDEX_1.out.csi ) + .map{ meta, vcf, index -> + def keysToKeep = meta.keySet() - ['regionin', 'regionout'] + [ meta.subMap(keysToKeep), vcf, index ] + } + .groupTuple() + + GLIMPSE2_LIGATE( ligate_input ) + ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + + BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) + ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) + + // Join imputed and index files + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants + .join( + BCFTOOLS_INDEX_2.out.tbi + .mix(BCFTOOLS_INDEX_2.out.csi) + ) + + emit: + ch_chunks = ch_chunks // channel: [ val(meta), regionin, regionout ] + ch_vcf_index = ch_vcf_index // channel: [ val(meta), vcf, csi ] + + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml b/subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml similarity index 56% rename from subworkflows/nf-core/multiple_impute_glimpse2/meta.yml rename to subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml index 6fea6251cc15..41edf1abe46c 100644 --- a/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml @@ -1,4 +1,4 @@ -name: "multiple_impute_glimpse2" +name: "bam_vcf_impute_glimpse2" description: Impute VCF/BCF files, but also CRAM and BAM files with Glimpse2 keywords: - glimpse @@ -18,8 +18,9 @@ input: description: | Target dataset in CRAM, BAM or VCF/BCF format. Index file of the input file. + File containing the list of files to be imputed and their sample names (for CRAM/BAM input). File with sample names and ploidy information. - Structure: [ meta, file, index, txt ] + Structure: [ meta, file, index, bamlist, ploidy ] - ch_ref: type: file description: | @@ -28,10 +29,15 @@ input: Target region, usually a full chromosome (e.g. chr20:1000000-2000000 or chr20). The file could possibly be without GT field (for efficiency reasons a file containing only the positions is recommended). Structure: [ meta, vcf, csi, region ] + - ch_chunks: + type: string + description: | + Channel containing the chunking regions for each chromosome. + Structure: [ meta, region with buffer, region without buffer ] - ch_map: type: file description: | - File containing the genetic map. + Genetic map file for each chromosome. Structure: [ meta, gmap ] - ch_fasta: type: file @@ -39,21 +45,30 @@ input: Reference genome in fasta format. Reference genome index in fai format Structure: [ meta, fasta, fai ] + - chunk: + type: boolean + description: Whether to perform chunking of the input data before imputation. + - chunk_model: + type: string + description: | + Chunking model to use. + Options: "sequential", "recursive" + - splitreference: + type: boolean + description: Whether to split the reference panel and convert it to binary files before imputation. + output: - - chunk_chr: - type: file + - ch_chunks: + type: string description: | - Tab delimited output txt file containing buffer and imputation regions. - Structure: [meta, txt] - - merged_variants: + Channel containing the chunking regions for each chromosome. + Structure: [ meta, region with buffer, region without buffer ] + - ch_vcf_index: type: file description: | Output VCF/BCF file for the merged regions. - Phased information (HS field) is updated accordingly for the full region. - Structure: [ val(meta), bcf ] - - merged_variants_index: - type: file - description: Index file of the ligated phased variants files. + Index file of the output VCF/BCF file. + Structure: [ val(meta), variants, index ] - versions: type: file description: File containing software versions diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test new file mode 100644 index 000000000000..4f530bed1335 --- /dev/null +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test @@ -0,0 +1,471 @@ +nextflow_workflow { + + name "Test Workflow BAM_VCF_IMPUTE_GLIMPSE2" + config "./nextflow.config" + script "../main.nf" + workflow "BAM_VCF_IMPUTE_GLIMPSE2" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "bam_vcf_impute_glimpse2" + tag "subworkflows/bam_vcf_impute_glimpse2" + + tag "glimpse2/chunk" + tag "glimpse2/splitreference" + tag "glimpse2/phase" + tag "glimpse2/ligate" + tag "glimpse2" + tag "bcftools/index" + tag "bcftools" + + test("homo_sapiens - vcf no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk recursive + splitreference") { + when { + workflow { + """ + input[0] = Channel.of([ + [id:'input_vcf'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), + [], [] + ]) // input + input[1] = Channel.of([ + [panel:'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22" + ]) // reference + input[2] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + [], [] + ]) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = true // perform chunking + input[6] = "recursive" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.ch_chunks, + workflow.out.ch_vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + test("homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { + when { + params{ + pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" + } + workflow { + """ + sample = Channel.of('NA12878 2') + .collectFile(name: 'sampleinfos.txt') + input[0] = Channel.of([ + [id:'input_vcf'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), + [] // no list + ]) + .combine(sample) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22:16570065-16609999", + ]) + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], + [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file(params.pipelines_testdata_base_path + "/hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExists: true) + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = false // do not perform chunking + input[6] = "recursive" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.ch_chunks, + workflow.out.ch_vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + test("homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + no splitreference") { + when { + workflow { + """ + sample = Channel.of('NA12878 2') + .collectFile(name: 'sampleinfos.txt') + input[0] = Channel.of([ + [id:'input_vcf'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), + [] // no list + ]) + .combine(sample) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22:16570065-16609999", + ]) + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], + [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/phaseimpute/hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExists: true) + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = false // do not perform chunking + input[6] = "recursive" // chunking model + input[7] = false // no splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.ch_chunks, + workflow.out.ch_vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + test("homo_sapiens - bam no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk sequential + splitreference") { + when { + workflow { + """ + input[0] = Channel.of([ + [id:'input_bam'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai", checkIfExists: true), + [], [] + ]) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22" + ]) + input[2] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + [], [] + ]) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = true // perform chunking + input[6] = "sequential" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.ch_chunks, + workflow.out.ch_vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + test("homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { + when { + params{ + pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" + } + workflow { + """ + bamlist = Channel.of( + "NA12878.s.bam\tSample1", + "NA19401.s.bam\tSample2" + ).collectFile(name: 'bamlist.txt', newLine: true) + sample = Channel.of('NA12878 2') + .collectFile(name: 'sampleinfos.txt') + input[0] = Channel.of([ + [id: "allid"], [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", checkIfExist:true) + ], [ + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true) + ] + ]).combine(bamlist).combine(sample) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz.csi", checkIfExist:true), + "chr22" + ],[ + [panel: 'ref_panel', chr: "21"], + file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.s.norel.vcf.gz", checkIfExist:true), + file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.s.norel.vcf.gz.csi", checkIfExist:true), + "chr21" + ]) // reference + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], + [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"], + [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"], + [[panel: 'ref_panel', chr: "21"], "chr21:16587172-16609999", "chr21:16592229-16609999"] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExist:true) + ],[ + [panel: 'ref_panel', chr: "21"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_chr21.glimpse.map", checkIfExist:true) + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = false // perform chunking + input[6] = "sequential" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.ch_chunks, + workflow.out.ch_vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + test("homo_sapiens - empty channels, chunk sequential + splitreference - stub") { + tag "test" + options "-stub" + when { + params{ + pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" + } + workflow { + """ + input[0] = Channel.of([ + [id: "allid"], + 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: 'ref_panel', chr: "22"], [], [], "chr22" + ],[ + [panel: 'ref_panel', chr: "21"], [], [], "chr21" + ]) // reference + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], [], []], + [[panel: 'ref_panel', chr: "21"], [], []] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [] + ],[ + [panel: 'ref_panel', chr: "21"], [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = true // perform chunking + input[6] = "sequential" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + + test("homo_sapiens - error chunks provided and chunk is true") { + options "-stub" + when { + workflow { + """ + input[0] = Channel.of([ [id: "allid"], [], [], [], [] ]) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [], [], "chr22" + ],[ + [panel: 'ref_panel', chr: "21"], [], [], "chr21" + ]) // reference + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], + [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"], + [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"], + [[panel: 'ref_panel', chr: "21"], "chr21:16587172-16609999", "chr21:16592229-16609999"] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [] + ],[ + [panel: 'ref_panel', chr: "21"], [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = true // perform chunking + input[6] = "sequential" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.failed }, + { assert workflow.errorMessage.contains("ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking.") } + ) + } + } + + test("homo_sapiens - error no chunks provided and chunk is false") { + options "-stub" + when { + workflow { + """ + input[0] = Channel.of([ [id: "allid"], [], [], [], [] ]) + input[1] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [], [], "chr22" + ],[ + [panel: 'ref_panel', chr: "21"], [], [], "chr21" + ]) // reference + input[2] = Channel.of( + [[panel: 'ref_panel', chr: "22"], [], []], + [[panel: 'ref_panel', chr: "21"], [], []] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [] + ],[ + [panel: 'ref_panel', chr: "21"], [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = false // perform chunking + input[6] = "sequential" // chunking model + input[7] = true // splitreference + """ + } + } + then { + assertAll( + { assert workflow.failed }, + { assert workflow.errorMessage.contains("ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true.") } + ) + } + } + + test("homo_sapiens - error empty joint") { + options "-stub" + when { + workflow { + """ + input[0] = Channel.of([ + [id: "allid"], + 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: 'ref_panel', chr: "22"], [], [], "chr22" + ],[ + [panel: 'ref_panel', chr: "21"], [], [], "chr21" + ]) // reference + input[2] = Channel.of( + [[panel: 'ref_panel 2', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], + [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"] + ) // chunks + input[3] = Channel.of([ + [panel: 'ref_panel', chr: "22"], [] + ],[ + [panel: 'ref_panel 1', chr: "21"], [] + ]) // map + input[4] = Channel.of([ + [id_genome:'ref_fasta'], [], [] + ]).collect() // genome + input[5] = false // perform chunking + input[6] = "sequential" // chunking model + input[7] = false // splitreference + """ + } + } + then { + assertAll( + { assert workflow.failed }, + { assert workflow.errorMessage.contains("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } + ) + } + } +} diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap new file mode 100644 index 000000000000..2c5df6ec2b45 --- /dev/null +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap @@ -0,0 +1,524 @@ +{ + "homo_sapiens - vcf no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk recursive + splitreference": { + "content": [ + [ + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-16609999", + "chr22:16570065-16592222" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-16609999", + "chr22:16592223-16609999" + ] + ], + [ + [ + { + "id": "input_vcf", + "panel": "ref_panel", + "chr": "22" + }, + "input_vcf_22.vcf.gz", + "input_vcf_22.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", + [ + "NA12878" + ], + "b9ccc0359ccca0714fca43367538de47" + ] + ], + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:07:17.825740137" + }, + "homo_sapiens - bam no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk sequential + splitreference": { + "content": [ + [ + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:1-16609999", + "chr22:1-16590520" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-1248956422", + "chr22:16590521-1248956422" + ] + ], + [ + [ + { + "id": "input_bam", + "panel": "ref_panel", + "chr": "22" + }, + "input_bam_22.vcf.gz", + "input_bam_22.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]", + [ + "NA12878.chr22.1X" + ], + "661a9923af273601dbf0e7a3a666ebd0" + ] + ], + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:08:29.707313034" + }, + "homo_sapiens - empty channels, chunk sequential + splitreference - stub": { + "content": [ + { + "0": [ + [ + { + "panel": "ref_panel", + "chr": "21" + }, + "0", + "0" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "0", + "0" + ] + ], + "1": [ + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "21" + }, + "allid_21.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "allid_21.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "22" + }, + "allid_22.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "allid_22.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,302281bbff76712870c031340d3819ff", + "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", + "versions.yml:md5,9422ca169a15fd68878396c2837bc185", + "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", + "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", + "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" + ], + "ch_chunks": [ + [ + { + "panel": "ref_panel", + "chr": "21" + }, + "0", + "0" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "0", + "0" + ] + ], + "ch_vcf_index": [ + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "21" + }, + "allid_21.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "allid_21.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "22" + }, + "allid_22.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "allid_22.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,302281bbff76712870c031340d3819ff", + "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", + "versions.yml:md5,9422ca169a15fd68878396c2837bc185", + "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", + "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", + "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" + ] + }, + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:10:17.321588787" + }, + "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + no splitreference": { + "content": [ + [ + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-16597215", + "chr22:16570065-16592216" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16587172-16609999", + "chr22:16592229-16609999" + ] + ], + [ + [ + { + "id": "input_vcf", + "panel": "ref_panel", + "chr": "22" + }, + "input_vcf_22.vcf.gz", + "input_vcf_22.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", + [ + "NA12878" + ], + "a0d696cbdb219c168b6d54fc28c5f7dd" + ] + ], + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:08:13.222110779" + }, + "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { + "content": [ + [ + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-16597215", + "chr22:16570065-16592216" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16587172-16609999", + "chr22:16592229-16609999" + ] + ], + [ + [ + { + "id": "input_vcf", + "panel": "ref_panel", + "chr": "22" + }, + "input_vcf_22.vcf.gz", + "input_vcf_22.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", + [ + "NA12878" + ], + "a0d696cbdb219c168b6d54fc28c5f7dd" + ] + ], + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:07:58.812913099" + }, + "homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { + "content": [ + [ + [ + { + "panel": "ref_panel", + "chr": "21" + }, + "chr21:16570065-16597215", + "chr21:16570065-16592216" + ], + [ + { + "panel": "ref_panel", + "chr": "21" + }, + "chr21:16587172-16609999", + "chr21:16592229-16609999" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16570065-16597215", + "chr22:16570065-16592216" + ], + [ + { + "panel": "ref_panel", + "chr": "22" + }, + "chr22:16587172-16609999", + "chr22:16592229-16609999" + ] + ], + [ + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "21" + }, + "allid_21.vcf.gz", + "allid_21.vcf.gz.csi", + "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=835, phased=true, phasedAutodetect=true]", + [ + "Sample1", + "Sample2" + ], + "ae0f4c66faaf4f854c003fde63dfd8b7" + ], + [ + { + "id": "allid", + "panel": "ref_panel", + "chr": "22" + }, + "allid_22.vcf.gz", + "allid_22.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=true, phasedAutodetect=true]", + [ + "Sample1", + "Sample2" + ], + "39ddb1c4097af57dd843683f7fb77884" + ] + ], + [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-21T12:08:51.548471735" + } +} diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config new file mode 100644 index 000000000000..9cd201b85a2a --- /dev/null +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config @@ -0,0 +1,41 @@ +process { + withName: "GLIMPSE2_CHUNK" { + ext.prefix = { "${meta.panel}_${meta.chr}" } + tag = { "${meta.panel} ${meta.chr}}" } + ext.args = [ + "--window-mb 0.01", + "--window-cm 0.01", + "--window-count 200", + "--buffer-mb 0.005", + "--buffer-cm 0.005", + "--buffer-count 30", + "--seed 1" + ].join(' ') + } + + withName: "GLIMPSE2_SPLITREFERENCE" { + ext.prefix = { "${meta.panel}_${meta.chr}_${meta.regionout}" } + tag = { "${meta.panel} ${meta.chr} ${meta.regionout}" } + ext.args = "--seed 1" + } + + withName: "GLIMPSE2_PHASE" { + ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout}" } + tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } + cpus = 1 + ext.args = "--keep-monomorphic-ref-sites --seed 1" + } + + withName: "BCFTOOLS_INDEX_1" { + tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } + } + + withName: "GLIMPSE2_LIGATE" { + ext.prefix = { "${meta.id}_${meta.chr}" } + tag = { "${meta.id} ${meta.chr}" } + } + + withName: "BCFTOOLS_INDEX_2" { + tag = { "${meta.id} ${meta.chr}" } + } +} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/main.nf b/subworkflows/nf-core/multiple_impute_glimpse2/main.nf deleted file mode 100644 index c9c0022beacc..000000000000 --- a/subworkflows/nf-core/multiple_impute_glimpse2/main.nf +++ /dev/null @@ -1,75 +0,0 @@ -include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' -include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' -include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' -include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' -include { BCFTOOLS_INDEX as INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main.nf' -include { BCFTOOLS_INDEX as INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index/main.nf' - -workflow MULTIPLE_IMPUTE_GLIMPSE2 { - - take: - ch_input // channel (mandatory): [ meta, vcf, csi, infos ] - ch_ref // channel (mandatory): [ meta, vcf, csi, region ] - ch_map // channel (optional) : [ meta, map ] - ch_fasta // channel (optional) : [ meta, fasta, index ] - chunk_model // string: model used to chunk the reference panel - - main: - - ch_versions = channel.empty() - - // Chunk reference panel - ch_ref_map = ch_ref.combine(ch_map, by: 0) - GLIMPSE2_CHUNK ( ch_ref_map, chunk_model ) - ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) - - chunk_output = GLIMPSE2_CHUNK.out.chunk_chr - .splitCsv(header: [ - 'ID', 'Chr', 'RegionBuf', 'RegionCnk', 'WindowCm', - 'WindowMb', 'NbTotVariants', 'NbComVariants' - ], sep: "\t", skip: 0) - .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]]} - - // Split reference panel in bin files - split_input = ch_ref.map{ meta, ref, index, _region -> [meta, ref, index]} - .combine(chunk_output, by: 0) - - GLIMPSE2_SPLITREFERENCE( split_input, ch_map ) - ch_versions = ch_versions.mix( GLIMPSE2_SPLITREFERENCE.out.versions.first() ) - - phase_input = ch_input.combine( GLIMPSE2_SPLITREFERENCE.out.bin_ref ) - .map{ input_meta, input_file, input_index, input_infos, - _panel_meta, panel_bin -> - [input_meta, input_file, input_index, [], input_infos, - [], [], panel_bin, [], []] - }/* Remove unnecessary meta maps - add null index as we use a bin file, - add null value for input and output region as we use a bin file */ - - // Phase input files for each reference bin files + indexing - GLIMPSE2_PHASE ( phase_input, ch_fasta ) // [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map], [ meta, fasta, index ] - ch_versions = ch_versions.mix( GLIMPSE2_PHASE.out.versions.first() ) - - INDEX_PHASE ( GLIMPSE2_PHASE.out.phased_variants ) - ch_versions = ch_versions.mix( INDEX_PHASE.out.versions.first() ) - - // Ligate all phased files in one and index it - ligate_input = GLIMPSE2_PHASE.out.phased_variants - .groupTuple() - .combine( INDEX_PHASE.out.csi - .groupTuple() - .collect(), by: 0 ) - - GLIMPSE2_LIGATE ( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) - - INDEX_LIGATE ( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( INDEX_LIGATE.out.versions.first() ) - - emit: - chunk_chr = GLIMPSE2_CHUNK.out.chunk_chr // channel: [ val(meta), txt ] - merged_variants = GLIMPSE2_LIGATE.out.merged_variants // channel: [ val(meta), bcf ] - merged_variants_index = INDEX_LIGATE.out.csi // channel: [ val(meta), csi ] - - versions = ch_versions // channel: [ versions.yml ] -} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test deleted file mode 100644 index 989bdb8a1ca7..000000000000 --- a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test +++ /dev/null @@ -1,173 +0,0 @@ -nextflow_workflow { - - name "Test Workflow MULTIPLE_IMPUTE_GLIMPSE2" - config "./nextflow.config" - script "../main.nf" - workflow "MULTIPLE_IMPUTE_GLIMPSE2" - - tag "subworkflows" - tag "subworkflows_nfcore" - tag "multiple_impute_glimpse2" - tag "subworkflows/multiple_impute_glimpse2" - - tag "glimpse2/chunk" - tag "glimpse2/splitreference" - tag "glimpse2/phase" - tag "glimpse2/ligate" - tag "glimpse2" - tag "bcftools/index" - tag "bcftools" - - test("homo_sapiens - vcf [] - panel vcf region - [] - [] - recursive") { - when { - workflow { - """ - input[0] = Channel.of([ - [id:'input_vcf'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), - [] - ]) - input[1] = Channel.of([ - [id:'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22", - ]) - input[2] = Channel.of([ - [id: 'ref_panel', chr: "22"], - [] - ]) - input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() - input[4] = "recursive" - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.chunk_chr, - workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, - file(workflow.out.merged_variants_index[0][1]).name, // The .csi index file sometimes change - workflow.out.versions - ).match() } - ) - } - } - test("homo_sapiens - vcf sample - panel vcf - [] - [] - recursive") { - when { - workflow { - """ - sample = Channel.of('NA12878 2') - .collectFile(name: 'sampleinfos.txt') - input[0] = Channel.of([ - [id:'input_vcf'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), - ]).combine(sample) - input[1] = Channel.of([ - [id:'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22:16570065-16609999", - ]) - input[2] = Channel.of([ - [id:'ref_panel', chr: "22"], - [] - ]).collect() - input[3] = Channel.of([ - [id:'ref_fasta'], - [], - [] - ]).collect() - input[4] = "recursive" - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.chunk_chr, - workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, - file(workflow.out.merged_variants_index[0][1]).name, - workflow.out.versions - ).match() } - ) - } - } - test("homo_sapiens - bam [] - panel vcf - [] - [] - sequential") { - when { - workflow { - """ - input[0] = Channel.of([ - [id:'input_bam'], - 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] = Channel.of([ - [id:'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22", - ]) - input[2] = Channel.of([ - [id: 'ref_panel', chr: "22"], - [] - ]) - input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() - input[4] = "sequential" - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.chunk_chr, - workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, - file(workflow.out.merged_variants_index[0][1]).name, - workflow.out.versions - ).match() } - ) - } - } - test("homo_sapiens - bam [] - panel vcf - [] - [] - sequential -- stub") { - tag "stub" - options "-stub" - when { - workflow { - """ - input[0] = input[0] = Channel.of([ - [id:'input_bam'], - 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] = Channel.of([ - [id:'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22", - ]) - input[2] = Channel.of([ - [id: 'ref_panel', chr: "22"], - [] - ]) - input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() - input[4] = "sequential" - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out - ).match() } - ) - } - } -} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap deleted file mode 100644 index 232c67643f96..000000000000 --- a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap +++ /dev/null @@ -1,169 +0,0 @@ -{ - "homo_sapiens - vcf sample - panel vcf - [] - [] - recursive": { - "content": [ - [ - [ - { - "id": "ref_panel", - "chr": "22" - }, - "ref_panel.txt:md5,c363e235162ca0f7d22e5604c192e256" - ] - ], - [ - "9794b042f8c50f7d9a4dbe448de5ed5e" - ], - "input_vcf.vcf.gz.csi", - [ - "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", - "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", - "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", - "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", - "versions.yml:md5,642ed64b13825472557113ba2e4b1566", - "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-27T11:11:34.893641629" - }, - "homo_sapiens - bam [] - panel vcf - [] - [] - sequential": { - "content": [ - [ - [ - { - "id": "ref_panel", - "chr": "22" - }, - "ref_panel.txt:md5,4714831df331b665e634eb1a86a84156" - ] - ], - [ - "49df7da6c9745ba9a86112193ff172a9" - ], - "input_bam.vcf.gz.csi", - [ - "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", - "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", - "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", - "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", - "versions.yml:md5,642ed64b13825472557113ba2e4b1566", - "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-26T21:19:09.9592341" - }, - "homo_sapiens - bam [] - panel vcf - [] - [] - sequential -- stub": { - "content": [ - { - "0": [ - [ - { - "id": "ref_panel", - "chr": "22" - }, - "ref_panel.txt:md5,2fc283dec1e755af6119f2ef6485ceee" - ] - ], - "1": [ - [ - { - "id": "input_bam" - }, - "input_bam.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "2": [ - [ - { - "id": "input_bam" - }, - "input_bam.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "3": [ - "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", - "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", - "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", - "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", - "versions.yml:md5,642ed64b13825472557113ba2e4b1566", - "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" - ], - "chunk_chr": [ - [ - { - "id": "ref_panel", - "chr": "22" - }, - "ref_panel.txt:md5,2fc283dec1e755af6119f2ef6485ceee" - ] - ], - "merged_variants": [ - [ - { - "id": "input_bam" - }, - "input_bam.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" - ] - ], - "merged_variants_index": [ - [ - { - "id": "input_bam" - }, - "input_bam.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", - "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", - "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", - "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", - "versions.yml:md5,642ed64b13825472557113ba2e4b1566", - "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" - ] - } - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.6" - }, - "timestamp": "2025-09-15T07:30:40.001652658" - }, - "homo_sapiens - vcf [] - panel vcf region - [] - [] - recursive": { - "content": [ - [ - [ - { - "id": "ref_panel", - "chr": "22" - }, - "ref_panel.txt:md5,c363e235162ca0f7d22e5604c192e256" - ] - ], - [ - "9794b042f8c50f7d9a4dbe448de5ed5e" - ], - "input_vcf.vcf.gz.csi", - [ - "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", - "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", - "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", - "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", - "versions.yml:md5,642ed64b13825472557113ba2e4b1566", - "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" - ] - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.6" - }, - "timestamp": "2025-09-15T07:29:48.094975599" - } -} \ No newline at end of file diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config b/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config deleted file mode 100644 index e89bc79602dd..000000000000 --- a/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config +++ /dev/null @@ -1,12 +0,0 @@ -process { - withName: "GLIMPSE2_CHUNK" { - ext.args = [ - "--window-mb 0.01", - "--window-cm 0.01", - "--window-count 200", - "--buffer-mb 0.005", - "--buffer-cm 0.005", - "--buffer-count 30" - ].join(' ') - } -} From 669bbcb42c935afcf4067813d41e4c552e50205f Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Mon, 8 Dec 2025 19:39:21 +0100 Subject: [PATCH 02/15] Update test --- .../tests/main.nf.test | 44 +++++++------------ .../tests/main.nf.test.snap | 10 ++--- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test index 4f530bed1335..c5ab9ac2aced 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test @@ -71,9 +71,6 @@ nextflow_workflow { } test("homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { when { - params{ - pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" - } workflow { """ sample = Channel.of('NA12878 2') @@ -97,7 +94,7 @@ nextflow_workflow { ) // chunks input[3] = Channel.of([ [panel: 'ref_panel', chr: "22"], - file(params.pipelines_testdata_base_path + "/hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExists: true) + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists: true) ]) // map input[4] = Channel.of([ [id_genome:'ref_fasta'], [], [] @@ -233,35 +230,32 @@ nextflow_workflow { } test("homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { when { - params{ - pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" - } workflow { """ bamlist = Channel.of( - "NA12878.s.bam\tSample1", - "NA19401.s.bam\tSample2" + "NA12878.chr21_22.1X.bam\tSample1", + "NA19401.chr21_22.1X.bam\tSample2" ).collectFile(name: 'bamlist.txt', newLine: true) sample = Channel.of('NA12878 2') .collectFile(name: 'sampleinfos.txt') input[0] = Channel.of([ [id: "allid"], [ - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam", 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/NA19401.chr21_22.1X.bam", checkIfExists: true) ], [ - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExist:true) + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam.bai", checkIfExists: true) ] ]).combine(bamlist).combine(sample) input[1] = Channel.of([ [panel: 'ref_panel', chr: "22"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/panel/chr22/1000GP.chr22.s.norel.vcf.gz.csi", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22" ],[ [panel: 'ref_panel', chr: "21"], - file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.s.norel.vcf.gz", checkIfExist:true), - file(params.pipelines_testdata_base_path + "hum_data/panel/chr21/1000GP.chr21.s.norel.vcf.gz.csi", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz.csi", checkIfExists:true), "chr21" ]) // reference input[2] = Channel.of( @@ -271,9 +265,9 @@ nextflow_workflow { [[panel: 'ref_panel', chr: "21"], "chr21:16587172-16609999", "chr21:16592229-16609999"] ) // chunks input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExist:true) + [panel: 'ref_panel', chr: "22"], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExist:true) ],[ - [panel: 'ref_panel', chr: "21"], file(params.pipelines_testdata_base_path + "hum_data/reference_genome/GRCh38_chr21.glimpse.map", checkIfExist:true) + [panel: 'ref_panel', chr: "21"], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr21.glimpse.map", checkIfExist:true) ]) // map input[4] = Channel.of([ [id_genome:'ref_fasta'], [], [] @@ -303,18 +297,14 @@ nextflow_workflow { } } test("homo_sapiens - empty channels, chunk sequential + splitreference - stub") { - tag "test" options "-stub" when { - params{ - pipelines_testdata_base_path = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/" - } workflow { """ input[0] = Channel.of([ [id: "allid"], - 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", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr21_22.1X.bam.bai", checkIfExists: true), [], [] ]) input[1] = Channel.of([ @@ -434,8 +424,8 @@ nextflow_workflow { """ input[0] = Channel.of([ [id: "allid"], - 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.chr22.1X.bam", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai", checkIfExists: true), [], [] ]) input[1] = Channel.of([ diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap index 2c5df6ec2b45..d7e3e862c1e0 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap @@ -464,12 +464,12 @@ }, "allid_21.vcf.gz", "allid_21.vcf.gz.csi", - "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=835, phased=true, phasedAutodetect=true]", + "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=836, phased=true, phasedAutodetect=true]", [ "Sample1", "Sample2" ], - "ae0f4c66faaf4f854c003fde63dfd8b7" + "56a7bd192123c52ea77f8b3a59e50342" ], [ { @@ -484,7 +484,7 @@ "Sample1", "Sample2" ], - "39ddb1c4097af57dd843683f7fb77884" + "13cdb23c1074393f9fe53feae397a3df" ] ], [ @@ -519,6 +519,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:08:51.548471735" + "timestamp": "2025-12-08T19:39:08.135355223" } -} +} \ No newline at end of file From 0c14473a9e75ca4572e0e52992e1cda4c73ecdfa Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Wed, 10 Dec 2025 16:40:48 +0100 Subject: [PATCH 03/15] Add region to beagle5 --- modules/nf-core/beagle5/beagle/main.nf | 8 +++++--- .../nf-core/beagle5/beagle/tests/main.nf.test | 20 ++++--------------- .../beagle5/beagle/tests/nextflow.config | 5 ----- 3 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 modules/nf-core/beagle5/beagle/tests/nextflow.config diff --git a/modules/nf-core/beagle5/beagle/main.nf b/modules/nf-core/beagle5/beagle/main.nf index 93ffbc6a3a98..c8a06cad8058 100644 --- a/modules/nf-core/beagle5/beagle/main.nf +++ b/modules/nf-core/beagle5/beagle/main.nf @@ -8,7 +8,7 @@ process BEAGLE5_BEAGLE { 'biocontainers/beagle:5.5_27Feb25.75f--hdfd78af_0' }" input: - tuple val(meta), path(vcf), path(vcf_index), path(refpanel), path(refpanel_index), path(genmap), path(exclsamples), path(exclmarkers) + tuple val(meta), path(vcf), path(vcf_index), path(refpanel), path(refpanel_index), path(genmap), path(exclsamples), path(exclmarkers), val(region) output: tuple val(meta), path("*.vcf.gz"), emit: vcf @@ -22,7 +22,8 @@ process BEAGLE5_BEAGLE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}.bglout" def ref_command = refpanel ? "ref=$refpanel" : "" - def map_command = genmap ? "map=$genmap" : "" + def map_command = genmap ? "map=$genmap" : "" + def region_cmd = region ? "chrom=$region" : "" def excludesamples_command = exclsamples ? "excludesamples=$exclsamples" : "" def excludemarkers_command = exclmarkers ? "excludemarkers=$exclmarkers" : "" @@ -40,8 +41,9 @@ process BEAGLE5_BEAGLE { $args \\ ${ref_command} \\ ${map_command} \\ + ${region_cmd} \\ ${excludesamples_command} \\ - ${excludemarkers_command} \\ + ${excludemarkers_command} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/beagle5/beagle/tests/main.nf.test b/modules/nf-core/beagle5/beagle/tests/main.nf.test index a8aaee4d3402..6fc246197d6c 100644 --- a/modules/nf-core/beagle5/beagle/tests/main.nf.test +++ b/modules/nf-core/beagle5/beagle/tests/main.nf.test @@ -15,16 +15,13 @@ nextflow_process { test("test-beagle5-beagle") { when { - params { - module_args = "" - } process { """ input[0] = [ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), - [], [], [], [], [] + [], [], [], [], [], [] ] """ } @@ -46,9 +43,6 @@ nextflow_process { test("test-beagle5-beagle-ref") { when { - params { - module_args = "chrom=chr22" - } process { """ input[0] = [ @@ -57,7 +51,7 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - [], [], [] + [], [], [], "chr22" ] """ } @@ -78,9 +72,6 @@ nextflow_process { test("test-beagle5-beagle-ref-map") { when { - params { - module_args = "chrom=chr22" - } process { """ input[0] = [ @@ -90,7 +81,7 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.plink.map"), - [], [] + [], [], "chr22" ] """ } @@ -112,16 +103,13 @@ nextflow_process { test("test-beagle5-beagle-ref-map - stub") { options '-stub' when { - params { - module_args = "" - } process { """ input[0] = [ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), - [], [], [], [], [] + [], [], [], [], [], [] ] """ } diff --git a/modules/nf-core/beagle5/beagle/tests/nextflow.config b/modules/nf-core/beagle5/beagle/tests/nextflow.config deleted file mode 100644 index fe87f4a4cf57..000000000000 --- a/modules/nf-core/beagle5/beagle/tests/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - withName: "BEAGLE5_BEAGLE" { - ext.args = params.module_args - } -} From 15c36dfd965be411e2e8703c75e111852d161e4f Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Wed, 10 Dec 2025 21:25:38 +0100 Subject: [PATCH 04/15] Add subworkflow --- .../nf-core/beagle5/beagle/tests/main.nf.test | 2 - .../nf-core/vcf_impute_beagle5/main.nf | 104 ++++++++ .../nf-core/vcf_impute_beagle5/meta.yml | 99 ++++++++ .../vcf_impute_beagle5/tests/main.nf.test | 237 ++++++++++++++++++ .../tests/main.nf.test.snap | 206 +++++++++++++++ .../vcf_impute_beagle5/tests/nextflow.config | 25 ++ 6 files changed, 671 insertions(+), 2 deletions(-) create mode 100644 subworkflows/nf-core/vcf_impute_beagle5/main.nf create mode 100644 subworkflows/nf-core/vcf_impute_beagle5/meta.yml create mode 100644 subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test create mode 100644 subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap create mode 100644 subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config diff --git a/modules/nf-core/beagle5/beagle/tests/main.nf.test b/modules/nf-core/beagle5/beagle/tests/main.nf.test index 6fc246197d6c..6157c15b99d8 100644 --- a/modules/nf-core/beagle5/beagle/tests/main.nf.test +++ b/modules/nf-core/beagle5/beagle/tests/main.nf.test @@ -5,8 +5,6 @@ nextflow_process { script "../main.nf" process "BEAGLE5_BEAGLE" - config "./nextflow.config" - tag "modules" tag "modules_nfcore" tag "beagle5" diff --git a/subworkflows/nf-core/vcf_impute_beagle5/main.nf b/subworkflows/nf-core/vcf_impute_beagle5/main.nf new file mode 100644 index 000000000000..d5bd31f62bc2 --- /dev/null +++ b/subworkflows/nf-core/vcf_impute_beagle5/main.nf @@ -0,0 +1,104 @@ +include { BEAGLE5_BEAGLE } from '../../../modules/nf-core/beagle5/beagle' +include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index' + + + +workflow VCF_IMPUTE_BEAGLE5 { + + take: + ch_input // channel (mandatory): [ [id], vcf, tbi ] + ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] + ch_chunks // channel (optional) : [ [panel, chr], regionout ] + ch_map // channel (optional) : [ [chr], map] + + main: + + ch_versions = channel.empty() + + // Branch input files based on format + ch_input + .branch { _meta, vcf, _tbi -> + bcf: vcf.toString().contains('.bcf') + vcf: vcf.toString().contains('.vcf') + other: true + } + .set { ch_input_branched } + + ch_input_branched.other.map{ + error "ERROR: ch_input files must be in VCF or BCF format." + } + + // Convert BCF to VCF if necessary + BCFTOOLS_VIEW( + ch_input_branched.bcf, + [], [], [] + ) + ch_versions = ch_versions.mix(BCFTOOLS_VIEW.out.versions.first()) + + // Combine VCF files + ch_ready_vcf = ch_input_branched.vcf + .mix(BCFTOOLS_VIEW.out.vcf + .join( + BCFTOOLS_VIEW.out.csi + .mix(BCFTOOLS_VIEW.out.tbi) + ) + ) + + // Prepare input channels for BEAGLE5 by combining VCF, panel, and map files + ch_panel_map = ch_panel + .combine(ch_map, by: 0) + .combine(ch_chunks, by: 0) + + ch_panel_map.ifEmpty{ + error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input." + } + + ch_beagle_input = ch_ready_vcf + .combine(ch_panel_map) + .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout -> [ + metaI + metaPC + ["regionout": regionout], + input_vcf, input_index, + panel_vcf, panel_index, + map, [], [], regionout + ]} + + // Run BEAGLE5 imputation + BEAGLE5_BEAGLE(ch_beagle_input) + ch_versions = ch_versions.mix(BEAGLE5_BEAGLE.out.versions.first()) + + // Index the imputed VCF files + BCFTOOLS_INDEX_1(BEAGLE5_BEAGLE.out.vcf) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_1.out.versions.first()) + + // Ligate all phased files in one and index it + ligate_input = BEAGLE5_BEAGLE.out.vcf + .join( + BCFTOOLS_INDEX_1.out.tbi + .mix(BCFTOOLS_INDEX_1.out.csi) + ) + .map{ meta, vcf, index -> + def keysToKeep = meta.keySet() - ['regionout'] + [ meta.subMap(keysToKeep), vcf, index ] + } + .groupTuple() + + GLIMPSE2_LIGATE( ligate_input ) + ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + + BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) + ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) + + // Join imputed and index files + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants + .join( + BCFTOOLS_INDEX_2.out.tbi + .mix(BCFTOOLS_INDEX_2.out.csi) + ) + + emit: + vcf_index = ch_vcf_index // channel: [ [id, chr, tools], vcf, index ] + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/nf-core/vcf_impute_beagle5/meta.yml b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml new file mode 100644 index 000000000000..f97d42499d9d --- /dev/null +++ b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml @@ -0,0 +1,99 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: VCF_IMPUTE_BEAGLE5 +description: | + Subworkflow to impute VCF files using BEAGLE5 software. The subworkflow + takes VCF files, phased reference panel, genetic maps and chunks region to perform imputation + and outputs phased and imputed VCF files. + Meta map of all channels, except ch_input, will be used to perform joint operations. + "regionout" key will be added to the meta map to distinguish the different file + before ligation and therefore should not be used. +keywords: + - VCF + - imputation + - beagle5 + - phasing +components: + - beagle5/beagle + - bcftools/index + - glimpse2/ligate +input: + - ch_input: + description: Channel with input data + structure: + - meta: + type: map + description: | + Metadata map containing sample information + - vcf: + type: file + description: Input VCF files + pattern: "*.{vcf,bcf}{.gz}?" + - index: + type: file + description: Input index file + pattern: "*.{tbi,csi}" + - ch_panel: + description: Channel with phased reference panel data + structure: + - meta: + type: map + description: | + Metadata map that will be combined with the input data map + - vcf: + type: file + description: Reference panel VCF files by chromosomes + pattern: "*.{vcf,bcf,vcf.gz}" + - index: + type: file + description: Reference panel VCF index files + pattern: "*.{tbi,csi}" + - ch_chunks: + description: Channel containing the region to impute + structure: + - meta: + type: map + description: | + Metadata map containing chromosome information + - regionout: + type: string + description: Region to perform the phasing on + pattern: "[chr]+[0-9]+:[0-9]+-[0-9]+" + - ch_map: + description: Channel with genetic map data + structure: + - meta: + type: map + description: | + Metadata map containing chromosome information + - map: + type: file + description: Plink format genetic map files + pattern: "*.map" +output: + - vcf_index: + description: Channel with imputed and phased VCF files + structure: + - meta: + type: map + description: | + Metadata map of the target input file combined with the reference panel map. + - vcf: + type: file + description: VCF imputed and phased file by sample + 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 +authors: + - "@LouisLeNezet" + - "@gichas" +maintainers: + - "@LouisLeNezet" + - "@gichas" diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test new file mode 100644 index 000000000000..981dfffbef5c --- /dev/null +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test @@ -0,0 +1,237 @@ +nextflow_workflow { + + name "Test Subworkflow VCF_IMPUTE_BEAGLE5" + script "../main.nf" + workflow "VCF_IMPUTE_BEAGLE5" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "subworkflows/vcf_impute_beagle5" + + config "./nextflow.config" + + tag "beagle5" + tag "beagle5/beagle" + tag "bcftools" + tag "bcftools/index" + tag "glimpse2" + tag "glimpse2/ligate" + + + test("Impute with beagle5 one vcf - panel - whole chromosome - no map - one chromosomes") { + when { + workflow { + """ + input[0] = Channel.of([ + [id: "NA12878"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExist:true) + ]) + input[1] = Channel.of([ + [panel: "1000GP", chr: "chr22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExist:true) + ]) + input[2] = Channel.of([[panel: "1000GP", chr: "chr22"], "chr22"]) // chunks + input[3] = Channel.of([[panel: "1000GP", chr: "chr22"], []]) + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + + test("Impute with beagle5 one bcf gz - panel - map - chunks - two chrosomes") { + tag "test" + setup { + run ("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_BCF" ) { + script "../../../../modules/nf-core/bcftools/view" + process { + """ + input[0] = channel.of([ + [id: "NA12878"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExist:true) + ]) + input[1] = [] + input[2] = [] + input[3] = [] + """ + } + } + } + when { + params { + bcftools_view_args = "--write-index=csi --output-type b" + } + workflow { + """ + input[0] = BCFTOOLS_VIEW_BCF.out.vcf.join(BCFTOOLS_VIEW_BCF.out.csi) + input[1] = channel.of([ + [panel: "1000GP", chr: "chr22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExist:true) + ],[ + [panel: "1000GP", chr: "chr21"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz.csi", checkIfExist:true) + ]) + input[2] = channel.of( + [[chr: "chr22", panel: "1000GP"], "chr22:16570065-16592216"], + [[chr: "chr22", panel: "1000GP"], "chr22:16592229-16609999"], + [[chr: "chr21", panel: "1000GP"], "chr21:16570065-16592216"], + [[chr: "chr21", panel: "1000GP"], "chr21:16592229-16609999"] + ) + input[3] = channel.of([ + [panel: "1000GP", chr: "chr22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.plink.map", checkIfExist:true) + ],[ + [panel: "1000GP", chr: "chr21"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr21.plink.map", checkIfExist:true) + ]) + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.vcf_index.collect{[ + it[0], + path(it[1]).getFileName().toString(), + path(it[2]).getFileName().toString(), + path(it[1]).vcf.summary, + path(it[1]).vcf.header.getGenotypeSamples().sort(), + path(it[1]).vcf.variantsMD5 + ]}, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + + test("homo_sapiens - empty channels - stub") { + options "-stub" + when { + workflow { + """ + input[0] = channel.of([ + [id: "NA12878"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExist:true) + ]) + input[1] = channel.of( + [[panel: "1000GP", chr: "chr22"], [], []], + [[panel: "1000GP", chr: "chr21"], [], []] + ) + input[2] = channel.of( + [[chr: "chr22", panel: "1000GP"], "chr22:16570065-16592216"], + [[chr: "chr22", panel: "1000GP"], "chr22:16592229-16609999"], + [[chr: "chr21", panel: "1000GP"], "chr21:16570065-16592216"], + [[chr: "chr21", panel: "1000GP"], "chr21:16592229-16609999"] + ) + input[3] = channel.of( + [[panel: "1000GP", chr: "chr22"], []], + [[panel: "1000GP", chr: "chr21"], []] + ) + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out, + workflow.out.versions.collect{ path(it).yaml } + ).match() } + ) + } + } + + test("homo_sapiens - error wrong input format - stub") { + options "-stub" + when { + workflow { + """ + input[0] = channel.of([ + [id: "NA12878"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.minimac.map", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExist:true) + ]) + input[1] = channel.of( + [[panel: "1000GP", chr: "chr22"], [], []], + [[panel: "1000GP", chr: "chr21"], [], []] + ) + input[2] = channel.of( + [[chr: "chr22", panel: "1000GP"], "chr22:16570065-16592216"], + [[chr: "chr22", panel: "1000GP"], "chr22:16592229-16609999"], + [[chr: "chr21", panel: "1000GP"], "chr21:16570065-16592216"], + [[chr: "chr21", panel: "1000GP"], "chr21:16592229-16609999"] + ) + input[3] = channel.of( + [[panel: "1000GP", chr: "chr22"], []], + [[panel: "1000GP", chr: "chr21"], []] + ) + """ + } + } + then { + assertAll( + { assert workflow.failed }, + { assert workflow.errorMessage.contains("ERROR: ch_input files must be in VCF or BCF format.") } + ) + } + } + + test("homo_sapiens - error empty joint - stub") { + options "-stub" + when { + workflow { + """ + input[0] = channel.of([ + [id: "NA12878"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExist:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExist:true) + ]) + input[1] = channel.of( + [[panel: "1000GP_1", chr: "chr22"], [], []], // Wrong panel + [[panel: "1000GP", chr: "chr21"], [], []] + ) + input[2] = channel.of( + [[chr: "chr22", panel: "1000GP"], "chr22:16570065-16592216"], + [[chr: "chr22", panel: "1000GP"], "chr22:16592229-16609999"], + [[chr: "chr21", panel: "1000GP"], "chr21:16570065-16592216"], + [[chr: "chr21", panel: "1000GP"], "chr21:16592229-16609999"] + ) + input[3] = channel.of( + [[panel: "1000GP", chr: "chr22"], []], + [[panel: "1000GP_1", chr: "chr21"], []] // Wrong panel + ) + """ + } + } + then { + assertAll( + { assert workflow.failed }, + { assert workflow.errorMessage.contains("ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input.") } + ) + } + } +} diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap new file mode 100644 index 000000000000..cf49c05ea77c --- /dev/null +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap @@ -0,0 +1,206 @@ +{ + "Impute with beagle5 one vcf - panel - whole chromosome - no map - one chromosomes": { + "content": [ + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr22" + }, + "NA12878_chr22.ligate.vcf.gz", + "NA12878_chr22.ligate.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]", + [ + "NA12878" + ], + "9cab6e975108d5f6dbb7773b794711c2" + ] + ], + [ + "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" + ], + [ + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" + } + }, + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-10T21:05:04.415254164" + }, + "homo_sapiens - empty channels - stub": { + "content": [ + { + "0": [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr21" + }, + "NA12878_chr21.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "NA12878_chr21.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr22" + }, + "NA12878_chr22.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "NA12878_chr22.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" + ], + "vcf_index": [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr21" + }, + "NA12878_chr21.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "NA12878_chr21.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr22" + }, + "NA12878_chr22.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "NA12878_chr22.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" + ] + }, + [ + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" + } + }, + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-10T21:12:57.511570759" + }, + "Impute with beagle5 one bcf gz - panel - map - chunks - two chrosomes": { + "content": [ + [ + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr21" + }, + "NA12878_chr21.ligate.vcf.gz", + "NA12878_chr21.ligate.vcf.gz.csi", + "VcfFile [chromosomes=[chr21], sampleCount=1, variantCount=836, phased=true, phasedAutodetect=true]", + [ + "NA12878" + ], + "70c852b39eb228a54fabc564d7e536e4" + ], + [ + { + "id": "NA12878", + "panel": "1000GP", + "chr": "chr22" + }, + "NA12878_chr22.ligate.vcf.gz", + "NA12878_chr22.ligate.vcf.gz.csi", + "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]", + [ + "NA12878" + ], + "9cab6e975108d5f6dbb7773b794711c2" + ] + ], + [ + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" + } + }, + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_VIEW": { + "bcftools": 1.22 + } + }, + { + "VCF_IMPUTE_BEAGLE5:GLIMPSE2_LIGATE": { + "glimpse2": "2.0.0" + } + } + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-10T21:24:58.930834598" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config new file mode 100644 index 000000000000..15a5250de812 --- /dev/null +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config @@ -0,0 +1,25 @@ +process { + withName: BCFTOOLS_VIEW { + ext.args = { "--write-index=tbi --output-type z" } + } + + withName: BEAGLE5_BEAGLE { + ext.prefix = { "${meta.id}_${meta.regionout}" } + } + + withName: GLIMPSE2_LIGATE { + ext.prefix = { "${meta.id}_${meta.chr}.ligate" } + } + + withName: BCFTOOLS_INDEX_1 { + ext.args = '--tbi' + } + + withName: BCFTOOLS_INDEX_2 { + ext.args = '--csi' + } + + withName: BCFTOOLS_VIEW_BCF { + ext.args = { params.bcftools_view_args ?: "" } + } +} \ No newline at end of file From 6d3183b4675cdc9ad4cf2abf1707b75d59794bc4 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Wed, 10 Dec 2025 21:29:24 +0100 Subject: [PATCH 05/15] Fix linting --- subworkflows/nf-core/vcf_impute_beagle5/meta.yml | 1 + subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test | 1 + subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/subworkflows/nf-core/vcf_impute_beagle5/meta.yml b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml index f97d42499d9d..5fae42e0130c 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/meta.yml +++ b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml @@ -15,6 +15,7 @@ keywords: components: - beagle5/beagle - bcftools/index + - bcftools/view - glimpse2/ligate input: - ch_input: diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test index 981dfffbef5c..fdcb8d69bc5b 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test @@ -14,6 +14,7 @@ nextflow_workflow { tag "beagle5/beagle" tag "bcftools" tag "bcftools/index" + tag "bcftools/view" tag "glimpse2" tag "glimpse2/ligate" diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap index cf49c05ea77c..7cc5ac55c9c5 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap @@ -201,6 +201,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-10T21:24:58.930834598" + "timestamp": "2025-12-10T21:28:55.484413804" } } \ No newline at end of file From d217af1f1ba32f018e5eaa12ca057e6c8ad7c101 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Wed, 10 Dec 2025 21:39:50 +0100 Subject: [PATCH 06/15] Fix linting --- modules/nf-core/beagle5/beagle/meta.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/nf-core/beagle5/beagle/meta.yml b/modules/nf-core/beagle5/beagle/meta.yml index 100d915bc59e..8f32c9a7c7ea 100644 --- a/modules/nf-core/beagle5/beagle/meta.yml +++ b/modules/nf-core/beagle5/beagle/meta.yml @@ -57,6 +57,10 @@ input: the analysis pattern: "*.*" ontologies: [] + - region: + type: string + description: Region to perform imputation + pattern: "(chr)?\\d*:\\d*-\\d*" output: vcf: - - meta: From 4422555a20fde16e74848a547df0bbbd2edc1654 Mon Sep 17 00:00:00 2001 From: LouisLeNezet Date: Wed, 10 Dec 2025 21:41:48 +0100 Subject: [PATCH 07/15] Fix linting --- subworkflows/nf-core/vcf_impute_beagle5/main.nf | 5 +---- .../nf-core/vcf_impute_beagle5/tests/nextflow.config | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/subworkflows/nf-core/vcf_impute_beagle5/main.nf b/subworkflows/nf-core/vcf_impute_beagle5/main.nf index d5bd31f62bc2..448c0a78ce94 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/main.nf +++ b/subworkflows/nf-core/vcf_impute_beagle5/main.nf @@ -4,8 +4,6 @@ include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/gl include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index' include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index' - - workflow VCF_IMPUTE_BEAGLE5 { take: @@ -15,7 +13,6 @@ workflow VCF_IMPUTE_BEAGLE5 { ch_map // channel (optional) : [ [chr], map] main: - ch_versions = channel.empty() // Branch input files based on format @@ -26,7 +23,7 @@ workflow VCF_IMPUTE_BEAGLE5 { other: true } .set { ch_input_branched } - + ch_input_branched.other.map{ error "ERROR: ch_input files must be in VCF or BCF format." } diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config index 15a5250de812..81b95383a5e9 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config @@ -22,4 +22,4 @@ process { withName: BCFTOOLS_VIEW_BCF { ext.args = { params.bcftools_view_args ?: "" } } -} \ No newline at end of file +} From a15d833151108f33008475b86ca5be340db1b173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Le=20N=C3=A9zet?= <58640615+LouisLeNezet@users.noreply.github.com> Date: Thu, 11 Dec 2025 09:59:16 +0100 Subject: [PATCH 08/15] Update subworkflows/nf-core/vcf_impute_beagle5/main.nf Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> --- subworkflows/nf-core/vcf_impute_beagle5/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subworkflows/nf-core/vcf_impute_beagle5/main.nf b/subworkflows/nf-core/vcf_impute_beagle5/main.nf index 448c0a78ce94..b13e8500e908 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/main.nf +++ b/subworkflows/nf-core/vcf_impute_beagle5/main.nf @@ -18,8 +18,8 @@ workflow VCF_IMPUTE_BEAGLE5 { // Branch input files based on format ch_input .branch { _meta, vcf, _tbi -> - bcf: vcf.toString().contains('.bcf') - vcf: vcf.toString().contains('.vcf') + bcf: vcf.baseName.contains('.bcf') + vcf: vcf.baseName.contains('.vcf') other: true } .set { ch_input_branched } From 24f0c1fec228f5bb6cd3b7ebf0dad4f032383d4a Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 10:42:09 +0100 Subject: [PATCH 09/15] Add comment --- modules/nf-core/beagle5/beagle/main.nf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/nf-core/beagle5/beagle/main.nf b/modules/nf-core/beagle5/beagle/main.nf index c8a06cad8058..e66c9e40b019 100644 --- a/modules/nf-core/beagle5/beagle/main.nf +++ b/modules/nf-core/beagle5/beagle/main.nf @@ -8,6 +8,8 @@ process BEAGLE5_BEAGLE { 'biocontainers/beagle:5.5_27Feb25.75f--hdfd78af_0' }" input: + // Including `val(region)` to prevent errors with multi-chromosome VCFs and single-chromosome reference panels. + // This enhances clarity and simplifies implementation in the subworkflow. tuple val(meta), path(vcf), path(vcf_index), path(refpanel), path(refpanel_index), path(genmap), path(exclsamples), path(exclmarkers), val(region) output: From 11298c74f6a89a1ea8191bf34ca2f8947da31392 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 10:43:23 +0100 Subject: [PATCH 10/15] Update grouping and test --- .../nf-core/vcf_impute_beagle5/main.nf | 57 ++++++++++++------- .../nf-core/vcf_impute_beagle5/meta.yml | 4 +- .../vcf_impute_beagle5/tests/main.nf.test | 4 +- .../tests/main.nf.test.snap | 54 +++++++++--------- .../vcf_impute_beagle5/tests/nextflow.config | 4 +- 5 files changed, 69 insertions(+), 54 deletions(-) diff --git a/subworkflows/nf-core/vcf_impute_beagle5/main.nf b/subworkflows/nf-core/vcf_impute_beagle5/main.nf index b13e8500e908..3ccb03229b61 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/main.nf +++ b/subworkflows/nf-core/vcf_impute_beagle5/main.nf @@ -1,8 +1,8 @@ -include { BEAGLE5_BEAGLE } from '../../../modules/nf-core/beagle5/beagle' -include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view' -include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index' +include { BEAGLE5_BEAGLE } from '../../../modules/nf-core/beagle5/beagle' +include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_BEAGLE } from '../../../modules/nf-core/bcftools/index' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index' workflow VCF_IMPUTE_BEAGLE5 { @@ -18,14 +18,14 @@ workflow VCF_IMPUTE_BEAGLE5 { // Branch input files based on format ch_input .branch { _meta, vcf, _tbi -> - bcf: vcf.baseName.contains('.bcf') - vcf: vcf.baseName.contains('.vcf') + bcf: vcf.name.contains('.bcf') + vcf: vcf.name.contains('.vcf') other: true } .set { ch_input_branched } - ch_input_branched.other.map{ - error "ERROR: ch_input files must be in VCF or BCF format." + ch_input_branched.other.map{ _meta, vcf, _tbi -> + error "ERROR: ${vcf.name} in ch_input channel must be in VCF or BCF format." } // Convert BCF to VCF if necessary @@ -45,9 +45,16 @@ workflow VCF_IMPUTE_BEAGLE5 { ) // Prepare input channels for BEAGLE5 by combining VCF, panel, and map files + ch_chunks_counts = ch_chunks + .groupTuple() + .map { metaPC, regionouts -> + [metaPC, regionouts.size()] + } + ch_panel_map = ch_panel .combine(ch_map, by: 0) .combine(ch_chunks, by: 0) + .combine(ch_chunks_counts, by: 0) ch_panel_map.ifEmpty{ error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input." @@ -55,8 +62,8 @@ workflow VCF_IMPUTE_BEAGLE5 { ch_beagle_input = ch_ready_vcf .combine(ch_panel_map) - .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout -> [ - metaI + metaPC + ["regionout": regionout], + .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout, regionsize -> [ + metaI + metaPC + ["regionout": regionout, "regionsize": regionsize], input_vcf, input_index, panel_vcf, panel_index, map, [], [], regionout @@ -67,32 +74,40 @@ workflow VCF_IMPUTE_BEAGLE5 { ch_versions = ch_versions.mix(BEAGLE5_BEAGLE.out.versions.first()) // Index the imputed VCF files - BCFTOOLS_INDEX_1(BEAGLE5_BEAGLE.out.vcf) - ch_versions = ch_versions.mix(BCFTOOLS_INDEX_1.out.versions.first()) + BCFTOOLS_INDEX_BEAGLE(BEAGLE5_BEAGLE.out.vcf) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_BEAGLE.out.versions.first()) // Ligate all phased files in one and index it ligate_input = BEAGLE5_BEAGLE.out.vcf .join( - BCFTOOLS_INDEX_1.out.tbi - .mix(BCFTOOLS_INDEX_1.out.csi) + BCFTOOLS_INDEX_BEAGLE.out.tbi + .mix(BCFTOOLS_INDEX_BEAGLE.out.csi) ) .map{ meta, vcf, index -> - def keysToKeep = meta.keySet() - ['regionout'] - [ meta.subMap(keysToKeep), vcf, index ] + def keysToKeep = meta.keySet() - ['regionout', 'regionsize'] + [ + groupKey(meta.subMap(keysToKeep), meta.regionsize), + vcf, index + ] } .groupTuple() + .map{ groupKeyObj, vcf, index -> + // Extract the actual meta from the groupKey + def meta = groupKeyObj.getGroupTarget() + [meta, vcf, index] + } GLIMPSE2_LIGATE( ligate_input ) ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) - BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) + BCFTOOLS_INDEX_LIGATE( GLIMPSE2_LIGATE.out.merged_variants ) + ch_versions = ch_versions.mix( BCFTOOLS_INDEX_LIGATE.out.versions.first() ) // Join imputed and index files ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants .join( - BCFTOOLS_INDEX_2.out.tbi - .mix(BCFTOOLS_INDEX_2.out.csi) + BCFTOOLS_INDEX_LIGATE.out.tbi + .mix(BCFTOOLS_INDEX_LIGATE.out.csi) ) emit: diff --git a/subworkflows/nf-core/vcf_impute_beagle5/meta.yml b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml index 5fae42e0130c..a207e20bdfd1 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/meta.yml +++ b/subworkflows/nf-core/vcf_impute_beagle5/meta.yml @@ -5,8 +5,8 @@ description: | takes VCF files, phased reference panel, genetic maps and chunks region to perform imputation and outputs phased and imputed VCF files. Meta map of all channels, except ch_input, will be used to perform joint operations. - "regionout" key will be added to the meta map to distinguish the different file - before ligation and therefore should not be used. + "regionout" and "regionsize" keys will be added to the meta map to distinguish the different + file before ligation and therefore should not be used. keywords: - VCF - imputation diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test index fdcb8d69bc5b..d7c141ce195f 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test @@ -59,7 +59,6 @@ nextflow_workflow { } test("Impute with beagle5 one bcf gz - panel - map - chunks - two chrosomes") { - tag "test" setup { run ("BCFTOOLS_VIEW", alias: "BCFTOOLS_VIEW_BCF" ) { script "../../../../modules/nf-core/bcftools/view" @@ -129,6 +128,7 @@ nextflow_workflow { } test("homo_sapiens - empty channels - stub") { + tag "test" options "-stub" when { workflow { @@ -196,7 +196,7 @@ nextflow_workflow { then { assertAll( { assert workflow.failed }, - { assert workflow.errorMessage.contains("ERROR: ch_input files must be in VCF or BCF format.") } + { assert workflow.errorMessage.contains("ERROR: genome.GRCh38.chr22.minimac.map in ch_input channel must be in VCF or BCF format.") } ) } } diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap index 7cc5ac55c9c5..36c113694362 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap @@ -18,14 +18,14 @@ ] ], [ - "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", - "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ], [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { "bcftools": 1.22 } }, @@ -35,7 +35,7 @@ } }, { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -50,7 +50,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-10T21:05:04.415254164" + "timestamp": "2025-12-11T10:40:58.515114119" }, "homo_sapiens - empty channels - stub": { "content": [ @@ -59,8 +59,8 @@ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr21" + "chr": "chr21", + "panel": "1000GP" }, "NA12878_chr21.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", "NA12878_chr21.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" @@ -68,25 +68,25 @@ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr22" + "chr": "chr22", + "panel": "1000GP" }, "NA12878_chr22.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", "NA12878_chr22.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "1": [ - "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", - "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ], "vcf_index": [ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr21" + "chr": "chr21", + "panel": "1000GP" }, "NA12878_chr21.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", "NA12878_chr21.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" @@ -94,23 +94,23 @@ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr22" + "chr": "chr22", + "panel": "1000GP" }, "NA12878_chr22.ligate.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", "NA12878_chr22.ligate.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" ] ], "versions": [ - "versions.yml:md5,2287e2fdf9f0e754cb73fab98d1a407c", + "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", - "versions.yml:md5,735a6ce4c760e4957c04b9b444953924", + "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ] }, [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { "bcftools": 1.22 } }, @@ -120,7 +120,7 @@ } }, { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -135,7 +135,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-10T21:12:57.511570759" + "timestamp": "2025-12-11T10:37:59.303608442" }, "Impute with beagle5 one bcf gz - panel - map - chunks - two chrosomes": { "content": [ @@ -143,8 +143,8 @@ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr21" + "chr": "chr21", + "panel": "1000GP" }, "NA12878_chr21.ligate.vcf.gz", "NA12878_chr21.ligate.vcf.gz.csi", @@ -157,8 +157,8 @@ [ { "id": "NA12878", - "panel": "1000GP", - "chr": "chr22" + "chr": "chr22", + "panel": "1000GP" }, "NA12878_chr22.ligate.vcf.gz", "NA12878_chr22.ligate.vcf.gz.csi", @@ -171,7 +171,7 @@ ], [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_1": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { "bcftools": 1.22 } }, @@ -181,7 +181,7 @@ } }, { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_2": { + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -201,6 +201,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-10T21:28:55.484413804" + "timestamp": "2025-12-11T10:41:17.021023357" } } \ No newline at end of file diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config index 81b95383a5e9..9be75a1c7cb9 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config @@ -11,11 +11,11 @@ process { ext.prefix = { "${meta.id}_${meta.chr}.ligate" } } - withName: BCFTOOLS_INDEX_1 { + withName: BCFTOOLS_INDEX_BEAGLE { ext.args = '--tbi' } - withName: BCFTOOLS_INDEX_2 { + withName: BCFTOOLS_INDEX_LIGATE { ext.args = '--csi' } From d62764d54d3007a98d3b542f1da57f337649a552 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 10:49:15 +0100 Subject: [PATCH 11/15] Remove tag --- subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test | 1 - 1 file changed, 1 deletion(-) diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test index d7c141ce195f..448d23769d66 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test @@ -128,7 +128,6 @@ nextflow_workflow { } test("homo_sapiens - empty channels - stub") { - tag "test" options "-stub" when { workflow { From b753925e4a3b6ad5176c66db8f55de4f6400ae64 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 10:58:26 +0100 Subject: [PATCH 12/15] Revert change glimpse2 reference --- modules/nf-core/glimpse2/splitreference/main.nf | 3 ++- modules/nf-core/glimpse2/splitreference/meta.yml | 5 +++++ .../glimpse2/splitreference/tests/main.nf.test | 12 +++++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/glimpse2/splitreference/main.nf b/modules/nf-core/glimpse2/splitreference/main.nf index 0311e09dabc2..019072b8689d 100644 --- a/modules/nf-core/glimpse2/splitreference/main.nf +++ b/modules/nf-core/glimpse2/splitreference/main.nf @@ -18,7 +18,8 @@ process GLIMPSE2_SPLITREFERENCE { 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" input: - tuple val(meta) , path(reference), path(reference_index), val(input_region), val(output_region), path(map) + tuple val(meta) , path(reference), path(reference_index), val(input_region), val(output_region) + tuple val(meta2), path(map) output: diff --git a/modules/nf-core/glimpse2/splitreference/meta.yml b/modules/nf-core/glimpse2/splitreference/meta.yml index ed6b63ee03ad..161dab0d5781 100644 --- a/modules/nf-core/glimpse2/splitreference/meta.yml +++ b/modules/nf-core/glimpse2/splitreference/meta.yml @@ -42,6 +42,11 @@ input: type: string description: Target imputed region, excluding left and right buffers (e.g. chr20:1000000-2000000). pattern: "chrXX:leftBufferPosition-rightBufferPosition" + - - meta2: + type: map + description: | + Groovy Map containing genomic map information + e.g. `[ map:'GRCh38' ]` - map: type: file description: File containing the genetic map. diff --git a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test index 9c353df2f643..022ec828fddd 100644 --- a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test +++ b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test @@ -20,9 +20,9 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000", - [] + "chr22:16600000-16800000" ] + input[1]= [[ id:'map'],[]] """ } } @@ -48,7 +48,9 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000", + "chr22:16600000-16800000" + input[1]= [ + [ id:'map'], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists:true) ] """ @@ -77,9 +79,9 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", - "chr22:16600000-16800000", - [] + "chr22:16600000-16800000" ] + input[1]= [[ id:'map'],[]] """ } } From b3761db1bf123e43ada607a4823bba65ccedd92c Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 11:04:45 +0100 Subject: [PATCH 13/15] Revert change glimpse2 sbwf --- .../nf-core/bam_vcf_impute_glimpse2/main.nf | 125 ----- .../tests/main.nf.test | 461 --------------- .../tests/main.nf.test.snap | 524 ------------------ .../tests/nextflow.config | 41 -- .../nf-core/multiple_impute_glimpse2/main.nf | 75 +++ .../meta.yml | 40 +- .../tests/main.nf.test | 173 ++++++ .../tests/main.nf.test.snap | 169 ++++++ .../tests/nextflow.config | 12 + 9 files changed, 442 insertions(+), 1178 deletions(-) delete mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf delete mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test delete mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap delete mode 100644 subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config create mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/main.nf rename subworkflows/nf-core/{bam_vcf_impute_glimpse2 => multiple_impute_glimpse2}/meta.yml (56%) create mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test create mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap create mode 100644 subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf b/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf deleted file mode 100644 index c40698f0fb20..000000000000 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf +++ /dev/null @@ -1,125 +0,0 @@ -include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' -include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' -include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' -include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index/main.nf' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index/main.nf' - -workflow BAM_VCF_IMPUTE_GLIMPSE2 { - - take: - ch_input // channel (mandatory): [ meta, vcf, csi, list, infos ] - ch_ref // channel (mandatory): [ meta, vcf, csi, region ] - ch_chunks // channel (optional) : [ meta, regionin, regionout ] - ch_map // channel (optional) : [ meta, map ] - ch_fasta // channel (optional) : [ meta, fasta, index ] - chunk // val (optional) : boolean to activate/deactivate chunking step - chunk_model // val (optional) : model file for chunking - splitreference // val (optional) : boolean to activate/deactivate split reference step - - main: - - ch_versions = channel.empty() - - if ( chunk == true ){ - // Error if pre-defined chunks are provided when chunking is activated - ch_chunks - .filter { _meta, regionin, regionout -> regionin.size() > 0 || regionout.size() > 0 } - .subscribe { - error "ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking." - } - - // Chunk reference panel - ch_ref_map = ch_ref - .combine(ch_map, by: 0) - GLIMPSE2_CHUNK ( ch_ref_map, chunk_model ) - ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) - - ch_chunks = GLIMPSE2_CHUNK.out.chunk_chr - .splitCsv(header: [ - 'ID', 'Chr', 'RegionBuf', 'RegionCnk', 'WindowCm', - 'WindowMb', 'NbTotVariants', 'NbComVariants' - ], sep: "\t", skip: 0) - .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]]} - } - - ch_chunks - .filter { _meta, regionin, regionout -> regionin.size() == 0 || regionout.size() == 0 } - .subscribe { - error "ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true." - } - - if ( splitreference == true ) { - // Split reference panel in bin files - split_input = ch_ref - .combine(ch_chunks, by: 0) - .combine(ch_map, by: 0) - .map{ meta, ref, index, _region, regionin, regionout, gmap -> [ - meta + ["regionin": regionin, "regionout": regionout], - ref, index, regionin, regionout, gmap - ] } - - GLIMPSE2_SPLITREFERENCE( split_input ) - ch_versions = ch_versions.mix( GLIMPSE2_SPLITREFERENCE.out.versions.first() ) - - ch_chunks_panel_map = GLIMPSE2_SPLITREFERENCE.out.bin_ref - .map{ meta, bin_ref -> [ meta, [], [], bin_ref, [], [] ] } // Everything is provided by the bin file - } else { - ch_chunks_panel_map = ch_chunks - .combine(ch_ref, by:0) - .combine(ch_map, by:0) - .map{ meta, regionin, regionout, ref, ref_index, _region, gmap -> [ - meta + ["regionin": regionin, "regionout": regionout], - regionin, regionout, ref, ref_index, gmap - ] } - } - - ch_chunks_panel_map.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." - } - - ch_phase_input = ch_input - .combine(ch_chunks_panel_map) - .map{ metaI, input, index, list, infos, metaCPM, regionin, regionout, panel, panel_index, gmap -> [ - metaI + metaCPM, // combined metadata - input, index, list, infos, // input files - regionin, regionout, // chunk regions - panel, panel_index, gmap // panel and map files - ] } - - // Impute with Glimpse2 - GLIMPSE2_PHASE(ch_phase_input, ch_fasta) - ch_versions = ch_versions.mix( GLIMPSE2_PHASE.out.versions.first() ) - - // Index phased file - BCFTOOLS_INDEX_1(GLIMPSE2_PHASE.out.phased_variants) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_1.out.versions.first() ) - - // Ligate all phased files in one and index it - ligate_input = GLIMPSE2_PHASE.out.phased_variants - .join( BCFTOOLS_INDEX_1.out.csi ) - .map{ meta, vcf, index -> - def keysToKeep = meta.keySet() - ['regionin', 'regionout'] - [ meta.subMap(keysToKeep), vcf, index ] - } - .groupTuple() - - GLIMPSE2_LIGATE( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) - - BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) - - // Join imputed and index files - ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX_2.out.tbi - .mix(BCFTOOLS_INDEX_2.out.csi) - ) - - emit: - ch_chunks = ch_chunks // channel: [ val(meta), regionin, regionout ] - ch_vcf_index = ch_vcf_index // channel: [ val(meta), vcf, csi ] - - versions = ch_versions // channel: [ versions.yml ] -} diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test deleted file mode 100644 index c5ab9ac2aced..000000000000 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test +++ /dev/null @@ -1,461 +0,0 @@ -nextflow_workflow { - - name "Test Workflow BAM_VCF_IMPUTE_GLIMPSE2" - config "./nextflow.config" - script "../main.nf" - workflow "BAM_VCF_IMPUTE_GLIMPSE2" - - tag "subworkflows" - tag "subworkflows_nfcore" - tag "bam_vcf_impute_glimpse2" - tag "subworkflows/bam_vcf_impute_glimpse2" - - tag "glimpse2/chunk" - tag "glimpse2/splitreference" - tag "glimpse2/phase" - tag "glimpse2/ligate" - tag "glimpse2" - tag "bcftools/index" - tag "bcftools" - - test("homo_sapiens - vcf no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk recursive + splitreference") { - when { - workflow { - """ - input[0] = Channel.of([ - [id:'input_vcf'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), - [], [] - ]) // input - input[1] = Channel.of([ - [panel:'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22" - ]) // reference - input[2] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - [], [] - ]) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = true // perform chunking - input[6] = "recursive" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString(), - path(it[1]).vcf.summary, - path(it[1]).vcf.header.getGenotypeSamples().sort(), - path(it[1]).vcf.variantsMD5 - ]}, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - test("homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { - when { - workflow { - """ - sample = Channel.of('NA12878 2') - .collectFile(name: 'sampleinfos.txt') - input[0] = Channel.of([ - [id:'input_vcf'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), - [] // no list - ]) - .combine(sample) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22:16570065-16609999", - ]) - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], - [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists: true) - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = false // do not perform chunking - input[6] = "recursive" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString(), - path(it[1]).vcf.summary, - path(it[1]).vcf.header.getGenotypeSamples().sort(), - path(it[1]).vcf.variantsMD5 - ]}, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - test("homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + no splitreference") { - when { - workflow { - """ - sample = Channel.of('NA12878 2') - .collectFile(name: 'sampleinfos.txt') - input[0] = Channel.of([ - [id:'input_vcf'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr22.1X.vcf.gz.csi", checkIfExists: true), - [] // no list - ]) - .combine(sample) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22:16570065-16609999", - ]) - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], - [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file("https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/phaseimpute/hum_data/reference_genome/GRCh38_chr22.glimpse.map", checkIfExists: true) - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = false // do not perform chunking - input[6] = "recursive" // chunking model - input[7] = false // no splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString(), - path(it[1]).vcf.summary, - path(it[1]).vcf.header.getGenotypeSamples().sort(), - path(it[1]).vcf.variantsMD5 - ]}, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - test("homo_sapiens - bam no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk sequential + splitreference") { - when { - workflow { - """ - input[0] = Channel.of([ - [id:'input_bam'], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai", checkIfExists: true), - [], [] - ]) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22" - ]) - input[2] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - [], [] - ]) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = true // perform chunking - input[6] = "sequential" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString(), - path(it[1]).vcf.summary, - path(it[1]).vcf.header.getGenotypeSamples().sort(), - path(it[1]).vcf.variantsMD5 - ]}, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - test("homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference") { - when { - workflow { - """ - bamlist = Channel.of( - "NA12878.chr21_22.1X.bam\tSample1", - "NA19401.chr21_22.1X.bam\tSample2" - ).collectFile(name: 'bamlist.txt', newLine: true) - sample = Channel.of('NA12878 2') - .collectFile(name: 'sampleinfos.txt') - input[0] = Channel.of([ - [id: "allid"], [ - 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/NA19401.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), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA19401.chr21_22.1X.bam.bai", checkIfExists: true) - ] - ]).combine(bamlist).combine(sample) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), - "chr22" - ],[ - [panel: 'ref_panel', chr: "21"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz", checkIfExists:true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr21.vcf.gz.csi", checkIfExists:true), - "chr21" - ]) // reference - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], - [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"], - [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"], - [[panel: 'ref_panel', chr: "21"], "chr21:16587172-16609999", "chr21:16592229-16609999"] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExist:true) - ],[ - [panel: 'ref_panel', chr: "21"], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr21.glimpse.map", checkIfExist:true) - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = false // perform chunking - input[6] = "sequential" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ - it[0], - path(it[1]).getFileName().toString(), - path(it[2]).getFileName().toString(), - path(it[1]).vcf.summary, - path(it[1]).vcf.header.getGenotypeSamples().sort(), - path(it[1]).vcf.variantsMD5 - ]}, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - test("homo_sapiens - empty channels, chunk sequential + splitreference - stub") { - options "-stub" - when { - workflow { - """ - input[0] = Channel.of([ - [id: "allid"], - 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] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [], [], "chr22" - ],[ - [panel: 'ref_panel', chr: "21"], [], [], "chr21" - ]) // reference - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], [], []], - [[panel: 'ref_panel', chr: "21"], [], []] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [] - ],[ - [panel: 'ref_panel', chr: "21"], [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = true // perform chunking - input[6] = "sequential" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.success }, - { assert snapshot( - workflow.out, - workflow.out.versions.collect{ path(it).yaml } - ).match() } - ) - } - } - - test("homo_sapiens - error chunks provided and chunk is true") { - options "-stub" - when { - workflow { - """ - input[0] = Channel.of([ [id: "allid"], [], [], [], [] ]) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [], [], "chr22" - ],[ - [panel: 'ref_panel', chr: "21"], [], [], "chr21" - ]) // reference - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], - [[panel: 'ref_panel', chr: "22"], "chr22:16587172-16609999", "chr22:16592229-16609999"], - [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"], - [[panel: 'ref_panel', chr: "21"], "chr21:16587172-16609999", "chr21:16592229-16609999"] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [] - ],[ - [panel: 'ref_panel', chr: "21"], [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = true // perform chunking - input[6] = "sequential" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.failed }, - { assert workflow.errorMessage.contains("ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking.") } - ) - } - } - - test("homo_sapiens - error no chunks provided and chunk is false") { - options "-stub" - when { - workflow { - """ - input[0] = Channel.of([ [id: "allid"], [], [], [], [] ]) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [], [], "chr22" - ],[ - [panel: 'ref_panel', chr: "21"], [], [], "chr21" - ]) // reference - input[2] = Channel.of( - [[panel: 'ref_panel', chr: "22"], [], []], - [[panel: 'ref_panel', chr: "21"], [], []] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [] - ],[ - [panel: 'ref_panel', chr: "21"], [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = false // perform chunking - input[6] = "sequential" // chunking model - input[7] = true // splitreference - """ - } - } - then { - assertAll( - { assert workflow.failed }, - { assert workflow.errorMessage.contains("ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true.") } - ) - } - } - - test("homo_sapiens - error empty joint") { - options "-stub" - when { - workflow { - """ - input[0] = Channel.of([ - [id: "allid"], - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam", checkIfExists: true), - file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/bam/NA12878.chr22.1X.bam.bai", checkIfExists: true), - [], [] - ]) - input[1] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [], [], "chr22" - ],[ - [panel: 'ref_panel', chr: "21"], [], [], "chr21" - ]) // reference - input[2] = Channel.of( - [[panel: 'ref_panel 2', chr: "22"], "chr22:16570065-16597215", "chr22:16570065-16592216"], - [[panel: 'ref_panel', chr: "21"], "chr21:16570065-16597215", "chr21:16570065-16592216"] - ) // chunks - input[3] = Channel.of([ - [panel: 'ref_panel', chr: "22"], [] - ],[ - [panel: 'ref_panel 1', chr: "21"], [] - ]) // map - input[4] = Channel.of([ - [id_genome:'ref_fasta'], [], [] - ]).collect() // genome - input[5] = false // perform chunking - input[6] = "sequential" // chunking model - input[7] = false // splitreference - """ - } - } - then { - assertAll( - { assert workflow.failed }, - { assert workflow.errorMessage.contains("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } - ) - } - } -} diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap deleted file mode 100644 index d7e3e862c1e0..000000000000 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap +++ /dev/null @@ -1,524 +0,0 @@ -{ - "homo_sapiens - vcf no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk recursive + splitreference": { - "content": [ - [ - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-16609999", - "chr22:16570065-16592222" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-16609999", - "chr22:16592223-16609999" - ] - ], - [ - [ - { - "id": "input_vcf", - "panel": "ref_panel", - "chr": "22" - }, - "input_vcf_22.vcf.gz", - "input_vcf_22.vcf.gz.csi", - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", - [ - "NA12878" - ], - "b9ccc0359ccca0714fca43367538de47" - ] - ], - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { - "glimpse2": "2.0.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-21T12:07:17.825740137" - }, - "homo_sapiens - bam no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk sequential + splitreference": { - "content": [ - [ - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:1-16609999", - "chr22:1-16590520" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-1248956422", - "chr22:16590521-1248956422" - ] - ], - [ - [ - { - "id": "input_bam", - "panel": "ref_panel", - "chr": "22" - }, - "input_bam_22.vcf.gz", - "input_bam_22.vcf.gz.csi", - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=true]", - [ - "NA12878.chr22.1X" - ], - "661a9923af273601dbf0e7a3a666ebd0" - ] - ], - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { - "glimpse2": "2.0.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-21T12:08:29.707313034" - }, - "homo_sapiens - empty channels, chunk sequential + splitreference - stub": { - "content": [ - { - "0": [ - [ - { - "panel": "ref_panel", - "chr": "21" - }, - "0", - "0" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "0", - "0" - ] - ], - "1": [ - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "21" - }, - "allid_21.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "allid_21.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "22" - }, - "allid_22.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "allid_22.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - "versions.yml:md5,302281bbff76712870c031340d3819ff", - "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", - "versions.yml:md5,9422ca169a15fd68878396c2837bc185", - "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", - "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", - "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" - ], - "ch_chunks": [ - [ - { - "panel": "ref_panel", - "chr": "21" - }, - "0", - "0" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "0", - "0" - ] - ], - "ch_vcf_index": [ - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "21" - }, - "allid_21.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "allid_21.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ], - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "22" - }, - "allid_22.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940", - "allid_22.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,302281bbff76712870c031340d3819ff", - "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", - "versions.yml:md5,9422ca169a15fd68878396c2837bc185", - "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", - "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", - "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" - ] - }, - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { - "glimpse2": "2.0.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-21T12:10:17.321588787" - }, - "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + no splitreference": { - "content": [ - [ - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-16597215", - "chr22:16570065-16592216" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16587172-16609999", - "chr22:16592229-16609999" - ] - ], - [ - [ - { - "id": "input_vcf", - "panel": "ref_panel", - "chr": "22" - }, - "input_vcf_22.vcf.gz", - "input_vcf_22.vcf.gz.csi", - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", - [ - "NA12878" - ], - "a0d696cbdb219c168b6d54fc28c5f7dd" - ] - ], - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-21T12:08:13.222110779" - }, - "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { - "content": [ - [ - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-16597215", - "chr22:16570065-16592216" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16587172-16609999", - "chr22:16592229-16609999" - ] - ], - [ - [ - { - "id": "input_vcf", - "panel": "ref_panel", - "chr": "22" - }, - "input_vcf_22.vcf.gz", - "input_vcf_22.vcf.gz.csi", - "VcfFile [chromosomes=[chr22], sampleCount=1, variantCount=903, phased=true, phasedAutodetect=false]", - [ - "NA12878" - ], - "a0d696cbdb219c168b6d54fc28c5f7dd" - ] - ], - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { - "glimpse2": "2.0.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-11-21T12:07:58.812913099" - }, - "homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { - "content": [ - [ - [ - { - "panel": "ref_panel", - "chr": "21" - }, - "chr21:16570065-16597215", - "chr21:16570065-16592216" - ], - [ - { - "panel": "ref_panel", - "chr": "21" - }, - "chr21:16587172-16609999", - "chr21:16592229-16609999" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16570065-16597215", - "chr22:16570065-16592216" - ], - [ - { - "panel": "ref_panel", - "chr": "22" - }, - "chr22:16587172-16609999", - "chr22:16592229-16609999" - ] - ], - [ - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "21" - }, - "allid_21.vcf.gz", - "allid_21.vcf.gz.csi", - "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=836, phased=true, phasedAutodetect=true]", - [ - "Sample1", - "Sample2" - ], - "56a7bd192123c52ea77f8b3a59e50342" - ], - [ - { - "id": "allid", - "panel": "ref_panel", - "chr": "22" - }, - "allid_22.vcf.gz", - "allid_22.vcf.gz.csi", - "VcfFile [chromosomes=[chr22], sampleCount=2, variantCount=903, phased=true, phasedAutodetect=true]", - [ - "Sample1", - "Sample2" - ], - "13cdb23c1074393f9fe53feae397a3df" - ] - ], - [ - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { - "glimpse2": "2.0.0" - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { - "glimpse2": "2.0.0" - } - } - ] - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-12-08T19:39:08.135355223" - } -} \ No newline at end of file diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config deleted file mode 100644 index 9cd201b85a2a..000000000000 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config +++ /dev/null @@ -1,41 +0,0 @@ -process { - withName: "GLIMPSE2_CHUNK" { - ext.prefix = { "${meta.panel}_${meta.chr}" } - tag = { "${meta.panel} ${meta.chr}}" } - ext.args = [ - "--window-mb 0.01", - "--window-cm 0.01", - "--window-count 200", - "--buffer-mb 0.005", - "--buffer-cm 0.005", - "--buffer-count 30", - "--seed 1" - ].join(' ') - } - - withName: "GLIMPSE2_SPLITREFERENCE" { - ext.prefix = { "${meta.panel}_${meta.chr}_${meta.regionout}" } - tag = { "${meta.panel} ${meta.chr} ${meta.regionout}" } - ext.args = "--seed 1" - } - - withName: "GLIMPSE2_PHASE" { - ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout}" } - tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } - cpus = 1 - ext.args = "--keep-monomorphic-ref-sites --seed 1" - } - - withName: "BCFTOOLS_INDEX_1" { - tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } - } - - withName: "GLIMPSE2_LIGATE" { - ext.prefix = { "${meta.id}_${meta.chr}" } - tag = { "${meta.id} ${meta.chr}" } - } - - withName: "BCFTOOLS_INDEX_2" { - tag = { "${meta.id} ${meta.chr}" } - } -} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/main.nf b/subworkflows/nf-core/multiple_impute_glimpse2/main.nf new file mode 100644 index 000000000000..c9c0022beacc --- /dev/null +++ b/subworkflows/nf-core/multiple_impute_glimpse2/main.nf @@ -0,0 +1,75 @@ +include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' +include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' +include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' +include { BCFTOOLS_INDEX as INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main.nf' +include { BCFTOOLS_INDEX as INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index/main.nf' + +workflow MULTIPLE_IMPUTE_GLIMPSE2 { + + take: + ch_input // channel (mandatory): [ meta, vcf, csi, infos ] + ch_ref // channel (mandatory): [ meta, vcf, csi, region ] + ch_map // channel (optional) : [ meta, map ] + ch_fasta // channel (optional) : [ meta, fasta, index ] + chunk_model // string: model used to chunk the reference panel + + main: + + ch_versions = channel.empty() + + // Chunk reference panel + ch_ref_map = ch_ref.combine(ch_map, by: 0) + GLIMPSE2_CHUNK ( ch_ref_map, chunk_model ) + ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) + + chunk_output = GLIMPSE2_CHUNK.out.chunk_chr + .splitCsv(header: [ + 'ID', 'Chr', 'RegionBuf', 'RegionCnk', 'WindowCm', + 'WindowMb', 'NbTotVariants', 'NbComVariants' + ], sep: "\t", skip: 0) + .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]]} + + // Split reference panel in bin files + split_input = ch_ref.map{ meta, ref, index, _region -> [meta, ref, index]} + .combine(chunk_output, by: 0) + + GLIMPSE2_SPLITREFERENCE( split_input, ch_map ) + ch_versions = ch_versions.mix( GLIMPSE2_SPLITREFERENCE.out.versions.first() ) + + phase_input = ch_input.combine( GLIMPSE2_SPLITREFERENCE.out.bin_ref ) + .map{ input_meta, input_file, input_index, input_infos, + _panel_meta, panel_bin -> + [input_meta, input_file, input_index, [], input_infos, + [], [], panel_bin, [], []] + }/* Remove unnecessary meta maps + add null index as we use a bin file, + add null value for input and output region as we use a bin file */ + + // Phase input files for each reference bin files + indexing + GLIMPSE2_PHASE ( phase_input, ch_fasta ) // [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map], [ meta, fasta, index ] + ch_versions = ch_versions.mix( GLIMPSE2_PHASE.out.versions.first() ) + + INDEX_PHASE ( GLIMPSE2_PHASE.out.phased_variants ) + ch_versions = ch_versions.mix( INDEX_PHASE.out.versions.first() ) + + // Ligate all phased files in one and index it + ligate_input = GLIMPSE2_PHASE.out.phased_variants + .groupTuple() + .combine( INDEX_PHASE.out.csi + .groupTuple() + .collect(), by: 0 ) + + GLIMPSE2_LIGATE ( ligate_input ) + ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + + INDEX_LIGATE ( GLIMPSE2_LIGATE.out.merged_variants ) + ch_versions = ch_versions.mix( INDEX_LIGATE.out.versions.first() ) + + emit: + chunk_chr = GLIMPSE2_CHUNK.out.chunk_chr // channel: [ val(meta), txt ] + merged_variants = GLIMPSE2_LIGATE.out.merged_variants // channel: [ val(meta), bcf ] + merged_variants_index = INDEX_LIGATE.out.csi // channel: [ val(meta), csi ] + + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml b/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml similarity index 56% rename from subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml rename to subworkflows/nf-core/multiple_impute_glimpse2/meta.yml index 41edf1abe46c..4df61f2cf840 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/meta.yml +++ b/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml @@ -1,4 +1,4 @@ -name: "bam_vcf_impute_glimpse2" +name: "multiple_impute_glimpse2" description: Impute VCF/BCF files, but also CRAM and BAM files with Glimpse2 keywords: - glimpse @@ -18,9 +18,8 @@ input: description: | Target dataset in CRAM, BAM or VCF/BCF format. Index file of the input file. - File containing the list of files to be imputed and their sample names (for CRAM/BAM input). File with sample names and ploidy information. - Structure: [ meta, file, index, bamlist, ploidy ] + Structure: [ meta, file, index, txt ] - ch_ref: type: file description: | @@ -29,15 +28,10 @@ input: Target region, usually a full chromosome (e.g. chr20:1000000-2000000 or chr20). The file could possibly be without GT field (for efficiency reasons a file containing only the positions is recommended). Structure: [ meta, vcf, csi, region ] - - ch_chunks: - type: string - description: | - Channel containing the chunking regions for each chromosome. - Structure: [ meta, region with buffer, region without buffer ] - ch_map: type: file description: | - Genetic map file for each chromosome. + File containing the genetic map. Structure: [ meta, gmap ] - ch_fasta: type: file @@ -45,30 +39,22 @@ input: Reference genome in fasta format. Reference genome index in fai format Structure: [ meta, fasta, fai ] - - chunk: - type: boolean - description: Whether to perform chunking of the input data before imputation. - - chunk_model: - type: string - description: | - Chunking model to use. - Options: "sequential", "recursive" - - splitreference: - type: boolean - description: Whether to split the reference panel and convert it to binary files before imputation. output: - - ch_chunks: - type: string + - chunk_chr: + type: file description: | - Channel containing the chunking regions for each chromosome. - Structure: [ meta, region with buffer, region without buffer ] - - ch_vcf_index: + Tab delimited output txt file containing buffer and imputation regions. + Structure: [meta, txt] + - merged_variants: type: file description: | Output VCF/BCF file for the merged regions. - Index file of the output VCF/BCF file. - Structure: [ val(meta), variants, index ] + Phased information (HS field) is updated accordingly for the full region. + Structure: [ val(meta), bcf ] + - merged_variants_index: + type: file + description: Index file of the ligated phased variants files. - versions: type: file description: File containing software versions diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test new file mode 100644 index 000000000000..989bdb8a1ca7 --- /dev/null +++ b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test @@ -0,0 +1,173 @@ +nextflow_workflow { + + name "Test Workflow MULTIPLE_IMPUTE_GLIMPSE2" + config "./nextflow.config" + script "../main.nf" + workflow "MULTIPLE_IMPUTE_GLIMPSE2" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "multiple_impute_glimpse2" + tag "subworkflows/multiple_impute_glimpse2" + + tag "glimpse2/chunk" + tag "glimpse2/splitreference" + tag "glimpse2/phase" + tag "glimpse2/ligate" + tag "glimpse2" + tag "bcftools/index" + tag "bcftools" + + test("homo_sapiens - vcf [] - panel vcf region - [] - [] - recursive") { + when { + workflow { + """ + input[0] = Channel.of([ + [id:'input_vcf'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), + [] + ]) + input[1] = Channel.of([ + [id:'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22", + ]) + input[2] = Channel.of([ + [id: 'ref_panel', chr: "22"], + [] + ]) + input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() + input[4] = "recursive" + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.chunk_chr, + workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, + file(workflow.out.merged_variants_index[0][1]).name, // The .csi index file sometimes change + workflow.out.versions + ).match() } + ) + } + } + test("homo_sapiens - vcf sample - panel vcf - [] - [] - recursive") { + when { + workflow { + """ + sample = Channel.of('NA12878 2') + .collectFile(name: 'sampleinfos.txt') + input[0] = Channel.of([ + [id:'input_vcf'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/illumina/vcf/NA12878.chr21_22.1X.glimpse2.vcf.gz.csi", checkIfExists: true), + ]).combine(sample) + input[1] = Channel.of([ + [id:'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22:16570065-16609999", + ]) + input[2] = Channel.of([ + [id:'ref_panel', chr: "22"], + [] + ]).collect() + input[3] = Channel.of([ + [id:'ref_fasta'], + [], + [] + ]).collect() + input[4] = "recursive" + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.chunk_chr, + workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, + file(workflow.out.merged_variants_index[0][1]).name, + workflow.out.versions + ).match() } + ) + } + } + test("homo_sapiens - bam [] - panel vcf - [] - [] - sequential") { + when { + workflow { + """ + input[0] = Channel.of([ + [id:'input_bam'], + 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] = Channel.of([ + [id:'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22", + ]) + input[2] = Channel.of([ + [id: 'ref_panel', chr: "22"], + [] + ]) + input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() + input[4] = "sequential" + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.chunk_chr, + workflow.out.merged_variants.collect{ path(it[1]).vcf.variantsMD5}, + file(workflow.out.merged_variants_index[0][1]).name, + workflow.out.versions + ).match() } + ) + } + } + test("homo_sapiens - bam [] - panel vcf - [] - [] - sequential -- stub") { + tag "stub" + options "-stub" + when { + workflow { + """ + input[0] = input[0] = Channel.of([ + [id:'input_bam'], + 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] = Channel.of([ + [id:'ref_panel', chr: "22"], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz", checkIfExists:true), + file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), + "chr22", + ]) + input[2] = Channel.of([ + [id: 'ref_panel', chr: "22"], + [] + ]) + input[3] = Channel.of([[id:'ref_fasta'], [], []]).collect() + input[4] = "sequential" + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out + ).match() } + ) + } + } +} diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap new file mode 100644 index 000000000000..232c67643f96 --- /dev/null +++ b/subworkflows/nf-core/multiple_impute_glimpse2/tests/main.nf.test.snap @@ -0,0 +1,169 @@ +{ + "homo_sapiens - vcf sample - panel vcf - [] - [] - recursive": { + "content": [ + [ + [ + { + "id": "ref_panel", + "chr": "22" + }, + "ref_panel.txt:md5,c363e235162ca0f7d22e5604c192e256" + ] + ], + [ + "9794b042f8c50f7d9a4dbe448de5ed5e" + ], + "input_vcf.vcf.gz.csi", + [ + "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", + "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", + "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", + "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", + "versions.yml:md5,642ed64b13825472557113ba2e4b1566", + "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-27T11:11:34.893641629" + }, + "homo_sapiens - bam [] - panel vcf - [] - [] - sequential": { + "content": [ + [ + [ + { + "id": "ref_panel", + "chr": "22" + }, + "ref_panel.txt:md5,4714831df331b665e634eb1a86a84156" + ] + ], + [ + "49df7da6c9745ba9a86112193ff172a9" + ], + "input_bam.vcf.gz.csi", + [ + "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", + "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", + "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", + "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", + "versions.yml:md5,642ed64b13825472557113ba2e4b1566", + "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-11-26T21:19:09.9592341" + }, + "homo_sapiens - bam [] - panel vcf - [] - [] - sequential -- stub": { + "content": [ + { + "0": [ + [ + { + "id": "ref_panel", + "chr": "22" + }, + "ref_panel.txt:md5,2fc283dec1e755af6119f2ef6485ceee" + ] + ], + "1": [ + [ + { + "id": "input_bam" + }, + "input_bam.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "2": [ + [ + { + "id": "input_bam" + }, + "input_bam.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", + "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", + "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", + "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", + "versions.yml:md5,642ed64b13825472557113ba2e4b1566", + "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" + ], + "chunk_chr": [ + [ + { + "id": "ref_panel", + "chr": "22" + }, + "ref_panel.txt:md5,2fc283dec1e755af6119f2ef6485ceee" + ] + ], + "merged_variants": [ + [ + { + "id": "input_bam" + }, + "input_bam.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "merged_variants_index": [ + [ + { + "id": "input_bam" + }, + "input_bam.vcf.gz.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", + "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", + "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", + "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", + "versions.yml:md5,642ed64b13825472557113ba2e4b1566", + "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-15T07:30:40.001652658" + }, + "homo_sapiens - vcf [] - panel vcf region - [] - [] - recursive": { + "content": [ + [ + [ + { + "id": "ref_panel", + "chr": "22" + }, + "ref_panel.txt:md5,c363e235162ca0f7d22e5604c192e256" + ] + ], + [ + "9794b042f8c50f7d9a4dbe448de5ed5e" + ], + "input_vcf.vcf.gz.csi", + [ + "versions.yml:md5,048d5415737cdc568fcc4fbdc5df11e2", + "versions.yml:md5,1301ab7e8d92b232e306aef24d94e252", + "versions.yml:md5,1362d3f6834c21239d705f550b11c2af", + "versions.yml:md5,2373902d5432eba6898c90d4c4685f90", + "versions.yml:md5,642ed64b13825472557113ba2e4b1566", + "versions.yml:md5,e81cfbe9cf12832b8312f966b6c9beb1" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-15T07:29:48.094975599" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config b/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config new file mode 100644 index 000000000000..e89bc79602dd --- /dev/null +++ b/subworkflows/nf-core/multiple_impute_glimpse2/tests/nextflow.config @@ -0,0 +1,12 @@ +process { + withName: "GLIMPSE2_CHUNK" { + ext.args = [ + "--window-mb 0.01", + "--window-cm 0.01", + "--window-count 200", + "--buffer-mb 0.005", + "--buffer-cm 0.005", + "--buffer-count 30" + ].join(' ') + } +} From 8c19df1e014be8b12fcffe7f222c1df60f69130a Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 11:05:42 +0100 Subject: [PATCH 14/15] Revert change glimpse2 sbwf --- subworkflows/nf-core/multiple_impute_glimpse2/meta.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml b/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml index 4df61f2cf840..6fea6251cc15 100644 --- a/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml +++ b/subworkflows/nf-core/multiple_impute_glimpse2/meta.yml @@ -39,7 +39,6 @@ input: Reference genome in fasta format. Reference genome index in fai format Structure: [ meta, fasta, fai ] - output: - chunk_chr: type: file From 88b2d152a6ae577c286da7c0b5bf940d8a3ee040 Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Thu, 11 Dec 2025 11:06:32 +0100 Subject: [PATCH 15/15] Revert change glimpse2 sbwf --- modules/nf-core/glimpse2/splitreference/tests/main.nf.test | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test index 022ec828fddd..e95febde9a3c 100644 --- a/modules/nf-core/glimpse2/splitreference/tests/main.nf.test +++ b/modules/nf-core/glimpse2/splitreference/tests/main.nf.test @@ -49,6 +49,7 @@ nextflow_process { file(params.modules_testdata_base_path + "genomics/homo_sapiens/popgen/1000GP.chr22.vcf.gz.csi", checkIfExists:true), "chr22:16600000-16800000", "chr22:16600000-16800000" + ] input[1]= [ [ id:'map'], file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genetic_map/genome.GRCh38.chr22.glimpse.map", checkIfExists:true)