From dbc97237228c74178357b1ad6e25a4d44bc3ec3f Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Thu, 24 Sep 2026 11:24:25 +0200 Subject: [PATCH 1/3] refactor: replace groupTuple and transpose with typed operators Replace the legacy groupTuple and transpose operators with groupBy and flatMap so the workflow code is ready for static typing, where the legacy operators are not type-checked. - ncbi_download_input: collect source_version-keyed [reference, meta] entries with groupBy instead of groupTuple - prepare_genome_rnaseq: merge input gtf and GFFREAD output with groupBy instead of groupTuple - datasheet_to_channel: flatten VCF file holders with flatMap instead of transpose Generated by opencode --- CHANGELOG.md | 1 + main.nf | 10 +++++----- subworkflows/local/datasheet_to_channel/main.nf | 2 +- subworkflows/local/prepare_genome_rnaseq/main.nf | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d37f9758..1cf39a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#150](https://github.com/nf-core/references/pull/150) - Replace `branch` with `filter` + `map` in datasheet_to_channel - [#151](https://github.com/nf-core/references/pull/151) - Enable static typing and replace `collectFile` with `WRITE_FILE` - [#153](https://github.com/nf-core/references/pull/153) - Update modules +- [#155](https://github.com/nf-core/references/pull/155) - Replace legacy `groupTuple` and `transpose` operators with `groupBy` and `flatMap` ### Removed diff --git a/main.nf b/main.nf index a35da70f..160fa852 100644 --- a/main.nf +++ b/main.nf @@ -60,11 +60,11 @@ workflow NFCORE_REFERENCES { ncbi_download_input = fasta_download_input.to_download .mix(gff_download_input.to_download, gtf_download_input.to_download) - .map { meta, _file -> - [meta.source_version, meta.reference, meta] - } - .groupTuple() - .map { acc, ref_types, metas -> + .map { meta, _file -> [meta.source_version, [meta.reference, meta]] } + .groupBy() + .map { acc, entries -> + def ref_types = entries.collect { entry -> entry[0] } + def metas = entries.collect { entry -> entry[1] } def includes = ref_types .collect { reference_ -> reference_ == 'fasta' diff --git a/subworkflows/local/datasheet_to_channel/main.nf b/subworkflows/local/datasheet_to_channel/main.nf index e58910e5..48cbaa0d 100644 --- a/subworkflows/local/datasheet_to_channel/main.nf +++ b/subworkflows/local/datasheet_to_channel/main.nf @@ -151,7 +151,7 @@ workflow DATASHEET_TO_CHANNEL { known_snps, pon, ) - .transpose() + .flatMap { meta, vcfs -> vcfs.toList().collect { vcf_ -> [meta, vcf_] } } emit: ascat_alleles = ascat_alleles // channel: [meta, *.ascat_alleles.txt] diff --git a/subworkflows/local/prepare_genome_rnaseq/main.nf b/subworkflows/local/prepare_genome_rnaseq/main.nf index 9489c595..fea63d5d 100644 --- a/subworkflows/local/prepare_genome_rnaseq/main.nf +++ b/subworkflows/local/prepare_genome_rnaseq/main.nf @@ -39,7 +39,7 @@ workflow PREPARE_GENOME_RNASEQ { gtf = gtf .mix(GFFREAD.out.gtf) - .groupTuple() + .groupBy() .map { meta, gtf_ -> gtf_[1] ? [meta, gtf_[1]] : [meta, gtf_[0]] } HISAT2_EXTRACTSPLICESITES(gtf.filter { meta, _gtf -> ('hisat2' in tools || 'hisat2_extractsplicesites' in tools) && meta.run_hisat2 && !hisat2_skip_splice_sites }) From 61f3be44e75668061fd9c33a3d016dc7c3806dce Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Thu, 24 Sep 2026 11:43:09 +0200 Subject: [PATCH 2/3] chore: fix CHANGELOG PR number --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cf39a3a..b0e6cf2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#150](https://github.com/nf-core/references/pull/150) - Replace `branch` with `filter` + `map` in datasheet_to_channel - [#151](https://github.com/nf-core/references/pull/151) - Enable static typing and replace `collectFile` with `WRITE_FILE` - [#153](https://github.com/nf-core/references/pull/153) - Update modules -- [#155](https://github.com/nf-core/references/pull/155) - Replace legacy `groupTuple` and `transpose` operators with `groupBy` and `flatMap` +- [#156](https://github.com/nf-core/references/pull/156) - Replace legacy `groupTuple` and `transpose` operators with `groupBy` and `flatMap` ### Removed From 44beddc808e3d6fc826fa315996ec1ca7f9a49e2 Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Thu, 24 Sep 2026 12:07:46 +0200 Subject: [PATCH 3/3] fix: handle single-file VCF entries in vcf flatMap The vcf channel mixes files() holders (dbsnp) with single file() entries (germline_resource, known_indels, known_snps, pon). Path.toList() splits an http/https path into its segments, so calling toList() on a single Path broke the flatMap replacement of transpose and fed non-existent path segments to HTSLIB_BGZIPTABIX, causing "Cannot invoke method provider() on null object". Pass single Path entries through unchanged, matching the transpose behaviour; only expand files() holders per file. Generated by opencode --- subworkflows/local/datasheet_to_channel/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subworkflows/local/datasheet_to_channel/main.nf b/subworkflows/local/datasheet_to_channel/main.nf index 48cbaa0d..7de33db7 100644 --- a/subworkflows/local/datasheet_to_channel/main.nf +++ b/subworkflows/local/datasheet_to_channel/main.nf @@ -151,7 +151,7 @@ workflow DATASHEET_TO_CHANNEL { known_snps, pon, ) - .flatMap { meta, vcfs -> vcfs.toList().collect { vcf_ -> [meta, vcf_] } } + .flatMap { meta, vcfs -> vcfs instanceof Path ? [[meta, vcfs]] : vcfs.toList().collect { vcf_ -> [meta, vcf_] } } emit: ascat_alleles = ascat_alleles // channel: [meta, *.ascat_alleles.txt]