From 256a7745688abb2a1b76d711ca7562fee52b3cb5 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Sun, 18 Jan 2026 21:08:02 +0000 Subject: [PATCH 01/14] Initial commit that passes pre-commit hooks, trying minimal parameters and starting a list of optional parameters --- modules/nf-core/rmats/prep/environment.yml | 10 ++ modules/nf-core/rmats/prep/main.nf | 103 ++++++++++++++++++ modules/nf-core/rmats/prep/meta.yml | 78 +++++++++++++ .../nf-core/rmats/prep/optional_parameters | 2 + modules/nf-core/rmats/prep/tests/main.nf.test | 74 +++++++++++++ 5 files changed, 267 insertions(+) create mode 100644 modules/nf-core/rmats/prep/environment.yml create mode 100644 modules/nf-core/rmats/prep/main.nf create mode 100644 modules/nf-core/rmats/prep/meta.yml create mode 100644 modules/nf-core/rmats/prep/optional_parameters create mode 100644 modules/nf-core/rmats/prep/tests/main.nf.test diff --git a/modules/nf-core/rmats/prep/environment.yml b/modules/nf-core/rmats/prep/environment.yml new file mode 100644 index 000000000000..664a23f8d6f6 --- /dev/null +++ b/modules/nf-core/rmats/prep/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::rmats=4.3.0" diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf new file mode 100644 index 000000000000..a927f27a6d2c --- /dev/null +++ b/modules/nf-core/rmats/prep/main.nf @@ -0,0 +1,103 @@ +// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/modules/nf-core/ +// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. +// All other parameters MUST be provided using the "task.ext" directive, see here: +// https://www.nextflow.io/docs/latest/process.html#ext +// where "task.ext" is a string. +// Any parameters that need to be evaluated in the context of a particular sample +// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. +// TODO nf-core: Software that can be piped together SHOULD be added to separate module files +// unless there is a run-time, storage advantage in implementing in this way +// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: +// bwa mem | samtools view -B -T ref.fasta +// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty +// list (`[]`) instead of a file can be used to work around this issue. + +process RMATS_PREP { + tag "$meta.id" + label 'process_single' + + // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/rmats:4.3.0--py311hf2f0b74_5': + 'biocontainers/rmats:4.3.0--py311hf2f0b74_5' }" + + input: + // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct + + tuple val(meta), path(genome_bam) + path(reference_gtf) + val rmats_read_len + + output: + // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct + tuple val(meta), path("*.{}"), emit: q-value + tuple val(meta), path("*.{}"), emit: p-value + 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}" + // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 + // If the software is unable to output a version number on the command-line then it can be manually specified + // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf + // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) + // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive + // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter + // using the Nextflow "task" variable e.g. "--threads $task.cpus" + // TODO nf-core: Please replace the example samtools command below with your module's command + // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) + + // --readLength READLENGTH + // The length of each read. Required parameter, with the + // value set according to the RNA-seq read length + // TODO - question. Does this definition mean I should change it by read length? If so, look at a samtools command to figure it out + """ + echo ${genome_bam} > prep.b1.txt + + rmats \\ + --task prep \\ + $args \\ + --nthread $task.cpus \\ + -- b1 prep.b1.txt \\ + --gtf ${reference_gtf} \\ + --readLength ${rmats_read_len} \\ + --tmp ${prefix}_rmats_tmp \\ + --od ${prefix}_rmats_prep + + + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + rmats: \$(rmats --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: A stub section should mimic the execution of the original module as best as possible + // Have a look at the following examples: + // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 + // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 + // TODO nf-core: If the module doesn't use arguments ($args), you SHOULD remove: + // - The definition of args `def args = task.ext.args ?: ''` above. + // - The use of the variable in the script `echo $args ` below. + """ + echo $args + + touch ${prefix}.sam + touch ${prefix}.fastq + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + rmats: \$(rmats --version) + END_VERSIONS + """ +} diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml new file mode 100644 index 000000000000..802f10a49b10 --- /dev/null +++ b/modules/nf-core/rmats/prep/meta.yml @@ -0,0 +1,78 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +# # TODO nf-core: Add a description of the module and list keywords +name: "rmats_prep" +description: MATS is a computational tool to detect differential alternative splicing events from RNA-Seq data. +keywords: + - splicing + - RNA-Seq + - alternative splicing + - exon + - intron + - rMATS +tools: + ## TODO nf-core: Add a description and other details for the software below + - "rmats": + description: "MATS is a computational tool to detect differential alternative + splicing events from RNA-Seq data." + homepage: "https://github.com/Xinglab/rmats-turbo" + documentation: "https://github.com/Xinglab/rmats-turbo/blob/v4.3.0/README.md" + doi: "10.1038/s41596-023-00944-2" + licence: ["FreeBSD for non-commercial use, see LICENSE file"] + identifier: biotools:rmats + +input: + # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct + - - meta: + type: map + description: Groovy Map containing sample information. e.g. `[ id:'sample1' + ]` + - genome_bam: + type: file + description: BAM file aligned to the genome + pattern: "*.{bam}" + ontologies: + - edam: http://edamontology.org/format_2572 # BAM + - reference_gtf: + type: file + description: Annotation GTF file + pattern: "*.{gtf}" + ontologies: + - edam: http://edamontology.org/format_2306 # GTF + - rmats_read_len: + type: integer + description: Read length in bases +output: + # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct + q-value: + - - meta: + type: map + description: Groovy Map containing sample information. e.g. `[ id:'sample1' + ]` + - "*.{}": + type: file + description: q-value file + pattern: "*.{}" + ontologies: + - edam: http://edamontology.org/data_3932 # Q-value + p-value: + - - meta: + type: map + description: Groovy Map containing sample information. e.g. `[ id:'sample1' + ]` + - "*.{}": + type: file + description: p-value file + pattern: "*.{}" + ontologies: + - edam: http://edamontology.org/data_1669 # P-value + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: versions.yml + ontologies: + - edam: http://edamontology.org/format_3750 # YAML +authors: + - "@akaviaLab" +maintainers: + - "@akaviaLab" diff --git a/modules/nf-core/rmats/prep/optional_parameters b/modules/nf-core/rmats/prep/optional_parameters new file mode 100644 index 000000000000..ec57fb0638ad --- /dev/null +++ b/modules/nf-core/rmats/prep/optional_parameters @@ -0,0 +1,2 @@ +--variable-read-length +--allow-clipping diff --git a/modules/nf-core/rmats/prep/tests/main.nf.test b/modules/nf-core/rmats/prep/tests/main.nf.test new file mode 100644 index 000000000000..ac929ae5691f --- /dev/null +++ b/modules/nf-core/rmats/prep/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test rmats/prep +nextflow_process { + + name "Test Process RMATS_PREP" + script "../main.nf" + process "RMATS_PREP" + + tag "modules" + tag "modules_nfcore" + tag "rmats" + tag "rmats/prep" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} From 660c9deaf41d318a03930b17b1829eb69c86d8a7 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Tue, 3 Feb 2026 14:14:46 +0000 Subject: [PATCH 02/14] Initial version of rmats prep task correctly using args --- modules/nf-core/rmats/prep/main.nf | 57 +++++++++++------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index a927f27a6d2c..ad16d29062c3 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -1,42 +1,24 @@ -// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) -// https://github.com/nf-core/modules/tree/master/modules/nf-core/ -// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: -// https://nf-co.re/join -// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. -// All other parameters MUST be provided using the "task.ext" directive, see here: -// https://www.nextflow.io/docs/latest/process.html#ext -// where "task.ext" is a string. -// Any parameters that need to be evaluated in the context of a particular sample -// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. -// TODO nf-core: Software that can be piped together SHOULD be added to separate module files -// unless there is a run-time, storage advantage in implementing in this way -// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: -// bwa mem | samtools view -B -T ref.fasta -// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty -// list (`[]`) instead of a file can be used to work around this issue. - process RMATS_PREP { - tag "$meta.id" + tag "${meta.id}" label 'process_single' // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/rmats:4.3.0--py311hf2f0b74_5': - 'biocontainers/rmats:4.3.0--py311hf2f0b74_5' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/rmats:4.3.0--py311hf2f0b74_5' + : 'biocontainers/rmats:4.3.0--py311hf2f0b74_5'}" input: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path(genome_bam) - path(reference_gtf) + path reference_gtf val rmats_read_len output: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - tuple val(meta), path("*.{}"), emit: q-value - tuple val(meta), path("*.{}"), emit: p-value - path "versions.yml" , emit: versions + tuple val(meta), path("${prefix}_prep*.rmats"), emit: prep_rmats_files + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when @@ -57,25 +39,29 @@ process RMATS_PREP { // --readLength READLENGTH // The length of each read. Required parameter, with the // value set according to the RNA-seq read length - // TODO - question. Does this definition mean I should change it by read length? If so, look at a samtools command to figure it out + // TODO - question. Does this definition mean I should change it by read length? If so, look at a samtools command to figure it out. Samtools stats! + // TODO - should I modify the prefix to include rmats_prep only in a subworkflow via modules.config? It seems so, see example at https://github.com/nf-core/rnaseq/blob/e049f51f0214b2aef7624b9dd496a404a7c34d14/conf/modules.config#L576 """ - echo ${genome_bam} > prep.b1.txt + echo ${genome_bam} > ${prefix}.prep.b1.txt rmats \\ --task prep \\ - $args \\ - --nthread $task.cpus \\ - -- b1 prep.b1.txt \\ + ${args} \\ + --nthread ${task.cpus} \\ + -- b1 ${prefix}.prep.b1.txt \\ --gtf ${reference_gtf} \\ --readLength ${rmats_read_len} \\ --tmp ${prefix}_rmats_tmp \\ --od ${prefix}_rmats_prep - + for file in `ls ${prefix_rmats}_tmp/*.rmats` + do + cp ${prefix_rmats}_tmp/${file} ${prefix_}prep_${file} + done cat <<-END_VERSIONS > versions.yml "${task.process}": - rmats: \$(rmats --version) + rmats: \$(rmats.py --version) END_VERSIONS """ @@ -90,14 +76,13 @@ process RMATS_PREP { // - The definition of args `def args = task.ext.args ?: ''` above. // - The use of the variable in the script `echo $args ` below. """ - echo $args + echo ${args} - touch ${prefix}.sam - touch ${prefix}.fastq + touch ${prefix}.rmats cat <<-END_VERSIONS > versions.yml "${task.process}": - rmats: \$(rmats --version) + rmats: \$(echo \$(rmats.py --version) | sed -e "s/v//g") END_VERSIONS """ } From 781cffaff8506df24c05681ba8cc042dd2301ff0 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Tue, 3 Feb 2026 14:32:41 +0000 Subject: [PATCH 03/14] fixed some minor problems --- modules/nf-core/rmats/prep/main.nf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index ad16d29062c3..ccacd420d5c0 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -54,14 +54,14 @@ process RMATS_PREP { --tmp ${prefix}_rmats_tmp \\ --od ${prefix}_rmats_prep - for file in `ls ${prefix_rmats}_tmp/*.rmats` + for file in `ls ${prefix}_rmats_tmp/*.rmats` do - cp ${prefix_rmats}_tmp/${file} ${prefix_}prep_${file} + cp ${prefix}_rmats_tmp/\${file} ${prefix}_prep_\${file} done cat <<-END_VERSIONS > versions.yml "${task.process}": - rmats: \$(rmats.py --version) + rmats: \$(echo \$(rmats.py --version) | sed -e "s/v//g") END_VERSIONS """ From 017cb04ad906b963e288284dd75af0661dc0a57a Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Wed, 11 Feb 2026 09:55:46 +0000 Subject: [PATCH 04/14] updated meta.yml for rmats prep task --- modules/nf-core/rmats/prep/main.nf | 7 ++++++- modules/nf-core/rmats/prep/meta.yml | 26 ++++++-------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index ccacd420d5c0..56a1faa6e75b 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -12,12 +12,15 @@ process RMATS_PREP { // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path(genome_bam) + // TODO - post seems to need only the BAM *names*, not the actual files. Could we just get the first line of each file to get the names? + // for file in `ls multi_bam_rmats_prep_tmp/*.rmats`; do head -1 $file; done | tr '\n' ',' + // TODO - for stats, it should be possible to parse the formula using patsy, but if we include PAIRADISE we might have R - just do this in R, first pass path reference_gtf val rmats_read_len output: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - tuple val(meta), path("${prefix}_prep*.rmats"), emit: prep_rmats_files + tuple val(meta), path("*.rmats"), emit: prep_rmats_file path "versions.yml", emit: versions when: @@ -65,6 +68,8 @@ process RMATS_PREP { END_VERSIONS """ + // NOTES for post - post requires the rmats files to be in the tmp directory, otherwise it fails + stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index 802f10a49b10..2579634466bb 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -24,8 +24,7 @@ input: # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - - meta: type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1' - ]` + description: Groovy Map containing sample information. e.g. `[ id:'sample1', single_end:false, strandness:'auto']` - genome_bam: type: file description: BAM file aligned to the genome @@ -43,28 +42,15 @@ input: description: Read length in bases output: # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - q-value: + prep_rmats_file: - - meta: type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1' - ]` + description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` - "*.{}": type: file - description: q-value file - pattern: "*.{}" - ontologies: - - edam: http://edamontology.org/data_3932 # Q-value - p-value: - - - meta: - type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1' - ]` - - "*.{}": - type: file - description: p-value file - pattern: "*.{}" - ontologies: - - edam: http://edamontology.org/data_1669 # P-value + description: text file containing rmats processed splice junctions + pattern: "*.rmats" + ontologies: [] versions: - versions.yml: type: file From e970c2678fd2a5fc17ed6f4a8444cef72a2cc42c Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Wed, 11 Feb 2026 11:16:30 +0000 Subject: [PATCH 05/14] Added read outcome file to output --- modules/nf-core/rmats/prep/main.nf | 10 ++++++---- modules/nf-core/rmats/prep/meta.yml | 9 +++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 56a1faa6e75b..5d756c4b6f5f 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -21,6 +21,7 @@ process RMATS_PREP { output: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path("*.rmats"), emit: prep_rmats_file + tuple val(meta), path("*.txt"), emit: prep_read_outcomes_file path "versions.yml", emit: versions when: @@ -47,19 +48,19 @@ process RMATS_PREP { """ echo ${genome_bam} > ${prefix}.prep.b1.txt - rmats \\ + rmats.py \\ --task prep \\ ${args} \\ --nthread ${task.cpus} \\ - -- b1 ${prefix}.prep.b1.txt \\ + --b1 ${prefix}.prep.b1.txt \\ --gtf ${reference_gtf} \\ --readLength ${rmats_read_len} \\ --tmp ${prefix}_rmats_tmp \\ --od ${prefix}_rmats_prep - for file in `ls ${prefix}_rmats_tmp/*.rmats` + for file in `ls ${prefix}_rmats_tmp/*` do - cp ${prefix}_rmats_tmp/\${file} ${prefix}_prep_\${file} + cp \${file} ${prefix}_prep_\$(basename \${file}) done cat <<-END_VERSIONS > versions.yml @@ -84,6 +85,7 @@ process RMATS_PREP { echo ${args} touch ${prefix}.rmats + touch ${prefix}.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index 2579634466bb..a7c848de9db8 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -51,6 +51,15 @@ output: description: text file containing rmats processed splice junctions pattern: "*.rmats" ontologies: [] + prep_read_outcomes_file: + - - meta: + type: map + description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` + - "*.{}": + type: file + description: text file containing the numbers of reads for each outcome (USED, NOT_PAIRED, etc.) + pattern: "*.txt" + ontologies: [] versions: - versions.yml: type: file From 75308891515950a40b544a804fda0b1b3d63dea1 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Sun, 22 Feb 2026 15:07:17 +0000 Subject: [PATCH 06/14] Added test config with args, and removed some TODOs --- modules/nf-core/rmats/prep/environment.yml | 3 --- modules/nf-core/rmats/prep/main.nf | 12 ++---------- modules/nf-core/rmats/prep/tests/nextflow.config | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 modules/nf-core/rmats/prep/tests/nextflow.config diff --git a/modules/nf-core/rmats/prep/environment.yml b/modules/nf-core/rmats/prep/environment.yml index 664a23f8d6f6..35217f7adac4 100644 --- a/modules/nf-core/rmats/prep/environment.yml +++ b/modules/nf-core/rmats/prep/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::rmats=4.3.0" diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 5d756c4b6f5f..73badad6fa71 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -21,7 +21,7 @@ process RMATS_PREP { output: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path("*.rmats"), emit: prep_rmats_file - tuple val(meta), path("*.txt"), emit: prep_read_outcomes_file + tuple val(meta), path("*outcomes_by_bam.txt"), emit: prep_read_outcomes_file path "versions.yml", emit: versions when: @@ -34,11 +34,6 @@ process RMATS_PREP { // If the software is unable to output a version number on the command-line then it can be manually specified // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive - // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter - // using the Nextflow "task" variable e.g. "--threads $task.cpus" - // TODO nf-core: Please replace the example samtools command below with your module's command - // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) // --readLength READLENGTH // The length of each read. Required parameter, with the @@ -78,14 +73,11 @@ process RMATS_PREP { // Have a look at the following examples: // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 - // TODO nf-core: If the module doesn't use arguments ($args), you SHOULD remove: - // - The definition of args `def args = task.ext.args ?: ''` above. - // - The use of the variable in the script `echo $args ` below. """ echo ${args} touch ${prefix}.rmats - touch ${prefix}.txt + touch ${prefix}_outcomes_by_bam.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/rmats/prep/tests/nextflow.config b/modules/nf-core/rmats/prep/tests/nextflow.config new file mode 100644 index 000000000000..ad690e8dedd8 --- /dev/null +++ b/modules/nf-core/rmats/prep/tests/nextflow.config @@ -0,0 +1,15 @@ +process { + + withName: RMATS_PREP { + ext.args = {[ + "--variable-read-length --allow-clipping", + meta.single_end ? '-t single' : '', + meta.strandness == "forward" ? "--libType fr-firststrand" : '', + meta.strandness == "reverse" ? "--libType fr-secondstrand" : '', + params.novel_splice_site ? "--novelSS" : "", + (params.novel_splice_site && params.minimum_intron_length) ? "--mil ${params.minimum_intron_length}" : "", + (params.novel_splice_site && params.max_exon_length) ? "--mel ${params.max_exon_length}" : "", + ].join(' ').trim()} + } + +} From 98f07ac3412925d12becaf004769a872bf3861e8 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Mon, 23 Feb 2026 09:51:54 +0000 Subject: [PATCH 07/14] Trying to use topics --- modules/nf-core/rmats/prep/main.nf | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 73badad6fa71..98bb1f66175a 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -22,7 +22,7 @@ process RMATS_PREP { // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path("*.rmats"), emit: prep_rmats_file tuple val(meta), path("*outcomes_by_bam.txt"), emit: prep_read_outcomes_file - path "versions.yml", emit: versions + tuple val("${task.process}"), val('rmats'), eval('rmats.py --version | sed -e "s/v//g"'), emit: versions_rmats, topic: versions when: task.ext.when == null || task.ext.when @@ -57,11 +57,6 @@ process RMATS_PREP { do cp \${file} ${prefix}_prep_\$(basename \${file}) done - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - rmats: \$(echo \$(rmats.py --version) | sed -e "s/v//g") - END_VERSIONS """ // NOTES for post - post requires the rmats files to be in the tmp directory, otherwise it fails @@ -69,19 +64,10 @@ process RMATS_PREP { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: A stub section should mimic the execution of the original module as best as possible - // Have a look at the following examples: - // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 - // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 """ echo ${args} touch ${prefix}.rmats touch ${prefix}_outcomes_by_bam.txt - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - rmats: \$(echo \$(rmats.py --version) | sed -e "s/v//g") - END_VERSIONS """ } From eae57c306af4212d1a151e5c15c0466f18d68c47 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 25 Feb 2026 14:34:56 +0100 Subject: [PATCH 08/14] fix version section of meta.yml --- modules/nf-core/rmats/prep/meta.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index a7c848de9db8..0367339381cb 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -60,13 +60,28 @@ output: description: text file containing the numbers of reads for each outcome (USED, NOT_PAIRED, etc.) pattern: "*.txt" ontologies: [] + - edam: http://edamontology.org/format_2330 + versions_rmats: + - - ${task.process}: + type: string + description: The name of the process + - rmats: + type: string + description: The name of the tool + - rmats.py --version | sed -e "s/v//g": + 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 - ontologies: - - edam: http://edamontology.org/format_3750 # YAML + - - ${task.process}: + type: string + description: The name of the process + - rmats: + type: string + description: The name of the tool + - rmats.py --version | sed -e "s/v//g": + type: eval + description: The expression to obtain the version of the tool authors: - "@akaviaLab" maintainers: From bea0518e396e8681ad6c3f7c47ed20cf09487394 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 25 Feb 2026 15:03:46 +0100 Subject: [PATCH 09/14] fix patterns --- modules/nf-core/rmats/prep/meta.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index 0367339381cb..caf656f3b58a 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -46,7 +46,7 @@ output: - - meta: type: map description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` - - "*.{}": + - "*.rmats": type: file description: text file containing rmats processed splice junctions pattern: "*.rmats" @@ -55,11 +55,11 @@ output: - - meta: type: map description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` - - "*.{}": + - "*outcomes_by_bam.txt": type: file description: text file containing the numbers of reads for each outcome (USED, NOT_PAIRED, etc.) - pattern: "*.txt" - ontologies: [] + pattern: "*outcomes_by_bam.txt" + ontologies: - edam: http://edamontology.org/format_2330 versions_rmats: - - ${task.process}: From 6b9964eef644e21ec8f49bd4846f8e157a473916 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Wed, 25 Feb 2026 14:11:53 +0000 Subject: [PATCH 10/14] meta.yml that works with topics --- modules/nf-core/rmats/prep/meta.yml | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index caf656f3b58a..4a40f3e27a4f 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -1,7 +1,6 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json -# # TODO nf-core: Add a description of the module and list keywords name: "rmats_prep" -description: MATS is a computational tool to detect differential alternative splicing events from RNA-Seq data. +description: MATS is a computational tool to detect differential alternative + splicing events from RNA-Seq data. keywords: - splicing - RNA-Seq @@ -10,78 +9,80 @@ keywords: - intron - rMATS tools: - ## TODO nf-core: Add a description and other details for the software below - "rmats": description: "MATS is a computational tool to detect differential alternative splicing events from RNA-Seq data." homepage: "https://github.com/Xinglab/rmats-turbo" documentation: "https://github.com/Xinglab/rmats-turbo/blob/v4.3.0/README.md" doi: "10.1038/s41596-023-00944-2" - licence: ["FreeBSD for non-commercial use, see LICENSE file"] + licence: + - "FreeBSD for non-commercial use, see LICENSE file" identifier: biotools:rmats - input: - # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - - meta: type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1', single_end:false, strandness:'auto']` + description: Groovy Map containing sample information. e.g. `[ + id:'sample1', single_end:false, strandness:'auto']` - genome_bam: type: file description: BAM file aligned to the genome pattern: "*.{bam}" ontologies: - - edam: http://edamontology.org/format_2572 # BAM + - edam: http://edamontology.org/format_2572 - reference_gtf: type: file description: Annotation GTF file pattern: "*.{gtf}" ontologies: - - edam: http://edamontology.org/format_2306 # GTF + - edam: http://edamontology.org/format_2306 - rmats_read_len: type: integer description: Read length in bases output: - # TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct prep_rmats_file: - - meta: type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` + description: Groovy Map containing sample information. e.g. `[ + id:'sample1'single_end:false, strandness:'auto']` - "*.rmats": type: file - description: text file containing rmats processed splice junctions + description: rmats junction count information, after processing the BAM + file pattern: "*.rmats" ontologies: [] prep_read_outcomes_file: - - meta: type: map - description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` + description: Groovy Map containing sample information. e.g. `[ + id:'sample1'single_end:false, strandness:'auto']` - "*outcomes_by_bam.txt": type: file - description: text file containing the numbers of reads for each outcome (USED, NOT_PAIRED, etc.) + description: text file detailing number of reads used and not used for + various reasons (clipped, not paired, wrong length, etc.) pattern: "*outcomes_by_bam.txt" ontologies: - edam: http://edamontology.org/format_2330 versions_rmats: - - ${task.process}: type: string - description: The name of the process + description: The process the versions were collected from - rmats: type: string - description: The name of the tool + description: The tool name - rmats.py --version | sed -e "s/v//g": type: eval - description: The expression to obtain the version of the tool + description: The command used to generate the version of the tool topics: versions: - - ${task.process}: type: string - description: The name of the process + description: The process the versions were collected from - rmats: type: string - description: The name of the tool + description: The tool name - rmats.py --version | sed -e "s/v//g": type: eval - description: The expression to obtain the version of the tool + description: The command used to generate the version of the tool authors: - "@akaviaLab" maintainers: From 4f8cd9359ca3ffb0c8f620defacdee520f644bf7 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Wed, 25 Feb 2026 14:13:33 +0000 Subject: [PATCH 11/14] Deleted unnecessary file --- modules/nf-core/rmats/prep/optional_parameters | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 modules/nf-core/rmats/prep/optional_parameters diff --git a/modules/nf-core/rmats/prep/optional_parameters b/modules/nf-core/rmats/prep/optional_parameters deleted file mode 100644 index ec57fb0638ad..000000000000 --- a/modules/nf-core/rmats/prep/optional_parameters +++ /dev/null @@ -1,2 +0,0 @@ ---variable-read-length ---allow-clipping From 3e28311254a0099c70e63b384ca0f4ecd1292563 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Sun, 8 Mar 2026 12:48:01 +0000 Subject: [PATCH 12/14] rmats prep test works as exepcted for rnasplice files --- modules/nf-core/rmats/prep/main.nf | 16 +-- modules/nf-core/rmats/prep/meta.yml | 4 +- modules/nf-core/rmats/prep/tests/main.nf.test | 29 ++-- .../rmats/prep/tests/main.nf.test.snap | 132 ++++++++++++++++++ 4 files changed, 159 insertions(+), 22 deletions(-) create mode 100644 modules/nf-core/rmats/prep/tests/main.nf.test.snap diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 98bb1f66175a..39043b6a8d63 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -21,7 +21,7 @@ process RMATS_PREP { output: // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path("*.rmats"), emit: prep_rmats_file - tuple val(meta), path("*outcomes_by_bam.txt"), emit: prep_read_outcomes_file + tuple val(meta), path("*read_outcomes_by_bam.txt"), emit: prep_read_outcomes_file tuple val("${task.process}"), val('rmats'), eval('rmats.py --version | sed -e "s/v//g"'), emit: versions_rmats, topic: versions when: @@ -35,11 +35,11 @@ process RMATS_PREP { // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // --readLength READLENGTH + // NOTES --readLength READLENGTH // The length of each read. Required parameter, with the // value set according to the RNA-seq read length - // TODO - question. Does this definition mean I should change it by read length? If so, look at a samtools command to figure it out. Samtools stats! - // TODO - should I modify the prefix to include rmats_prep only in a subworkflow via modules.config? It seems so, see example at https://github.com/nf-core/rnaseq/blob/e049f51f0214b2aef7624b9dd496a404a7c34d14/conf/modules.config#L576 + // I should change it by read length (in workflow)! Look at Samtools stats! + // NOTES - Following example at https://github.com/nf-core/rnaseq/blob/e049f51f0214b2aef7624b9dd496a404a7c34d14/conf/modules.config#L576, the files are saved as prefix only. When using this in a workflow, I will modify the prefix to include prep/post/etc. """ echo ${genome_bam} > ${prefix}.prep.b1.txt @@ -53,10 +53,8 @@ process RMATS_PREP { --tmp ${prefix}_rmats_tmp \\ --od ${prefix}_rmats_prep - for file in `ls ${prefix}_rmats_tmp/*` - do - cp \${file} ${prefix}_prep_\$(basename \${file}) - done + cp ${prefix}_rmats_tmp/*.txt ${prefix}_read_outcomes_by_bam.txt + cp ${prefix}_rmats_tmp/*.rmats ${prefix}.rmats """ // NOTES for post - post requires the rmats files to be in the tmp directory, otherwise it fails @@ -68,6 +66,6 @@ process RMATS_PREP { echo ${args} touch ${prefix}.rmats - touch ${prefix}_outcomes_by_bam.txt + touch ${prefix}_read_outcomes_by_bam.txt """ } diff --git a/modules/nf-core/rmats/prep/meta.yml b/modules/nf-core/rmats/prep/meta.yml index 4a40f3e27a4f..7e2b0ef19763 100644 --- a/modules/nf-core/rmats/prep/meta.yml +++ b/modules/nf-core/rmats/prep/meta.yml @@ -55,11 +55,11 @@ output: type: map description: Groovy Map containing sample information. e.g. `[ id:'sample1'single_end:false, strandness:'auto']` - - "*outcomes_by_bam.txt": + - "*read_outcomes_by_bam.txt": type: file description: text file detailing number of reads used and not used for various reasons (clipped, not paired, wrong length, etc.) - pattern: "*outcomes_by_bam.txt" + pattern: "*read_outcomes_by_bam.txt" ontologies: - edam: http://edamontology.org/format_2330 versions_rmats: diff --git a/modules/nf-core/rmats/prep/tests/main.nf.test b/modules/nf-core/rmats/prep/tests/main.nf.test index ac929ae5691f..d2fb6c2137ad 100644 --- a/modules/nf-core/rmats/prep/tests/main.nf.test +++ b/modules/nf-core/rmats/prep/tests/main.nf.test @@ -5,6 +5,7 @@ nextflow_process { name "Test Process RMATS_PREP" script "../main.nf" process "RMATS_PREP" + config "./nextflow.config" tag "modules" tag "modules_nfcore" @@ -12,39 +13,43 @@ nextflow_process { tag "rmats/prep" // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("ERR204916 - rmats prep") { // TODO nf-core: If you are created a test for a chained module // (the module requires running more than one process to generate the required output) // add the 'setup' method here. // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + // rmats.py --b1 ERR204916.prep.b1.txt --gtf reference/genes_chrX.gtf --od ERR204916_rmats_prep --tmp ERR204916_rmats_tmp --readLength 150 --variable-read-length --allow-clipping --task prep + // rmats.py --b1 multi.bam.b1.txt --gtf reference/genes_chrX.gtf --od multi_bam_rmats_prep --tmp multi_bam_rmats_prep_tmp --readLength 150 --variable-read-length --allow-clipping --task prep + when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [ id:'test', single_end:false, strandness:"unstranded" ], // meta map + file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/testdata/ERR204916.Aligned.out.bam', checkIfExists: true), ] + input[1] = [file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/reference/genes_chrX.gtf', checkIfExists: true)] + input[2] = 150 """ } } then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ assertAll( { assert process.success }, - { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 } ) } } // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("rmats - prep - stub") { options "-stub" @@ -54,9 +59,11 @@ nextflow_process { // TODO nf-core: define inputs of the process here. Example: input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [ id:'test', single_end:false, strandness:"unstranded" ], // meta map + file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/testdata/ERR204916.Aligned.out.bam', checkIfExists: true), ] + input[1] = [file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/reference/genes_chrX.gtf', checkIfExists: true)] + input[2] = 150 """ } } diff --git a/modules/nf-core/rmats/prep/tests/main.nf.test.snap b/modules/nf-core/rmats/prep/tests/main.nf.test.snap new file mode 100644 index 000000000000..2ea804613f2c --- /dev/null +++ b/modules/nf-core/rmats/prep/tests/main.nf.test.snap @@ -0,0 +1,132 @@ +{ + "ERR204916 - rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,87fceb3201cee7db67f5626183336ed4" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,fbf451f8868ef69aa55c4d997f0c260a" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,fbf451f8868ef69aa55c4d997f0c260a" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,87fceb3201cee7db67f5626183336ed4" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T12:44:58.365348942" + }, + "rmats - prep - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T12:45:16.02305081" + } +} \ No newline at end of file From a992913a02f5e2e89e64cacbc82787208d4dc977 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Sun, 8 Mar 2026 17:16:20 +0000 Subject: [PATCH 13/14] Added tests for all parameters of rmats --- modules/nf-core/rmats/prep/main.nf | 8 - modules/nf-core/rmats/prep/tests/main.nf.test | 172 ++++++++- .../rmats/prep/tests/main.nf.test.snap | 341 +++++++++++++++++- 3 files changed, 485 insertions(+), 36 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 39043b6a8d63..0991a65ad0a1 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -9,8 +9,6 @@ process RMATS_PREP { : 'biocontainers/rmats:4.3.0--py311hf2f0b74_5'}" input: - // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct - tuple val(meta), path(genome_bam) // TODO - post seems to need only the BAM *names*, not the actual files. Could we just get the first line of each file to get the names? // for file in `ls multi_bam_rmats_prep_tmp/*.rmats`; do head -1 $file; done | tr '\n' ',' @@ -19,7 +17,6 @@ process RMATS_PREP { val rmats_read_len output: - // TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct tuple val(meta), path("*.rmats"), emit: prep_rmats_file tuple val(meta), path("*read_outcomes_by_bam.txt"), emit: prep_read_outcomes_file tuple val("${task.process}"), val('rmats'), eval('rmats.py --version | sed -e "s/v//g"'), emit: versions_rmats, topic: versions @@ -30,11 +27,6 @@ process RMATS_PREP { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 - // If the software is unable to output a version number on the command-line then it can be manually specified - // e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf - // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // NOTES --readLength READLENGTH // The length of each read. Required parameter, with the // value set according to the RNA-seq read length diff --git a/modules/nf-core/rmats/prep/tests/main.nf.test b/modules/nf-core/rmats/prep/tests/main.nf.test index d2fb6c2137ad..6bac62e0fff8 100644 --- a/modules/nf-core/rmats/prep/tests/main.nf.test +++ b/modules/nf-core/rmats/prep/tests/main.nf.test @@ -1,39 +1,145 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test rmats/prep nextflow_process { name "Test Process RMATS_PREP" script "../main.nf" process "RMATS_PREP" - config "./nextflow.config" tag "modules" tag "modules_nfcore" tag "rmats" tag "rmats/prep" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("ERR204916 - rmats prep") { + test("homo_sapiens - paired unstranded rmats prep") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + config "./nextflow.config" - // rmats.py --b1 ERR204916.prep.b1.txt --gtf reference/genes_chrX.gtf --od ERR204916_rmats_prep --tmp ERR204916_rmats_tmp --readLength 150 --variable-read-length --allow-clipping --task prep - // rmats.py --b1 multi.bam.b1.txt --gtf reference/genes_chrX.gtf --od multi_bam_rmats_prep --tmp multi_bam_rmats_prep_tmp --readLength 150 --variable-read-length --allow-clipping --task prep + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false, strandness:"unstranded" ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), + ] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] + input[2] = 150 + """ + } + } + + then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ + def reads_clipped = lines[9] =~ /CLIPPED: (\d+)/ + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 }, + { assert reads_clipped[0][1] as Integer == 0 } + ) + } + + } + + test("homo_sapiens - single-end unstranded rmats prep") { + + config "./nextflow.config" + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true, strandness:"unstranded" ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), + ] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] + input[2] = 150 + """ + } + } + + then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 } + ) + } + + } + + test("homo_sapiens - paired forward rmats prep") { + + config "./nextflow.config" + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false, strandness:"forward" ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), + ] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] + input[2] = 150 + """ + } + } + + then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 } ) + } + + } + test("homo_sapiens - paired reverse rmats prep") { + + config "./nextflow.config" + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false, strandness:"reverse" ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), + ] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] + input[2] = 150 + """ + } + } + + then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 } + ) + } + + } + + test("homo_sapiens - paired unstranded novel splice rmats prep") { + + config "./nextflow.config" when { process { """ input[0] = [ [ id:'test', single_end:false, strandness:"unstranded" ], // meta map - file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/testdata/ERR204916.Aligned.out.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), ] - input[1] = [file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/reference/genes_chrX.gtf', checkIfExists: true)] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] input[2] = 150 """ } + params { + novel_splice_site = true + } } then { @@ -48,21 +154,48 @@ nextflow_process { } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("rmats - prep - stub") { + test("homo_sapiens - paired unstranded no clipping rmats prep") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false, strandness:"unstranded" ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), + ] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] + input[2] = 150 + """ + } + } + + then { + def lines = path(process.out.prep_read_outcomes_file[0][1]).readLines() + def reads_used = lines[1] =~ /USED: (\d+)/ + def reads_clipped = lines[9] =~ /CLIPPED: (\d+)/ + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert reads_used[0][1] as Integer > 0 }, + { assert reads_clipped[0][1] as Integer > 0}, + { assert reads_clipped[0][1] as Integer > reads_used[0][1] as Integer } + ) + } + + } + + test("homo_sapiens - prep - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false, strandness:"unstranded" ], // meta map - file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/testdata/ERR204916.Aligned.out.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.rna.paired_end.bam', checkIfExists: true), ] - input[1] = [file('https://github.com/nf-core/test-datasets/raw/refs/heads/rnasplice/reference/genes_chrX.gtf', checkIfExists: true)] + input[1] = [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)] input[2] = 150 """ } @@ -72,7 +205,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/rmats/prep/tests/main.nf.test.snap b/modules/nf-core/rmats/prep/tests/main.nf.test.snap index 2ea804613f2c..21720318bce1 100644 --- a/modules/nf-core/rmats/prep/tests/main.nf.test.snap +++ b/modules/nf-core/rmats/prep/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "ERR204916 - rmats prep": { + "homo_sapiens - paired unstranded rmats prep": { "content": [ { "0": [ @@ -9,7 +9,7 @@ "single_end": false, "strandness": "unstranded" }, - "test.rmats:md5,87fceb3201cee7db67f5626183336ed4" + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" ] ], "1": [ @@ -19,7 +19,7 @@ "single_end": false, "strandness": "unstranded" }, - "test_read_outcomes_by_bam.txt:md5,fbf451f8868ef69aa55c4d997f0c260a" + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" ] ], "2": [ @@ -36,7 +36,7 @@ "single_end": false, "strandness": "unstranded" }, - "test_read_outcomes_by_bam.txt:md5,fbf451f8868ef69aa55c4d997f0c260a" + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" ] ], "prep_rmats_file": [ @@ -46,7 +46,7 @@ "single_end": false, "strandness": "unstranded" }, - "test.rmats:md5,87fceb3201cee7db67f5626183336ed4" + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" ] ], "versions_rmats": [ @@ -62,9 +62,9 @@ "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2026-03-08T12:44:58.365348942" + "timestamp": "2026-03-08T16:36:44.652051572" }, - "rmats - prep - stub": { + "homo_sapiens - prep - stub": { "content": [ { "0": [ @@ -127,6 +127,331 @@ "nf-test": "0.9.2", "nextflow": "25.04.6" }, - "timestamp": "2026-03-08T12:45:16.02305081" + "timestamp": "2026-03-08T17:09:17.138581399" + }, + "homo_sapiens - paired unstranded novel splice rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T16:37:40.473133613" + }, + "homo_sapiens - single-end unstranded rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true, + "strandness": "unstranded" + }, + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": true, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,18975bd7f2e4a3ef9186fc4f1ebca5f2" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": true, + "strandness": "unstranded" + }, + "test.rmats:md5,3b847b81badea6cbf623d6072609a743" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T16:36:58.294272819" + }, + "homo_sapiens - paired unstranded no clipping rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,3800cad59b9d91d1da63d40dce08173f" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,fb7d9dab371bb7097b9f2358e61170e0" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test_read_outcomes_by_bam.txt:md5,fb7d9dab371bb7097b9f2358e61170e0" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "unstranded" + }, + "test.rmats:md5,3800cad59b9d91d1da63d40dce08173f" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T16:42:18.961913969" + }, + "homo_sapiens - paired forward rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "forward" + }, + "test.rmats:md5,042a54dec896ab6b00ddd13dd49218f5" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "forward" + }, + "test_read_outcomes_by_bam.txt:md5,96bfd827a39f14566acde8adc1249145" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "forward" + }, + "test_read_outcomes_by_bam.txt:md5,96bfd827a39f14566acde8adc1249145" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "forward" + }, + "test.rmats:md5,042a54dec896ab6b00ddd13dd49218f5" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T16:37:10.622140831" + }, + "homo_sapiens - paired reverse rmats prep": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "reverse" + }, + "test.rmats:md5,a879b17464d0f1d6025c10db1148f881" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "reverse" + }, + "test_read_outcomes_by_bam.txt:md5,ebd1a7e14896503c2dce3d6ed6b866d3" + ] + ], + "2": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ], + "prep_read_outcomes_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "reverse" + }, + "test_read_outcomes_by_bam.txt:md5,ebd1a7e14896503c2dce3d6ed6b866d3" + ] + ], + "prep_rmats_file": [ + [ + { + "id": "test", + "single_end": false, + "strandness": "reverse" + }, + "test.rmats:md5,a879b17464d0f1d6025c10db1148f881" + ] + ], + "versions_rmats": [ + [ + "RMATS_PREP", + "rmats", + "4.3.0" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2026-03-08T16:37:23.274248898" } } \ No newline at end of file From 7c7a02d3676e847de08a69123d55252f3dcea3d6 Mon Sep 17 00:00:00 2001 From: Uri David Akavia Date: Sun, 8 Mar 2026 17:25:21 +0000 Subject: [PATCH 14/14] Remoevd TODO lines from main.nf --- modules/nf-core/rmats/prep/main.nf | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/rmats/prep/main.nf b/modules/nf-core/rmats/prep/main.nf index 0991a65ad0a1..9b99c92079c8 100644 --- a/modules/nf-core/rmats/prep/main.nf +++ b/modules/nf-core/rmats/prep/main.nf @@ -2,7 +2,6 @@ process RMATS_PREP { tag "${meta.id}" label 'process_single' - // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. conda "${moduleDir}/environment.yml" container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/rmats:4.3.0--py311hf2f0b74_5' @@ -10,9 +9,9 @@ process RMATS_PREP { input: tuple val(meta), path(genome_bam) - // TODO - post seems to need only the BAM *names*, not the actual files. Could we just get the first line of each file to get the names? + // NOTES - post seems to need only the BAM *names*, not the actual files. Could we just get the first line of each file to get the names? // for file in `ls multi_bam_rmats_prep_tmp/*.rmats`; do head -1 $file; done | tr '\n' ',' - // TODO - for stats, it should be possible to parse the formula using patsy, but if we include PAIRADISE we might have R - just do this in R, first pass + // NOTES - for stats, it should be possible to parse the formula using patsy, but if we include PAIRADISE we might have R - just do this in R, first pass path reference_gtf val rmats_read_len