From 1d7c518f1e07187215f228bd6f68c92b743dbb4b Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 1 Dec 2025 15:31:15 +0000 Subject: [PATCH 01/15] add 3 required ribocode modules --- .../ribocode/metaplots/environment.yml | 6 ++ modules/nf-core/ribocode/metaplots/main.nf | 50 +++++++++ modules/nf-core/ribocode/metaplots/meta.yml | 64 +++++++++++ .../ribocode/metaplots/tests/main.nf.test | 51 +++++++++ .../metaplots/tests/main.nf.test.snap | 55 ++++++++++ .../ribocode/metaplots/tests/nextflow.config | 5 + .../nf-core/ribocode/prepare/environment.yml | 6 ++ modules/nf-core/ribocode/prepare/main.nf | 64 +++++++++++ modules/nf-core/ribocode/prepare/meta.yml | 45 ++++++++ .../ribocode/prepare/tests/main.nf.test | 32 ++++++ .../ribocode/prepare/tests/main.nf.test.snap | 33 ++++++ .../nf-core/ribocode/ribocode/environment.yml | 6 ++ modules/nf-core/ribocode/ribocode/main.nf | 57 ++++++++++ modules/nf-core/ribocode/ribocode/meta.yml | 100 ++++++++++++++++++ .../ribocode/ribocode/tests/main.nf.test | 65 ++++++++++++ .../ribocode/ribocode/tests/main.nf.test.snap | 97 +++++++++++++++++ .../ribocode/ribocode/tests/nextflow.config | 8 ++ 17 files changed, 744 insertions(+) create mode 100644 modules/nf-core/ribocode/metaplots/environment.yml create mode 100644 modules/nf-core/ribocode/metaplots/main.nf create mode 100644 modules/nf-core/ribocode/metaplots/meta.yml create mode 100644 modules/nf-core/ribocode/metaplots/tests/main.nf.test create mode 100644 modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/metaplots/tests/nextflow.config create mode 100644 modules/nf-core/ribocode/prepare/environment.yml create mode 100644 modules/nf-core/ribocode/prepare/main.nf create mode 100644 modules/nf-core/ribocode/prepare/meta.yml create mode 100644 modules/nf-core/ribocode/prepare/tests/main.nf.test create mode 100644 modules/nf-core/ribocode/prepare/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/ribocode/environment.yml create mode 100644 modules/nf-core/ribocode/ribocode/main.nf create mode 100644 modules/nf-core/ribocode/ribocode/meta.yml create mode 100644 modules/nf-core/ribocode/ribocode/tests/main.nf.test create mode 100644 modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/ribocode/tests/nextflow.config diff --git a/modules/nf-core/ribocode/metaplots/environment.yml b/modules/nf-core/ribocode/metaplots/environment.yml new file mode 100644 index 000000000000..248e76fd71fb --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::ribocode=1.2.15 \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/main.nf b/modules/nf-core/ribocode/metaplots/main.nf new file mode 100644 index 000000000000..f07e198f8902 --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/main.nf @@ -0,0 +1,50 @@ +process RIBOCODE_METAPLOTS { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ribocode:1.2.15--pyhfa5458b_0': + 'biocontainers/ribocode:1.2.15--pyhfa5458b_0' }" + + input: + tuple val(meta), path(bam) + path annotation + + output: + tuple val(meta), path("*config.txt") , emit: config + tuple val(meta), path("*.pdf") , emit: pdf + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + metaplots \\ + -a $annotation \\ + -r $bam \\ + -o ${prefix} \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(RiboCode --version 2>&1) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_config.txt + touch ${prefix}_report.pdf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(echo "1.2.15") + END_VERSIONS + """ +} diff --git a/modules/nf-core/ribocode/metaplots/meta.yml b/modules/nf-core/ribocode/metaplots/meta.yml new file mode 100644 index 000000000000..6074a441b907 --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/meta.yml @@ -0,0 +1,64 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "ribocode_metaplots" +description: Set up RiboCode ORF calling with metaplots +keywords: + - Ribo-Seq + - Ribosome Profiling + - ORF Calling +tools: + - "ribocode": + description: "A package for detecting the actively translated ORFs using ribosome-profiling + data" + homepage: "https://github.com/xryanglab/RiboCode" + documentation: "https://github.com/xryanglab/RiboCode" + tool_dev_url: "https://github.com/xryanglab/RiboCode" + doi: "10.1093/nar/gky179" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: [] + - annotation: + type: directory + description: Directory containing annotation files + pattern: "annotation" + +output: + config: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - "*config.txt": + type: file + description: RiboCode configuration file containing P-site offsets + pattern: "*_config.txt" + ontologies: [] + pdf: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - "*.pdf": + type: file + description: PDF file containing P-site metaplots for quality control + pattern: "*_report.pdf" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@JackCurragh" diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test b/modules/nf-core/ribocode/metaplots/tests/main.nf.test new file mode 100644 index 000000000000..e3c831c63f55 --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test @@ -0,0 +1,51 @@ +nextflow_process { + + name "Test Process RIBOCODE_METAPLOTS" + script "../main.nf" + process "RIBOCODE_METAPLOTS" + + tag "modules" + tag "modules_nfcore" + tag "ribocode" + tag "ribocode/metaplots" + tag "ribocode/prepare" + + setup { + run("RIBOCODE_PREPARE") { + script "../../prepare/main.nf" + process { + + """ + input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + """ + } + } + } + + test("test_ribocode_metaplots") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887.Aligned.toTranscriptome.out.bam", checkIfExists: true) + ] + input[1] = RIBOCODE_PREPARE.out.annotation + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap new file mode 100644 index 000000000000..d215ad75a64b --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -0,0 +1,55 @@ +{ + "test_ribocode_metaplots": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "testSRX11780887.Aligned.toTranscriptome.out.pdf:md5,464c91bb5532a571ed2c9c6ae6403a86" + ] + ], + "2": [ + "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" + ], + "config": [ + [ + { + "id": "test", + "single_end": false + }, + "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" + ] + ], + "pdf": [ + [ + { + "id": "test", + "single_end": false + }, + "testSRX11780887.Aligned.toTranscriptome.out.pdf:md5,464c91bb5532a571ed2c9c6ae6403a86" + ] + ], + "versions": [ + "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-01T15:29:32.897378" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/tests/nextflow.config b/modules/nf-core/ribocode/metaplots/tests/nextflow.config new file mode 100644 index 000000000000..3ccf4a70c6cd --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: RIBOCODE_METAPLOTS { + ext.args = '-f0_percent 0.1 -pv1 1 -pv2 1' + } +} diff --git a/modules/nf-core/ribocode/prepare/environment.yml b/modules/nf-core/ribocode/prepare/environment.yml new file mode 100644 index 000000000000..248e76fd71fb --- /dev/null +++ b/modules/nf-core/ribocode/prepare/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::ribocode=1.2.15 \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/main.nf b/modules/nf-core/ribocode/prepare/main.nf new file mode 100644 index 000000000000..6f1962dcbec8 --- /dev/null +++ b/modules/nf-core/ribocode/prepare/main.nf @@ -0,0 +1,64 @@ +process RIBOCODE_PREPARE { + tag "$fasta" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ribocode:1.2.15--pyhfa5458b_0': + 'biocontainers/ribocode:1.2.15--pyhfa5458b_0' }" + + input: + path fasta + path gtf + + output: + path "annotation" , emit: annotation + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + + """ + # nf-core: ensure FASTA is uncompressed + GENOME="$fasta" + if [[ "\$GENOME" == *.gz ]]; then + gunzip -c "\$GENOME" > genome.fa + GENOME="genome.fa" + fi + + # Update the GTF + GTFupdate \\ + $gtf \\ + > updated.gtf + + # Run prepare_transcripts with uncompressed FASTA + prepare_transcripts \\ + -g updated.gtf \\ + -f "\$GENOME" \\ + -o annotation + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(RiboCode --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + + """ + mkdir annotation + + touch annotation/transcripts_cds.txt + touch annotation/transcripts_sequence.fa + touch annotation/transcripts.pickle + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(echo "1.2.15") + END_VERSIONS + """ +} diff --git a/modules/nf-core/ribocode/prepare/meta.yml b/modules/nf-core/ribocode/prepare/meta.yml new file mode 100644 index 000000000000..782b94e3f354 --- /dev/null +++ b/modules/nf-core/ribocode/prepare/meta.yml @@ -0,0 +1,45 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "ribocode_prepare" +description: Prepare the annotation files for RiboCode ORF calling +keywords: + - Ribo-Seq + - Ribosome Profiling + - ORF calling +tools: + - "ribocode": + description: "A package for detecting the actively translated ORFs using ribosome-profiling + data" + homepage: "https://github.com/xryanglab/RiboCode" + documentation: "https://github.com/xryanglab/RiboCode" + tool_dev_url: "https://github.com/xryanglab/RiboCode" + doi: "10.1093/nar/gky179" + licence: ["MIT"] + identifier: "" + +input: + - fasta: + type: file + description: Reference genome FASTA file + pattern: "*.{fasta,fa,fna}" + ontologies: [] + - gtf: + type: file + description: Reference genome GTF annotation file + pattern: "*.{gtf}" + + ontologies: [] +output: + annotation: + - annotation: + type: directory + description: Directory containing RiboCode annotation files + (transcripts_cds.txt, transcripts_sequence.fa, transcripts.pickle) + pattern: "annotation/" + + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@JackCurragh" diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test b/modules/nf-core/ribocode/prepare/tests/main.nf.test new file mode 100644 index 000000000000..81d06823d636 --- /dev/null +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test @@ -0,0 +1,32 @@ +nextflow_process { + + name "Test Process RIBOCODE_PREPARE" + script "../main.nf" + process "RIBOCODE_PREPARE" + + tag "modules" + tag "modules_nfcore" + tag "ribocode" + tag "ribocode/prepare" + + test("test_ribocode_prepare") { + + when { + process { + """ + input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap new file mode 100644 index 000000000000..84091112c8e5 --- /dev/null +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap @@ -0,0 +1,33 @@ +{ + "test_ribocode_prepare": { + "content": [ + { + "0": [ + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ], + "1": [ + "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + ], + "annotation": [ + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ], + "versions": [ + "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-01T13:44:59.168396" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/environment.yml b/modules/nf-core/ribocode/ribocode/environment.yml new file mode 100644 index 000000000000..248e76fd71fb --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::ribocode=1.2.15 \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/main.nf b/modules/nf-core/ribocode/ribocode/main.nf new file mode 100644 index 000000000000..e6bdf5a6bdd3 --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/main.nf @@ -0,0 +1,57 @@ +process RIBOCODE_RIBOCODE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ribocode:1.2.15--pyhfa5458b_0': + 'biocontainers/ribocode:1.2.15--pyhfa5458b_0' }" + + input: + tuple val(meta), path(bam) + path annotation + tuple val(meta3), path(config) + + output: + + tuple val(meta), path("*.txt") , emit: orf_txt + tuple val(meta), path("*_collapsed.txt") , emit: orf_txt_collapsed + tuple val(meta), path("*_ORFs_category.pdf") , emit: orf_pdf, optional: true + tuple val(meta), path("*_psites.hd5") , emit: psites_hd5, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + RiboCode \\ + -a $annotation \\ + -c $config \\ + -o ${prefix} \\ + $args 2>&1 || test -s ${prefix}.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(RiboCode --version 2>&1) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.txt + touch ${prefix}_collapsed.txt + touch ${prefix}_ORFs_category.pdf + touch ${prefix}_psites.hd5 + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(echo "1.2.15") + END_VERSIONS + """ +} diff --git a/modules/nf-core/ribocode/ribocode/meta.yml b/modules/nf-core/ribocode/ribocode/meta.yml new file mode 100644 index 000000000000..27ecf8d33eec --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/meta.yml @@ -0,0 +1,100 @@ +name: "ribocode_ribocode" +description: Call ORFs with RiboCode from Ribo-Seq data +keywords: + - Ribo-Seq + - Ribosome Profiling + - ORF calling +tools: + - "ribocode": + description: "A package for detecting the actively translated ORFs using ribosome-profiling + data" + homepage: "https://github.com/xryanglab/RiboCode" + documentation: "https://github.com/xryanglab/RiboCode" + tool_dev_url: "https://github.com/xryanglab/RiboCode" + doi: "10.1093/nar/gky179" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + + ontologies: [] + - annotation: + type: directory + description: Directory containing RiboCode annotation files from + ribocode/prepare + pattern: "annotation" + + - - meta3: + type: map + description: | + Groovy Map containing config information + e.g. [ id:'config' ] + - config: + type: file + description: RiboCode configuration file containing P-site offsets from + ribocode/metaplots + pattern: "*_config.txt" + + ontologies: [] +output: + orf_txt: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.txt": + type: file + description: Text file containing all detected ORFs with detailed + information + pattern: "*.txt" + ontologies: [] + orf_txt_collapsed: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_collapsed.txt": + type: file + description: Text file containing collapsed ORFs (merged isoforms) + pattern: "*_collapsed.txt" + ontologies: [] + orf_pdf: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_ORFs_category.pdf": + type: file + description: PDF file with ORF category distribution plots + pattern: "*_ORFs_category.pdf" + ontologies: [] + psites_hd5: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_psites.hd5": + type: file + description: HDF5 file containing P-site positions + pattern: "*_psites.hd5" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@JackCurragh" diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test new file mode 100644 index 000000000000..30a236ddf9ff --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process RIBOCODE_RIBOCODE" + script "../main.nf" + process "RIBOCODE_RIBOCODE" + + tag "modules" + tag "modules_nfcore" + tag "ribocode" + tag "ribocode/ribocode" + tag "ribocode/prepare" + tag "ribocode/metaplots" + + setup { + run("RIBOCODE_PREPARE") { + script "../../prepare/main.nf" + process { + + """ + input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + """ + } + } + run("RIBOCODE_METAPLOTS") { + script "../../metaplots/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887.Aligned.toTranscriptome.out.bam", checkIfExists: true) + ] + input[1] = RIBOCODE_PREPARE.out.annotation + """ + } + } + } + + test("test_ribocode_ribocode") { + + config "./nextflow.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887.Aligned.toTranscriptome.out.bam", checkIfExists: true) + ] + input[1] = RIBOCODE_PREPARE.out.annotation + input[2] = RIBOCODE_METAPLOTS.out.config + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap new file mode 100644 index 000000000000..6b1967027044 --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -0,0 +1,97 @@ +{ + "test_ribocode_ribocode": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ORFs_category.pdf:md5,a56356649534ea846fe7aa3aac6684ff" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "SRX11780887.Aligned.toTranscriptome.out_psites.hd5:md5,802ec4fe5545dec4fe8affd79716faeb" + ] + ], + "4": [ + "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" + ], + "orf_pdf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ORFs_category.pdf:md5,a56356649534ea846fe7aa3aac6684ff" + ] + ], + "orf_txt": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ] + ], + "orf_txt_collapsed": [ + [ + { + "id": "test", + "single_end": false + }, + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ], + "psites_hd5": [ + [ + { + "id": "test", + "single_end": false + }, + "SRX11780887.Aligned.toTranscriptome.out_psites.hd5:md5,802ec4fe5545dec4fe8affd79716faeb" + ] + ], + "versions": [ + "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-01T15:30:33.774086" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/nextflow.config b/modules/nf-core/ribocode/ribocode/tests/nextflow.config new file mode 100644 index 000000000000..58b655a69aef --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + withName: RIBOCODE_METAPLOTS { + ext.args = '-f0_percent 0.1 -pv1 1 -pv2 1' + } + withName: RIBOCODE_RIBOCODE { + ext.args = '' + } +} From e33ba2df9e2528bb9f1be73ac3691b0ec0fe505d Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Tue, 2 Dec 2025 20:25:40 +0000 Subject: [PATCH 02/15] GTFUpdate; meta in inputs; No Gzip; --- .../ribocode/gtfupdate/environment.yml | 6 ++ modules/nf-core/ribocode/gtfupdate/main.nf | 48 +++++++++ modules/nf-core/ribocode/gtfupdate/meta.yml | 48 +++++++++ .../ribocode/gtfupdate/tests/main.nf.test | 34 +++++++ modules/nf-core/ribocode/metaplots/main.nf | 2 +- modules/nf-core/ribocode/metaplots/meta.yml | 13 ++- .../ribocode/metaplots/tests/main.nf.test | 35 ++++++- .../metaplots/tests/main.nf.test.snap | 55 ----------- modules/nf-core/ribocode/prepare/main.nf | 30 ++---- modules/nf-core/ribocode/prepare/meta.yml | 47 +++++---- .../ribocode/prepare/tests/main.nf.test | 31 +++++- .../ribocode/prepare/tests/main.nf.test.snap | 33 ------- .../nf-core/ribocode/ribocode/environment.yml | 3 +- modules/nf-core/ribocode/ribocode/main.nf | 2 +- modules/nf-core/ribocode/ribocode/meta.yml | 16 +-- .../ribocode/ribocode/tests/main.nf.test | 37 ++++++- .../ribocode/ribocode/tests/main.nf.test.snap | 97 ------------------- .../ribocode/ribocode/tests/nextflow.config | 3 - 18 files changed, 291 insertions(+), 249 deletions(-) create mode 100644 modules/nf-core/ribocode/gtfupdate/environment.yml create mode 100644 modules/nf-core/ribocode/gtfupdate/main.nf create mode 100644 modules/nf-core/ribocode/gtfupdate/meta.yml create mode 100644 modules/nf-core/ribocode/gtfupdate/tests/main.nf.test delete mode 100644 modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap delete mode 100644 modules/nf-core/ribocode/prepare/tests/main.nf.test.snap delete mode 100644 modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap diff --git a/modules/nf-core/ribocode/gtfupdate/environment.yml b/modules/nf-core/ribocode/gtfupdate/environment.yml new file mode 100644 index 000000000000..248e76fd71fb --- /dev/null +++ b/modules/nf-core/ribocode/gtfupdate/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::ribocode=1.2.15 \ No newline at end of file diff --git a/modules/nf-core/ribocode/gtfupdate/main.nf b/modules/nf-core/ribocode/gtfupdate/main.nf new file mode 100644 index 000000000000..85770161f598 --- /dev/null +++ b/modules/nf-core/ribocode/gtfupdate/main.nf @@ -0,0 +1,48 @@ +process RIBOCODE_GTFUPDATE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ribocode:1.2.15--pyhfa5458b_0': + 'biocontainers/ribocode:1.2.15--pyhfa5458b_0' }" + + input: + tuple val(meta), path(gtf) + + output: + tuple val(meta), path("*.gtf"), emit: gtf + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + GTFupdate \\ + ${gtf} \\ + $args \\ + > ${prefix}_updated.gtf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(RiboCode --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}_updated.gtf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + RiboCode: \$(echo "1.2.15") + END_VERSIONS + """ +} diff --git a/modules/nf-core/ribocode/gtfupdate/meta.yml b/modules/nf-core/ribocode/gtfupdate/meta.yml new file mode 100644 index 000000000000..5a6f2f0e47f5 --- /dev/null +++ b/modules/nf-core/ribocode/gtfupdate/meta.yml @@ -0,0 +1,48 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "ribocode_gtfupdate" +description: Update GTF annotation file for RiboCode compatibility +keywords: + - Ribo-Seq + - Ribosome Profiling + - GTF + - annotation +tools: + - "ribocode": + description: "A package for detecting the actively translated ORFs using ribosome-profiling + data" + homepage: "https://github.com/xryanglab/RiboCode" + documentation: "https://github.com/xryanglab/RiboCode" + tool_dev_url: "https://github.com/xryanglab/RiboCode" + doi: "10.1093/nar/gky179" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - gtf: + type: file + description: GTF annotation file to update (uncompressed) + pattern: "*.{gtf}" + ontologies: [] +output: + gtf: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - "*.gtf": + type: file + description: Updated GTF annotation file + pattern: "*_updated.gtf" + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@JackCurragh" diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test new file mode 100644 index 000000000000..9c7ff896990a --- /dev/null +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test @@ -0,0 +1,34 @@ +nextflow_process { + + name "Test Process RIBOCODE_GTFUPDATE" + script "../main.nf" + process "RIBOCODE_GTFUPDATE" + + tag "modules" + tag "modules_nfcore" + tag "ribocode" + tag "ribocode/gtfupdate" + + test("test_ribocode_gtfupdate") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ribocode/metaplots/main.nf b/modules/nf-core/ribocode/metaplots/main.nf index f07e198f8902..7e1fd794d5fa 100644 --- a/modules/nf-core/ribocode/metaplots/main.nf +++ b/modules/nf-core/ribocode/metaplots/main.nf @@ -9,7 +9,7 @@ process RIBOCODE_METAPLOTS { input: tuple val(meta), path(bam) - path annotation + tuple val(meta2), path(annotation) output: tuple val(meta), path("*config.txt") , emit: config diff --git a/modules/nf-core/ribocode/metaplots/meta.yml b/modules/nf-core/ribocode/metaplots/meta.yml index 6074a441b907..2e17e75b0b7b 100644 --- a/modules/nf-core/ribocode/metaplots/meta.yml +++ b/modules/nf-core/ribocode/metaplots/meta.yml @@ -27,10 +27,15 @@ input: description: Sorted BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" ontologies: [] - - annotation: - type: directory - description: Directory containing annotation files - pattern: "annotation" + - - meta2: + type: map + description: | + Groovy Map containing annotation information + e.g. `[ id:'genome' ]` + - annotation: + type: directory + description: Directory containing annotation files from ribocode/prepare + pattern: "annotation" output: config: diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test b/modules/nf-core/ribocode/metaplots/tests/main.nf.test index e3c831c63f55..fb77ed332da2 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test @@ -9,15 +9,38 @@ nextflow_process { tag "ribocode" tag "ribocode/metaplots" tag "ribocode/prepare" + tag "ribocode/gtfupdate" + tag "gunzip" setup { + run("GUNZIP") { + script "../../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + ] + """ + } + } + run("RIBOCODE_GTFUPDATE") { + script "../../gtfupdate/main.nf" + process { + """ + input[0] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + ] + """ + } + } run("RIBOCODE_PREPARE") { script "../../prepare/main.nf" process { - """ - input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) - input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + input[0] = GUNZIP.out.gunzip + input[1] = RIBOCODE_GTFUPDATE.out.gtf """ } } @@ -42,7 +65,11 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.config, + process.out.versions + ).match() }, + { assert process.out.pdf[0][1].toString().endsWith('.pdf') } ) } diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap deleted file mode 100644 index d215ad75a64b..000000000000 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ /dev/null @@ -1,55 +0,0 @@ -{ - "test_ribocode_metaplots": { - "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" - ] - ], - "1": [ - [ - { - "id": "test", - "single_end": false - }, - "testSRX11780887.Aligned.toTranscriptome.out.pdf:md5,464c91bb5532a571ed2c9c6ae6403a86" - ] - ], - "2": [ - "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" - ], - "config": [ - [ - { - "id": "test", - "single_end": false - }, - "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" - ] - ], - "pdf": [ - [ - { - "id": "test", - "single_end": false - }, - "testSRX11780887.Aligned.toTranscriptome.out.pdf:md5,464c91bb5532a571ed2c9c6ae6403a86" - ] - ], - "versions": [ - "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-12-01T15:29:32.897378" - } -} \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/main.nf b/modules/nf-core/ribocode/prepare/main.nf index 6f1962dcbec8..f38042d5a1ce 100644 --- a/modules/nf-core/ribocode/prepare/main.nf +++ b/modules/nf-core/ribocode/prepare/main.nf @@ -1,5 +1,5 @@ process RIBOCODE_PREPARE { - tag "$fasta" + tag "$meta.id" label 'process_single' conda "${moduleDir}/environment.yml" @@ -8,12 +8,12 @@ process RIBOCODE_PREPARE { 'biocontainers/ribocode:1.2.15--pyhfa5458b_0' }" input: - path fasta - path gtf + tuple val(meta), path(fasta) + tuple val(meta2), path(gtf) output: - path "annotation" , emit: annotation - path "versions.yml" , emit: versions + tuple val(meta), path("annotation"), emit: annotation + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -22,23 +22,11 @@ process RIBOCODE_PREPARE { def args = task.ext.args ?: '' """ - # nf-core: ensure FASTA is uncompressed - GENOME="$fasta" - if [[ "\$GENOME" == *.gz ]]; then - gunzip -c "\$GENOME" > genome.fa - GENOME="genome.fa" - fi - - # Update the GTF - GTFupdate \\ - $gtf \\ - > updated.gtf - - # Run prepare_transcripts with uncompressed FASTA prepare_transcripts \\ - -g updated.gtf \\ - -f "\$GENOME" \\ - -o annotation + -g ${gtf} \\ + -f ${fasta} \\ + -o annotation \\ + $args cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/ribocode/prepare/meta.yml b/modules/nf-core/ribocode/prepare/meta.yml index 782b94e3f354..1d2ad107f89d 100644 --- a/modules/nf-core/ribocode/prepare/meta.yml +++ b/modules/nf-core/ribocode/prepare/meta.yml @@ -17,25 +17,38 @@ tools: identifier: "" input: - - fasta: - type: file - description: Reference genome FASTA file - pattern: "*.{fasta,fa,fna}" - ontologies: [] - - gtf: - type: file - description: Reference genome GTF annotation file - pattern: "*.{gtf}" - - ontologies: [] + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - fasta: + type: file + description: Reference genome FASTA file (uncompressed) + pattern: "*.{fasta,fa,fna}" + ontologies: [] + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'genome' ]` + - gtf: + type: file + description: Reference genome GTF annotation file (uncompressed, updated with ribocode/gtfupdate) + pattern: "*.{gtf}" + ontologies: [] output: annotation: - - annotation: - type: directory - description: Directory containing RiboCode annotation files - (transcripts_cds.txt, transcripts_sequence.fa, transcripts.pickle) - pattern: "annotation/" - + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + - annotation: + type: directory + description: Directory containing RiboCode annotation files + (transcripts_cds.txt, transcripts_sequence.fa, transcripts.pickle) + pattern: "annotation/" versions: - versions.yml: type: file diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test b/modules/nf-core/ribocode/prepare/tests/main.nf.test index 81d06823d636..3844b33ed5c4 100644 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test @@ -8,14 +8,41 @@ nextflow_process { tag "modules_nfcore" tag "ribocode" tag "ribocode/prepare" + tag "ribocode/gtfupdate" + tag "gunzip" + + setup { + run("GUNZIP") { + script "../../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + ] + """ + } + } + run("RIBOCODE_GTFUPDATE") { + script "../../gtfupdate/main.nf" + process { + """ + input[0] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + ] + """ + } + } + } test("test_ribocode_prepare") { when { process { """ - input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) - input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + input[0] = GUNZIP.out.gunzip + input[1] = RIBOCODE_GTFUPDATE.out.gtf """ } } diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap deleted file mode 100644 index 84091112c8e5..000000000000 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap +++ /dev/null @@ -1,33 +0,0 @@ -{ - "test_ribocode_prepare": { - "content": [ - { - "0": [ - [ - "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", - "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", - "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" - ] - ], - "1": [ - "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" - ], - "annotation": [ - [ - "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", - "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", - "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" - ] - ], - "versions": [ - "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-12-01T13:44:59.168396" - } -} \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/environment.yml b/modules/nf-core/ribocode/ribocode/environment.yml index 248e76fd71fb..592fa3c19932 100644 --- a/modules/nf-core/ribocode/ribocode/environment.yml +++ b/modules/nf-core/ribocode/ribocode/environment.yml @@ -3,4 +3,5 @@ channels: - bioconda - defaults dependencies: - - bioconda::ribocode=1.2.15 \ No newline at end of file + - bioconda::ribocode=1.2.15 + \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/main.nf b/modules/nf-core/ribocode/ribocode/main.nf index e6bdf5a6bdd3..3b68efc343dd 100644 --- a/modules/nf-core/ribocode/ribocode/main.nf +++ b/modules/nf-core/ribocode/ribocode/main.nf @@ -9,7 +9,7 @@ process RIBOCODE_RIBOCODE { input: tuple val(meta), path(bam) - path annotation + tuple val(meta2), path(annotation) tuple val(meta3), path(config) output: diff --git a/modules/nf-core/ribocode/ribocode/meta.yml b/modules/nf-core/ribocode/ribocode/meta.yml index 27ecf8d33eec..118787a1360c 100644 --- a/modules/nf-core/ribocode/ribocode/meta.yml +++ b/modules/nf-core/ribocode/ribocode/meta.yml @@ -27,12 +27,16 @@ input: pattern: "*.{bam,cram,sam}" ontologies: [] - - annotation: - type: directory - description: Directory containing RiboCode annotation files from - ribocode/prepare - pattern: "annotation" - + - - meta2: + type: map + description: | + Groovy Map containing annotation information + e.g. [ id:'genome' ] + - annotation: + type: directory + description: Directory containing RiboCode annotation files from + ribocode/prepare + pattern: "annotation" - - meta3: type: map description: | diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test index 30a236ddf9ff..f7239b074bbe 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -10,15 +10,38 @@ nextflow_process { tag "ribocode/ribocode" tag "ribocode/prepare" tag "ribocode/metaplots" + tag "ribocode/gtfupdate" + tag "gunzip" setup { + run("GUNZIP") { + script "../../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) + ] + """ + } + } + run("RIBOCODE_GTFUPDATE") { + script "../../gtfupdate/main.nf" + process { + """ + input[0] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + ] + """ + } + } run("RIBOCODE_PREPARE") { script "../../prepare/main.nf" process { - """ - input[0] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.dna.chromosome.20.fa.gz", checkIfExists: true) - input[1] = file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/Homo_sapiens.GRCh38.111_chr20.gtf", checkIfExists: true) + input[0] = GUNZIP.out.gunzip + input[1] = RIBOCODE_GTFUPDATE.out.gtf """ } } @@ -56,7 +79,13 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.orf_txt, + process.out.orf_txt_collapsed, + process.out.versions + ).match() }, + { assert process.out.orf_pdf[0][1].toString().endsWith('.pdf') }, + { assert process.out.psites_hd5[0][1].toString().endsWith('.hd5') } ) } diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap deleted file mode 100644 index 6b1967027044..000000000000 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ /dev/null @@ -1,97 +0,0 @@ -{ - "test_ribocode_ribocode": { - "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", - "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" - ] - ] - ], - "1": [ - [ - { - "id": "test", - "single_end": false - }, - "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" - ] - ], - "2": [ - [ - { - "id": "test", - "single_end": false - }, - "test_ORFs_category.pdf:md5,a56356649534ea846fe7aa3aac6684ff" - ] - ], - "3": [ - [ - { - "id": "test", - "single_end": false - }, - "SRX11780887.Aligned.toTranscriptome.out_psites.hd5:md5,802ec4fe5545dec4fe8affd79716faeb" - ] - ], - "4": [ - "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" - ], - "orf_pdf": [ - [ - { - "id": "test", - "single_end": false - }, - "test_ORFs_category.pdf:md5,a56356649534ea846fe7aa3aac6684ff" - ] - ], - "orf_txt": [ - [ - { - "id": "test", - "single_end": false - }, - [ - "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", - "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" - ] - ] - ], - "orf_txt_collapsed": [ - [ - { - "id": "test", - "single_end": false - }, - "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" - ] - ], - "psites_hd5": [ - [ - { - "id": "test", - "single_end": false - }, - "SRX11780887.Aligned.toTranscriptome.out_psites.hd5:md5,802ec4fe5545dec4fe8affd79716faeb" - ] - ], - "versions": [ - "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" - ] - } - ], - "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.0" - }, - "timestamp": "2025-12-01T15:30:33.774086" - } -} \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/nextflow.config b/modules/nf-core/ribocode/ribocode/tests/nextflow.config index 58b655a69aef..3ccf4a70c6cd 100644 --- a/modules/nf-core/ribocode/ribocode/tests/nextflow.config +++ b/modules/nf-core/ribocode/ribocode/tests/nextflow.config @@ -2,7 +2,4 @@ process { withName: RIBOCODE_METAPLOTS { ext.args = '-f0_percent 0.1 -pv1 1 -pv2 1' } - withName: RIBOCODE_RIBOCODE { - ext.args = '' - } } From bf21e3b83b30598c25f67f998d5e524a6f43519e Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Tue, 2 Dec 2025 21:02:22 +0000 Subject: [PATCH 03/15] return snaps --- .../gtfupdate/tests/main.nf.test.snap | 35 +++++++++++++++ .../metaplots/tests/main.nf.test.snap | 23 ++++++++++ .../ribocode/prepare/tests/main.nf.test.snap | 43 +++++++++++++++++++ .../ribocode/ribocode/tests/main.nf.test.snap | 35 +++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/prepare/tests/main.nf.test.snap create mode 100644 modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap new file mode 100644 index 000000000000..489f0c08b53b --- /dev/null +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_ribocode_gtfupdate": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_updated.gtf:md5,4aee3722f1d061395e2fdce7277708b3" + ] + ], + "1": [ + "versions.yml:md5,93ce7cda2c54dfc37a859ecdcbc8fe89" + ], + "gtf": [ + [ + { + "id": "test" + }, + "test_updated.gtf:md5,4aee3722f1d061395e2fdce7277708b3" + ] + ], + "versions": [ + "versions.yml:md5,93ce7cda2c54dfc37a859ecdcbc8fe89" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-02T20:59:23.131711" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap new file mode 100644 index 000000000000..1b6960bc7c85 --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -0,0 +1,23 @@ +{ + "test_ribocode_metaplots": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" + ] + ], + [ + "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-02T20:39:14.398955" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap new file mode 100644 index 000000000000..7638295e395d --- /dev/null +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap @@ -0,0 +1,43 @@ +{ + "test_ribocode_prepare": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ] + ], + "1": [ + "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + ], + "annotation": [ + [ + { + "id": "test" + }, + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ] + ], + "versions": [ + "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-02T20:39:52.117966" + } +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap new file mode 100644 index 000000000000..7de922b06dd4 --- /dev/null +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_ribocode_ribocode": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ], + [ + "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-12-02T20:40:57.09874" + } +} \ No newline at end of file From 2d29a9e985c61846595181debc2e94e37dde3a17 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 8 Dec 2025 12:56:32 +0000 Subject: [PATCH 04/15] nf-test passing --- modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap | 2 +- modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap | 2 +- modules/nf-core/ribocode/prepare/tests/main.nf.test.snap | 2 +- modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap index 489f0c08b53b..b83abe16015a 100644 --- a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap @@ -30,6 +30,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-02T20:59:23.131711" + "timestamp": "2025-12-08T12:55:37.985303" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap index 1b6960bc7c85..eed5b4a4a292 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -18,6 +18,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-02T20:39:14.398955" + "timestamp": "2025-12-03T11:50:10.058623" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap index 7638295e395d..0990949d00b9 100644 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap @@ -38,6 +38,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-02T20:39:52.117966" + "timestamp": "2025-12-03T11:49:24.930644" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index 7de922b06dd4..606e763d0127 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -30,6 +30,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-02T20:40:57.09874" + "timestamp": "2025-12-03T11:51:14.213609" } } \ No newline at end of file From f3b6e88d58e57bf326510d845eed7fa9c6552601 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 15 Dec 2025 11:12:28 +0000 Subject: [PATCH 05/15] Update RiboCode versions to use topics --- modules/nf-core/ribocode/gtfupdate/main.nf | 14 ++------- modules/nf-core/ribocode/gtfupdate/meta.yml | 26 ++++++++++++--- modules/nf-core/ribocode/metaplots/main.nf | 16 ++-------- modules/nf-core/ribocode/metaplots/meta.yml | 26 ++++++++++++--- modules/nf-core/ribocode/prepare/main.nf | 14 ++------- modules/nf-core/ribocode/prepare/meta.yml | 33 ++++++++++++++----- modules/nf-core/ribocode/ribocode/main.nf | 20 +++--------- modules/nf-core/ribocode/ribocode/meta.yml | 35 +++++++++++++++------ 8 files changed, 107 insertions(+), 77 deletions(-) diff --git a/modules/nf-core/ribocode/gtfupdate/main.nf b/modules/nf-core/ribocode/gtfupdate/main.nf index 85770161f598..32479326955f 100644 --- a/modules/nf-core/ribocode/gtfupdate/main.nf +++ b/modules/nf-core/ribocode/gtfupdate/main.nf @@ -11,8 +11,8 @@ process RIBOCODE_GTFUPDATE { tuple val(meta), path(gtf) output: - tuple val(meta), path("*.gtf"), emit: gtf - path "versions.yml" , emit: versions + tuple val(meta), path("*.gtf") , emit: gtf + tuple val("${task.process}"), val('ribocode'), eval('RiboCode --version 2>&1') , emit: versions_ribocode, topic: versions when: task.ext.when == null || task.ext.when @@ -26,11 +26,6 @@ process RIBOCODE_GTFUPDATE { ${gtf} \\ $args \\ > ${prefix}_updated.gtf - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(RiboCode --version) - END_VERSIONS """ stub: @@ -39,10 +34,5 @@ process RIBOCODE_GTFUPDATE { """ touch ${prefix}_updated.gtf - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(echo "1.2.15") - END_VERSIONS """ } diff --git a/modules/nf-core/ribocode/gtfupdate/meta.yml b/modules/nf-core/ribocode/gtfupdate/meta.yml index 5a6f2f0e47f5..cfca28814bcd 100644 --- a/modules/nf-core/ribocode/gtfupdate/meta.yml +++ b/modules/nf-core/ribocode/gtfupdate/meta.yml @@ -39,10 +39,28 @@ output: type: file description: Updated GTF annotation file pattern: "*_updated.gtf" + versions_ribocode: + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + authors: - "@JackCurragh" diff --git a/modules/nf-core/ribocode/metaplots/main.nf b/modules/nf-core/ribocode/metaplots/main.nf index 7e1fd794d5fa..37a4b92adb37 100644 --- a/modules/nf-core/ribocode/metaplots/main.nf +++ b/modules/nf-core/ribocode/metaplots/main.nf @@ -12,9 +12,9 @@ process RIBOCODE_METAPLOTS { tuple val(meta2), path(annotation) output: - tuple val(meta), path("*config.txt") , emit: config - tuple val(meta), path("*.pdf") , emit: pdf - path "versions.yml" , emit: versions + tuple val(meta), path("*config.txt") , emit: config + tuple val(meta), path("*.pdf") , emit: pdf + tuple val("${task.process}"), val('ribocode'), eval('RiboCode --version 2>&1') , emit: versions_ribocode, topic: versions when: task.ext.when == null || task.ext.when @@ -28,11 +28,6 @@ process RIBOCODE_METAPLOTS { -r $bam \\ -o ${prefix} \\ $args - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(RiboCode --version 2>&1) - END_VERSIONS """ stub: @@ -41,10 +36,5 @@ process RIBOCODE_METAPLOTS { """ touch ${prefix}_config.txt touch ${prefix}_report.pdf - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(echo "1.2.15") - END_VERSIONS """ } diff --git a/modules/nf-core/ribocode/metaplots/meta.yml b/modules/nf-core/ribocode/metaplots/meta.yml index 2e17e75b0b7b..2af6033ea570 100644 --- a/modules/nf-core/ribocode/metaplots/meta.yml +++ b/modules/nf-core/ribocode/metaplots/meta.yml @@ -60,10 +60,28 @@ output: description: PDF file containing P-site metaplots for quality control pattern: "*_report.pdf" ontologies: [] + versions_ribocode: + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + authors: - "@JackCurragh" diff --git a/modules/nf-core/ribocode/prepare/main.nf b/modules/nf-core/ribocode/prepare/main.nf index f38042d5a1ce..855b5aba994f 100644 --- a/modules/nf-core/ribocode/prepare/main.nf +++ b/modules/nf-core/ribocode/prepare/main.nf @@ -12,8 +12,8 @@ process RIBOCODE_PREPARE { tuple val(meta2), path(gtf) output: - tuple val(meta), path("annotation"), emit: annotation - path "versions.yml" , emit: versions + tuple val(meta), path("annotation") , emit: annotation + tuple val("${task.process}"), val('ribocode'), eval('RiboCode --version 2>&1') , emit: versions_ribocode, topic: versions when: task.ext.when == null || task.ext.when @@ -27,11 +27,6 @@ process RIBOCODE_PREPARE { -f ${fasta} \\ -o annotation \\ $args - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(RiboCode --version) - END_VERSIONS """ stub: @@ -43,10 +38,5 @@ process RIBOCODE_PREPARE { touch annotation/transcripts_cds.txt touch annotation/transcripts_sequence.fa touch annotation/transcripts.pickle - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(echo "1.2.15") - END_VERSIONS """ } diff --git a/modules/nf-core/ribocode/prepare/meta.yml b/modules/nf-core/ribocode/prepare/meta.yml index 1d2ad107f89d..050059b47f25 100644 --- a/modules/nf-core/ribocode/prepare/meta.yml +++ b/modules/nf-core/ribocode/prepare/meta.yml @@ -34,7 +34,8 @@ input: e.g. `[ id:'genome' ]` - gtf: type: file - description: Reference genome GTF annotation file (uncompressed, updated with ribocode/gtfupdate) + description: Reference genome GTF annotation file (uncompressed, updated with + ribocode/gtfupdate) pattern: "*.{gtf}" ontologies: [] output: @@ -46,13 +47,31 @@ output: e.g. `[ id:'test', single_end:false ]` - annotation: type: directory - description: Directory containing RiboCode annotation files - (transcripts_cds.txt, transcripts_sequence.fa, transcripts.pickle) + description: Directory containing RiboCode annotation files (transcripts_cds.txt, + transcripts_sequence.fa, transcripts.pickle) pattern: "annotation/" + versions_ribocode: + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + authors: - "@JackCurragh" diff --git a/modules/nf-core/ribocode/ribocode/main.nf b/modules/nf-core/ribocode/ribocode/main.nf index 3b68efc343dd..264338dfd521 100644 --- a/modules/nf-core/ribocode/ribocode/main.nf +++ b/modules/nf-core/ribocode/ribocode/main.nf @@ -14,11 +14,11 @@ process RIBOCODE_RIBOCODE { output: - tuple val(meta), path("*.txt") , emit: orf_txt - tuple val(meta), path("*_collapsed.txt") , emit: orf_txt_collapsed - tuple val(meta), path("*_ORFs_category.pdf") , emit: orf_pdf, optional: true - tuple val(meta), path("*_psites.hd5") , emit: psites_hd5, optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*.txt") , emit: orf_txt + tuple val(meta), path("*_collapsed.txt") , emit: orf_txt_collapsed + tuple val(meta), path("*_ORFs_category.pdf") , emit: orf_pdf, optional: true + tuple val(meta), path("*_psites.hd5") , emit: psites_hd5, optional: true + tuple val("${task.process}"), val('ribocode'), eval('RiboCode --version 2>&1') , emit: versions_ribocode, topic: versions when: task.ext.when == null || task.ext.when @@ -32,11 +32,6 @@ process RIBOCODE_RIBOCODE { -c $config \\ -o ${prefix} \\ $args 2>&1 || test -s ${prefix}.txt - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(RiboCode --version 2>&1) - END_VERSIONS """ stub: @@ -48,10 +43,5 @@ process RIBOCODE_RIBOCODE { touch ${prefix}_collapsed.txt touch ${prefix}_ORFs_category.pdf touch ${prefix}_psites.hd5 - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - RiboCode: \$(echo "1.2.15") - END_VERSIONS """ } diff --git a/modules/nf-core/ribocode/ribocode/meta.yml b/modules/nf-core/ribocode/ribocode/meta.yml index 118787a1360c..c205bd561a14 100644 --- a/modules/nf-core/ribocode/ribocode/meta.yml +++ b/modules/nf-core/ribocode/ribocode/meta.yml @@ -34,8 +34,7 @@ input: e.g. [ id:'genome' ] - annotation: type: directory - description: Directory containing RiboCode annotation files from - ribocode/prepare + description: Directory containing RiboCode annotation files from ribocode/prepare pattern: "annotation" - - meta3: type: map @@ -44,8 +43,7 @@ input: e.g. [ id:'config' ] - config: type: file - description: RiboCode configuration file containing P-site offsets from - ribocode/metaplots + description: RiboCode configuration file containing P-site offsets from ribocode/metaplots pattern: "*_config.txt" ontologies: [] @@ -58,8 +56,7 @@ output: e.g. [ id:'test', single_end:false ] - "*.txt": type: file - description: Text file containing all detected ORFs with detailed - information + description: Text file containing all detected ORFs with detailed information pattern: "*.txt" ontologies: [] orf_txt_collapsed: @@ -95,10 +92,28 @@ output: description: HDF5 file containing P-site positions pattern: "*_psites.hd5" ontologies: [] + versions_ribocode: + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + +topics: versions: - - versions.yml: - type: file - description: File containing software versions - pattern: "versions.yml" + - - ${task.process}: + type: string + description: Name of the process + - ribocode: + type: string + description: Name of the tool + - RiboCode --version 2>&1: + type: eval + description: The expression to obtain the version of the tool + authors: - "@JackCurragh" From 70de4644446aec4e3a68eb8c18d5bcdf935b6601 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 15 Dec 2025 11:18:40 +0000 Subject: [PATCH 06/15] Update RiboCode versions to use topics -New lines at EOF --- .../nf-core/ribocode/gtfupdate/environment.yml | 2 +- .../ribocode/gtfupdate/tests/main.nf.test.snap | 16 ++++++++++++---- .../nf-core/ribocode/metaplots/environment.yml | 2 +- .../ribocode/metaplots/tests/main.nf.test.snap | 6 ++---- modules/nf-core/ribocode/prepare/environment.yml | 2 +- .../ribocode/prepare/tests/main.nf.test.snap | 16 ++++++++++++---- .../ribocode/ribocode/tests/main.nf.test.snap | 6 ++---- 7 files changed, 31 insertions(+), 19 deletions(-) diff --git a/modules/nf-core/ribocode/gtfupdate/environment.yml b/modules/nf-core/ribocode/gtfupdate/environment.yml index 248e76fd71fb..ff3565ed61d3 100644 --- a/modules/nf-core/ribocode/gtfupdate/environment.yml +++ b/modules/nf-core/ribocode/gtfupdate/environment.yml @@ -3,4 +3,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::ribocode=1.2.15 \ No newline at end of file + - bioconda::ribocode=1.2.15 diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap index b83abe16015a..0cb864ed94e3 100644 --- a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap @@ -11,7 +11,11 @@ ] ], "1": [ - "versions.yml:md5,93ce7cda2c54dfc37a859ecdcbc8fe89" + [ + "RIBOCODE_GTFUPDATE", + "ribocode", + "1.2.14" + ] ], "gtf": [ [ @@ -21,8 +25,12 @@ "test_updated.gtf:md5,4aee3722f1d061395e2fdce7277708b3" ] ], - "versions": [ - "versions.yml:md5,93ce7cda2c54dfc37a859ecdcbc8fe89" + "versions_ribocode": [ + [ + "RIBOCODE_GTFUPDATE", + "ribocode", + "1.2.14" + ] ] } ], @@ -30,6 +38,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-08T12:55:37.985303" + "timestamp": "2025-12-15T11:14:51.363694" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/environment.yml b/modules/nf-core/ribocode/metaplots/environment.yml index 248e76fd71fb..ff3565ed61d3 100644 --- a/modules/nf-core/ribocode/metaplots/environment.yml +++ b/modules/nf-core/ribocode/metaplots/environment.yml @@ -3,4 +3,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::ribocode=1.2.15 \ No newline at end of file + - bioconda::ribocode=1.2.15 diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap index eed5b4a4a292..35a0d1018703 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -10,14 +10,12 @@ "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" ] ], - [ - "versions.yml:md5,7e9b4c67f04dd073e78f174e1e41720c" - ] + null ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-03T11:50:10.058623" + "timestamp": "2025-12-15T11:16:13.855037" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/prepare/environment.yml b/modules/nf-core/ribocode/prepare/environment.yml index 248e76fd71fb..ff3565ed61d3 100644 --- a/modules/nf-core/ribocode/prepare/environment.yml +++ b/modules/nf-core/ribocode/prepare/environment.yml @@ -3,4 +3,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::ribocode=1.2.15 \ No newline at end of file + - bioconda::ribocode=1.2.15 diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap index 0990949d00b9..27b024ce9aac 100644 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap @@ -15,7 +15,11 @@ ] ], "1": [ - "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + [ + "RIBOCODE_PREPARE", + "ribocode", + "1.2.14" + ] ], "annotation": [ [ @@ -29,8 +33,12 @@ ] ] ], - "versions": [ - "versions.yml:md5,1e4f61620a60ab2fcc8c650519e5a034" + "versions_ribocode": [ + [ + "RIBOCODE_PREPARE", + "ribocode", + "1.2.14" + ] ] } ], @@ -38,6 +46,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-03T11:49:24.930644" + "timestamp": "2025-12-15T11:15:27.53748" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index 606e763d0127..a8cf0433520b 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -22,14 +22,12 @@ "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" ] ], - [ - "versions.yml:md5,2524b02cc4775015c09703548ce5cf66" - ] + null ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-03T11:51:14.213609" + "timestamp": "2025-12-15T11:17:19.614453" } } \ No newline at end of file From 2aabecfc4fba1d852e3fb0ba45bddde8ff3093f9 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 15 Dec 2025 11:22:07 +0000 Subject: [PATCH 07/15] Update RiboCode versions to use topics - Prettier --- modules/nf-core/ribocode/ribocode/environment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/nf-core/ribocode/ribocode/environment.yml b/modules/nf-core/ribocode/ribocode/environment.yml index 592fa3c19932..ff3565ed61d3 100644 --- a/modules/nf-core/ribocode/ribocode/environment.yml +++ b/modules/nf-core/ribocode/ribocode/environment.yml @@ -4,4 +4,3 @@ channels: - defaults dependencies: - bioconda::ribocode=1.2.15 - \ No newline at end of file From 5d6804b3efcce8232012ae24d420da63e33f0818 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 15 Dec 2025 11:52:59 +0000 Subject: [PATCH 08/15] RiboCode update snapshots --- modules/nf-core/ribocode/metaplots/tests/main.nf.test | 1 - modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap | 5 ++--- modules/nf-core/ribocode/ribocode/tests/main.nf.test | 1 - modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap | 5 ++--- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test b/modules/nf-core/ribocode/metaplots/tests/main.nf.test index fb77ed332da2..43b898719037 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test @@ -67,7 +67,6 @@ nextflow_process { { assert process.success }, { assert snapshot( process.out.config, - process.out.versions ).match() }, { assert process.out.pdf[0][1].toString().endsWith('.pdf') } ) diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap index 35a0d1018703..99e793e97a04 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -9,13 +9,12 @@ }, "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" ] - ], - null + ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:16:13.855037" + "timestamp": "2025-12-15T11:47:26.43515" } } \ No newline at end of file diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test index f7239b074bbe..60b6a3ec9fd2 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -82,7 +82,6 @@ nextflow_process { { assert snapshot( process.out.orf_txt, process.out.orf_txt_collapsed, - process.out.versions ).match() }, { assert process.out.orf_pdf[0][1].toString().endsWith('.pdf') }, { assert process.out.psites_hd5[0][1].toString().endsWith('.hd5') } diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index a8cf0433520b..62628df3a94f 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -21,13 +21,12 @@ }, "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" ] - ], - null + ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:17:19.614453" + "timestamp": "2025-12-15T11:49:03.627867" } } \ No newline at end of file From e722c60df73925e0e55e00c6a598db46ad1bcd10 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Mon, 15 Dec 2025 14:05:25 +0000 Subject: [PATCH 09/15] Update RiboCode snapshots to container versions --- .../ribocode/gtfupdate/tests/main.nf.test | 5 +- .../gtfupdate/tests/main.nf.test.snap | 63 +++++++++++++++- .../ribocode/metaplots/tests/main.nf.test | 9 +-- .../metaplots/tests/main.nf.test.snap | 40 ++++++++++- .../ribocode/prepare/tests/main.nf.test | 7 +- .../ribocode/prepare/tests/main.nf.test.snap | 71 ++++++++++++++++++- .../ribocode/ribocode/tests/main.nf.test | 7 +- .../ribocode/ribocode/tests/main.nf.test.snap | 52 +++++++++++++- 8 files changed, 229 insertions(+), 25 deletions(-) diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test index 9c7ff896990a..c5847e4e6758 100644 --- a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test @@ -25,10 +25,9 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(process.out).match("process_outputs") }, + { assert snapshot(process.out.findAll { key, val -> key.startsWith("versions") }).match("versions") } ) } - } - } diff --git a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap index 0cb864ed94e3..5ff312476a30 100644 --- a/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/gtfupdate/tests/main.nf.test.snap @@ -38,6 +38,65 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:14:51.363694" + "timestamp": "2025-12-15T13:54:15.321484" + }, + "versions": { + "content": [ + { + "versions_ribocode": [ + [ + "RIBOCODE_GTFUPDATE", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T13:58:20.352527" + }, + "process_outputs": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_updated.gtf:md5,4aee3722f1d061395e2fdce7277708b3" + ] + ], + "1": [ + [ + "RIBOCODE_GTFUPDATE", + "ribocode", + "1.2.14" + ] + ], + "gtf": [ + [ + { + "id": "test" + }, + "test_updated.gtf:md5,4aee3722f1d061395e2fdce7277708b3" + ] + ], + "versions_ribocode": [ + [ + "RIBOCODE_GTFUPDATE", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T13:58:20.062134" } -} \ No newline at end of file +} diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test b/modules/nf-core/ribocode/metaplots/tests/main.nf.test index 43b898719037..dfb9f1e46443 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test @@ -65,13 +65,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - process.out.config, - ).match() }, - { assert process.out.pdf[0][1].toString().endsWith('.pdf') } + { assert snapshot(process.out.config).match("config") }, + { assert process.out.pdf[0][1].toString().endsWith('.pdf') }, + { assert snapshot(process.out.findAll { key, val -> key.startsWith("versions") }).match("versions") } ) } - } - } diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap index 99e793e97a04..fe21bec9c2fb 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -1,4 +1,40 @@ { + "versions": { + "content": [ + { + "versions_ribocode": [ + [ + "RIBOCODE_METAPLOTS", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:02:16.711086" + }, + "config": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_pre_config.txt:md5,6da5a4583c1f94ec908c9556bf7064be" + ] + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:02:16.699246" + }, "test_ribocode_metaplots": { "content": [ [ @@ -15,6 +51,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:47:26.43515" + "timestamp": "2025-12-15T13:43:28.043947" } -} \ No newline at end of file +} diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test b/modules/nf-core/ribocode/prepare/tests/main.nf.test index 3844b33ed5c4..c4a028d8038c 100644 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test @@ -50,10 +50,9 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(process.out).match("process_outputs") }, + { assert snapshot(process.out.findAll { key, val -> key.startsWith("versions") }).match("versions") } ) } - } - -} \ No newline at end of file +} diff --git a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap index 27b024ce9aac..137be4e42f5e 100644 --- a/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/prepare/tests/main.nf.test.snap @@ -46,6 +46,73 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:15:27.53748" + "timestamp": "2025-12-15T13:43:59.279438" + }, + "versions": { + "content": [ + { + "versions_ribocode": [ + [ + "RIBOCODE_PREPARE", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:01:21.822415" + }, + "process_outputs": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ] + ], + "1": [ + [ + "RIBOCODE_PREPARE", + "ribocode", + "1.2.14" + ] + ], + "annotation": [ + [ + { + "id": "test" + }, + [ + "transcripts.pickle:md5,b83be7910166b56d09c4879d38223883", + "transcripts_cds.txt:md5,6fae20439cbe378eb4db60a8bdf6a6af", + "transcripts_sequence.fa:md5,b0401ee625d655ea116528507b038c33" + ] + ] + ], + "versions_ribocode": [ + [ + "RIBOCODE_PREPARE", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:01:21.661508" } -} \ No newline at end of file +} diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test index 60b6a3ec9fd2..f73947555529 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -81,13 +81,12 @@ nextflow_process { { assert process.success }, { assert snapshot( process.out.orf_txt, - process.out.orf_txt_collapsed, - ).match() }, + process.out.orf_txt_collapsed + ).match("orf_outputs") }, + { assert snapshot(process.out.findAll { key, val -> key.startsWith("versions") }).match("versions") }, { assert process.out.orf_pdf[0][1].toString().endsWith('.pdf') }, { assert process.out.psites_hd5[0][1].toString().endsWith('.hd5') } ) } - } - } diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index 62628df3a94f..cdd047a1f9cd 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -1,4 +1,52 @@ { + "orf_outputs": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.txt:md5,89e5dc3e39fb52e98e921a379ee68b69", + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_collapsed.txt:md5,dbd709d42f94c6148bdbc0849dd028fb" + ] + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:03:21.475163" + }, + "versions": { + "content": [ + { + "versions_ribocode": [ + [ + "RIBOCODE_RIBOCODE", + "ribocode", + "1.2.14" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.2" + }, + "timestamp": "2025-12-15T14:03:21.494462" + }, "test_ribocode_ribocode": { "content": [ [ @@ -27,6 +75,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-15T11:49:03.627867" + "timestamp": "2025-12-15T13:45:06.981631" } -} \ No newline at end of file +} From c53f1489f5f2737babdbca7ae8b4cc776a66a1e9 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Wed, 17 Dec 2025 10:18:08 +0000 Subject: [PATCH 10/15] provide helpful error in metaplots --- modules/nf-core/ribocode/metaplots/main.nf | 9 +++++++++ modules/nf-core/ribocode/metaplots/tests/nextflow.config | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/ribocode/metaplots/main.nf b/modules/nf-core/ribocode/metaplots/main.nf index 37a4b92adb37..496a49e40e7f 100644 --- a/modules/nf-core/ribocode/metaplots/main.nf +++ b/modules/nf-core/ribocode/metaplots/main.nf @@ -28,6 +28,15 @@ process RIBOCODE_METAPLOTS { -r $bam \\ -o ${prefix} \\ $args + + config_lines=\$(wc -l < ${prefix}_pre_config.txt) + if [ "\$config_lines" -le 1 ]; then + echo "" >&2 + echo "ERROR: metaplots created config file with only header line." >&2 + echo "This usually indicates insufficient periodic signal in Ribo-Seq data." >&2 + echo "Investigate alignment performance or risk lower quality annotations by lowering cutoff with --extra_ribocode_metaplots_args '-f0_percent 0.XX'" >&2 + exit 1 + fi """ stub: diff --git a/modules/nf-core/ribocode/metaplots/tests/nextflow.config b/modules/nf-core/ribocode/metaplots/tests/nextflow.config index 3ccf4a70c6cd..6e7bd1c17c79 100644 --- a/modules/nf-core/ribocode/metaplots/tests/nextflow.config +++ b/modules/nf-core/ribocode/metaplots/tests/nextflow.config @@ -1,5 +1,5 @@ process { withName: RIBOCODE_METAPLOTS { - ext.args = '-f0_percent 0.1 -pv1 1 -pv2 1' + ext.args = '-f0_percent 0.9 -pv1 1 -pv2 1' } } From aaebd73c7a0e56891c23156077719224c430a23a Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Wed, 17 Dec 2025 10:34:37 +0000 Subject: [PATCH 11/15] add error catching to ribocode_ribocode when error in stdout --- modules/nf-core/ribocode/ribocode/main.nf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/nf-core/ribocode/ribocode/main.nf b/modules/nf-core/ribocode/ribocode/main.nf index 264338dfd521..2c4d86f1d2a6 100644 --- a/modules/nf-core/ribocode/ribocode/main.nf +++ b/modules/nf-core/ribocode/ribocode/main.nf @@ -27,11 +27,22 @@ process RIBOCODE_RIBOCODE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ + # Run RiboCode and capture output using tee to both display and save RiboCode \\ -a $annotation \\ -c $config \\ -o ${prefix} \\ - $args 2>&1 || test -s ${prefix}.txt + $args 2>&1 | tee ribocode_output.log || true + + # Check if RiboCode output contains any error messages + if grep -qi "^Error" ribocode_output.log; then + echo "" >&2 + echo "ERROR: RiboCode failed. Check the output above for details." >&2 + echo "Common causes:" >&2 + echo " - Invalid config file from metaplots (try adjusting --extra_ribocode_metaplots_args '-f0_percent 0.XX')" >&2 + echo " - Insufficient data from Ribo-Seq alignment" >&2 + exit 1 + fi """ stub: From 0424dcb3cd2c9d34cd33eb5922364df847c30ae4 Mon Sep 17 00:00:00 2001 From: Jack Tierney Date: Wed, 17 Dec 2025 11:35:43 +0000 Subject: [PATCH 12/15] reset defaults --- modules/nf-core/ribocode/metaplots/tests/nextflow.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/ribocode/metaplots/tests/nextflow.config b/modules/nf-core/ribocode/metaplots/tests/nextflow.config index 6e7bd1c17c79..3ccf4a70c6cd 100644 --- a/modules/nf-core/ribocode/metaplots/tests/nextflow.config +++ b/modules/nf-core/ribocode/metaplots/tests/nextflow.config @@ -1,5 +1,5 @@ process { withName: RIBOCODE_METAPLOTS { - ext.args = '-f0_percent 0.9 -pv1 1 -pv2 1' + ext.args = '-f0_percent 0.1 -pv1 1 -pv2 1' } } From 701c658d2c10b1cda787dfee71bdb5a36df656da Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Fri, 19 Dec 2025 10:24:48 +0000 Subject: [PATCH 13/15] Improve RiboCode error handling and add failure mode tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix error messages to use module-appropriate ext.args references instead of pipeline-specific argument names - Improve metaplots validation: check for actual data lines using grep instead of line count (handles blank lines correctly) - Improve ribocode error detection: use extended regex to catch both "^Error" and "Error:" patterns - Add failure mode tests for both modules to verify error handling - Add nextflow_fail.config for metaplots failure test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- modules/nf-core/ribocode/metaplots/main.nf | 9 +++--- .../ribocode/metaplots/tests/main.nf.test | 24 ++++++++++++++ .../metaplots/tests/main.nf.test.snap | 2 +- .../metaplots/tests/nextflow_fail.config | 5 +++ modules/nf-core/ribocode/ribocode/main.nf | 9 +++--- .../ribocode/ribocode/tests/main.nf.test | 32 +++++++++++++++++++ .../ribocode/ribocode/tests/main.nf.test.snap | 14 ++++---- 7 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 modules/nf-core/ribocode/metaplots/tests/nextflow_fail.config diff --git a/modules/nf-core/ribocode/metaplots/main.nf b/modules/nf-core/ribocode/metaplots/main.nf index 24fed821fa68..85a4f00f4019 100644 --- a/modules/nf-core/ribocode/metaplots/main.nf +++ b/modules/nf-core/ribocode/metaplots/main.nf @@ -29,12 +29,11 @@ process RIBOCODE_METAPLOTS { -o ${prefix} \\ $args - config_lines=\$(wc -l < ${prefix}_pre_config.txt) - if [ "\$config_lines" -le 1 ]; then - echo "" >&2 - echo "ERROR: metaplots created config file with only header line." >&2 + # Check config file has a sample config line (non-empty, doesn't start with #) + if ! grep -qE '^[^#[:space:]]' ${prefix}_pre_config.txt; then + echo "ERROR: metaplots created config file with no data (only header)." >&2 echo "This usually indicates insufficient periodic signal in Ribo-Seq data." >&2 - echo "Investigate alignment performance or risk lower quality annotations by lowering cutoff with --extra_ribocode_metaplots_args '-f0_percent 0.XX'" >&2 + echo "Consider lowering the cutoff via ext.args (e.g., '-f0_percent 0.5')." >&2 exit 1 fi """ diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test b/modules/nf-core/ribocode/metaplots/tests/main.nf.test index 97d177419485..b95364603521 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test @@ -78,4 +78,28 @@ nextflow_process { ) } } + + test("test_ribocode_metaplots - empty config failure") { + + config "./nextflow_fail.config" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887.Aligned.toTranscriptome.out.bam", checkIfExists: true) + ] + input[1] = UNTAR.out.untar + """ + } + } + + then { + assertAll( + { assert !process.success }, + { assert process.stdout.toString().contains("ERROR: metaplots created config file with no data") } + ) + } + } } diff --git a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap index 24fc7a3ee4ae..e8888fdcf8f2 100644 --- a/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/metaplots/tests/main.nf.test.snap @@ -35,4 +35,4 @@ }, "timestamp": "2025-12-15T14:02:16.699246" } -} +} \ No newline at end of file diff --git a/modules/nf-core/ribocode/metaplots/tests/nextflow_fail.config b/modules/nf-core/ribocode/metaplots/tests/nextflow_fail.config new file mode 100644 index 000000000000..4d74c21adf5b --- /dev/null +++ b/modules/nf-core/ribocode/metaplots/tests/nextflow_fail.config @@ -0,0 +1,5 @@ +process { + withName: RIBOCODE_METAPLOTS { + ext.args = '-f0_percent 1.0 -pv1 0 -pv2 0' + } +} diff --git a/modules/nf-core/ribocode/ribocode/main.nf b/modules/nf-core/ribocode/ribocode/main.nf index dfea7b547175..a80dd1f2d57d 100644 --- a/modules/nf-core/ribocode/ribocode/main.nf +++ b/modules/nf-core/ribocode/ribocode/main.nf @@ -27,19 +27,18 @@ process RIBOCODE_RIBOCODE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ - # Run RiboCode and capture output using tee to both display and save + # Run RiboCode and capture output to check for errors RiboCode \\ -a $annotation \\ -c $config \\ -o ${prefix} \\ $args 2>&1 | tee ribocode_output.log || true - # Check if RiboCode output contains any error messages - if grep -qi "^Error" ribocode_output.log; then - echo "" >&2 + # Check if RiboCode output contains error messages + if grep -qiE "^Error|Error:" ribocode_output.log; then echo "ERROR: RiboCode failed. Check the output above for details." >&2 echo "Common causes:" >&2 - echo " - Invalid config file from metaplots (try adjusting --extra_ribocode_metaplots_args '-f0_percent 0.XX')" >&2 + echo " - Invalid config file from metaplots (try lowering cutoff via ext.args, e.g., '-f0_percent 0.5')" >&2 echo " - Insufficient data from Ribo-Seq alignment" >&2 exit 1 fi diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test index b3adc533e7f0..0f2dba0567a4 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -92,4 +92,36 @@ nextflow_process { ) } } + + test("test_ribocode_ribocode - invalid config failure") { + + config "./nextflow.config" + + when { + process { + """ + // Create a config file with only a header (no data) + def config_file = new File('invalid_config.txt') + config_file.text = "sample_name\\tstrand\\tP-site\\treads\\n" + + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/riboseq_expression/aligned_reads/SRX11780887.Aligned.toTranscriptome.out.bam", checkIfExists: true) + ] + input[1] = UNTAR.out.untar + input[2] = [ + [ id:'config' ], + config_file.toPath() + ] + """ + } + } + + then { + assertAll( + { assert !process.success }, + { assert process.stdout.toString().contains("ERROR: RiboCode failed") } + ) + } + } } diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index a6de4f4beb97..db3259077eff 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -8,8 +8,8 @@ "single_end": false }, [ - "test.txt:md5,3c6c1f3ffff5f9c4f4e59fd4f52c56f4", - "test_collapsed.txt:md5,d1e13bb728ad0b0e79b9326c75c6e47a" + "test.txt:md5,162e0a08ef50c2a283a48717328f3696", + "test_collapsed.txt:md5,96e00573ce485ecc1c85ac5536b52456" ] ] ], @@ -19,15 +19,15 @@ "id": "test", "single_end": false }, - "test_collapsed.txt:md5,d1e13bb728ad0b0e79b9326c75c6e47a" + "test_collapsed.txt:md5,96e00573ce485ecc1c85ac5536b52456" ] ] ], "meta": { - "nf-test": "0.9.2", - "nextflow": "25.10.0" + "nf-test": "0.9.3", + "nextflow": "25.10.2" }, - "timestamp": "2025-12-15T15:07:54.349354" + "timestamp": "2025-12-19T10:23:03.328868" }, "versions": { "content": [ @@ -47,4 +47,4 @@ }, "timestamp": "2025-12-15T14:03:21.494462" } -} +} \ No newline at end of file From 82aa55d4d18eb6e85ab97f830e212092163f0fd9 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Fri, 19 Dec 2025 10:31:51 +0000 Subject: [PATCH 14/15] Fix CI: rename config_file variable to avoid nf-test parser confusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The detect-nf-test-changes action was failing because it parsed lines containing 'config_file' as config directives. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- modules/nf-core/ribocode/ribocode/tests/main.nf.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test b/modules/nf-core/ribocode/ribocode/tests/main.nf.test index 0f2dba0567a4..493a228f0286 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test @@ -100,9 +100,9 @@ nextflow_process { when { process { """ - // Create a config file with only a header (no data) - def config_file = new File('invalid_config.txt') - config_file.text = "sample_name\\tstrand\\tP-site\\treads\\n" + // Create an invalid config with only a header (no data) + def invalid_cfg = new File('invalid_config.txt') + invalid_cfg.text = "sample_name\\tstrand\\tP-site\\treads\\n" input[0] = [ [ id:'test', single_end:false ], @@ -110,8 +110,8 @@ nextflow_process { ] input[1] = UNTAR.out.untar input[2] = [ - [ id:'config' ], - config_file.toPath() + [ id:'test_cfg' ], + invalid_cfg.toPath() ] """ } From e76d0b2a2036b36f96478730267ffd1605908d8e Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Fri, 19 Dec 2025 10:36:19 +0000 Subject: [PATCH 15/15] Fix snapshot to match CI environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../ribocode/ribocode/tests/main.nf.test.snap | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap index db3259077eff..a29fa8fd7114 100644 --- a/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap +++ b/modules/nf-core/ribocode/ribocode/tests/main.nf.test.snap @@ -8,8 +8,8 @@ "single_end": false }, [ - "test.txt:md5,162e0a08ef50c2a283a48717328f3696", - "test_collapsed.txt:md5,96e00573ce485ecc1c85ac5536b52456" + "test.txt:md5,3c6c1f3ffff5f9c4f4e59fd4f52c56f4", + "test_collapsed.txt:md5,d1e13bb728ad0b0e79b9326c75c6e47a" ] ] ], @@ -19,15 +19,15 @@ "id": "test", "single_end": false }, - "test_collapsed.txt:md5,96e00573ce485ecc1c85ac5536b52456" + "test_collapsed.txt:md5,d1e13bb728ad0b0e79b9326c75c6e47a" ] ] ], "meta": { - "nf-test": "0.9.3", - "nextflow": "25.10.2" + "nf-test": "0.9.2", + "nextflow": "25.04.8" }, - "timestamp": "2025-12-19T10:23:03.328868" + "timestamp": "2025-12-15T15:07:54.349354" }, "versions": { "content": [