Skip to content

Port subworkflow rmats to nf-core structure - #291

Merged
piplus2 merged 2 commits into
nf-core:devfrom
piplus2:rmats-subworkflow-nfcore
Sep 24, 2026
Merged

piplus2 merged 2 commits into
nf-core:devfrom
piplus2:rmats-subworkflow-nfcore

Conversation

@piplus2

@piplus2 piplus2 commented Sep 24, 2026 •

Copy link
Copy Markdown

Description

Moves the local RMATS subworkflow to the nf-core subworkflow template, the same way PREPARE_GENOME was ported in #290. nf-core/modules has rmats/prep, which the subworkflow already uses, but no rmats/post module and no rMATS subworkflow, so CREATE_BAMLIST and RMATS_POST stay local.

Changes

  • New meta.yml. Authors are taken from the git history of the subworkflow (@asmaali98, @bensouthgate, @jma1991), plus @piplus2 as author and maintainer.
  • The subworkflow takes the genome BAM files as [ meta, bam ] and reads the condition from meta.condition. The caller no longer builds [ condition, meta, bam ] tuples.
  • The samples of each rMATS run are built from the samplesheet order, the same way for the paired and unpaired models. This replaces the multiMap and the join on sample positions, and the bam lists now always follow the samplesheet order.
  • The bam lists are emitted, the MODULE section headers are added and the file is formatted with nextflow lint -format.

Fixes

  • With --rmats_paired_stats, a contrast whose conditions have different numbers of samples dropped the samples with no counterpart without any message: the join discarded them before the existing size check ran, so the check could never fire. It now stops with an error naming the samples of both conditions.
  • A contrast naming a condition with no sample in the samplesheet was skipped without any message. It now stops with an error.
  • The meta map of a single condition run had control: ''. It now leaves the key out. nf-test reads a string naming an existing file as a path, and '' is the working directory, so every snapshot save hashed the whole repository.

Testing

  • 5 new nf-tests for the subworkflow, on the four chrX BAM files of the rnasplice test-datasets: two contrasts sharing their samples with the unpaired model (each BAM file is prepped once), one contrast with the paired model, a single condition, a paired contrast with unequal sample counts (expected failure) and a stub.
  • Full suite green: 78/78 nf-tests, pipeline snapshots unchanged, nf-core pipelines lint (tools 4.1.0) 0 failures, prek clean.
  • nf-core pipelines lint warns that create/bamlist and rmats/post are missing from the subworkflow meta.yml. They are listed under their real names, create_bamlist and rmats_post; the linter splits local module names on underscores, the same false positive as in PREPARE_GENOME and LEAFCUTTER.
  • The single condition test of the local RMATS_POST module had the same control:'' meta map. It now leaves the key out too, which brings the module test file from 406s down to 66s; only the meta map in its snapshot changes.

Generated by Claude Opus 5.5

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/rnasplice branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

🤖 Generated with Claude Code

Add meta.yml and nf-tests for the local RMATS subworkflow. nf-core/modules
has rmats/prep, which the subworkflow already uses, but no rmats/post module
and no rMATS subworkflow, so CREATE_BAMLIST and RMATS_POST stay local. The
tests cover two contrasts sharing their samples with the unpaired model,
one contrast with the paired model, a single condition, a paired contrast
with unequal sample counts and a stub run.

Also:

- Take the genome BAM files as [ meta, bam ] and read the condition from
  meta.condition, instead of [ condition, meta, bam ] tuples built by the
  caller.

- Build the samples of every rMATS run from the samplesheet order, the same
  way for the paired and unpaired models, which replaces the multiMap and
  the join on sample positions.

- Stop with an error when a paired contrast has conditions of different
  sizes. The join dropped the samples with no counterpart, so the existing
  size check could never fire. A contrast naming a condition with no sample
  also stops with an error instead of being skipped.

- Leave the control key out of the meta map of a single condition run. An
  empty string made nf-test hash the whole working directory as a path.

- Emit the bam lists, add the MODULE section headers and format with
  nextflow lint -format.

Generated by Claude Opus 5.5

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

nf-core pipelines lint overall result: Passed ✅ ⚠️

Posted for pipeline commit 256e179

+| ✅ 311 tests passed       |+
#| ❔   5 tests were ignored |#
#| ❔   1 tests had warnings |#
!| ❗  12 tests had warnings |!
Details

❗ Test warnings:

  • readme - README contains the placeholder zenodo.XXXXXXX. This should be replaced with the zenodo doi (after the first release).
  • pipeline_todos - TODO string in CHANGELOG.md: ## v1.1.0dev - [unreleased replace with date on release ]
  • pipeline_todos - TODO string in main.nf.test: define inputs of the process here. Example:
  • pipeline_todos - TODO string in awsfulltest.yml: You can customise AWS full pipeline tests as required
  • pipeline_todos - TODO string in methods_description_template.yml: #Update the HTML below to your preferred methods description, e.g. add publication citation for this pipeline
  • pipeline_todos - TODO string in nextflow.config: Specify any additional parameters here
  • pipeline_todos - TODO string in CONTRIBUTING.md: Add any pipeline specific contribution guidelines here, such as coding styles, procedures, checklists etc.
  • schema_params - Schema param fasta not found from nextflow config
  • schema_params - Schema param gtf not found from nextflow config
  • schema_params - Schema param gff not found from nextflow config
  • schema_params - Schema param star_index not found from nextflow config
  • schema_params - Schema param salmon_index not found from nextflow config

❔ Tests ignored:

  • files_unchanged - File ignored due to lint config: .github/PULL_REQUEST_TEMPLATE.md
  • files_unchanged - File ignored due to lint config: .github/workflows/branch.yml
  • files_unchanged - File ignored due to lint config: .github/workflows/linting.yml
  • files_unchanged - File ignored due to lint config: assets/nf-core-rnasplice_logo_light.png
  • files_unchanged - File ignored due to lint config: docs/images/nf-core-rnasplice_logo_dark.png

❔ Tests fixed:

✅ Tests passed:

Run details

  • nf-core/tools version 4.1.0
  • Run at 2026-09-24 14:05:04

The single condition test gave RMATS_POST a meta map with control: ''.
nf-test reads a string naming an existing file as a path, and '' is the
working directory, so every snapshot comparison and save hashed the whole
repository: the test file took 406s instead of 66s and printed
EOFException traces on partly written .gz files. The meta map now has no
control key, as the RMATS subworkflow builds it for a single condition.

Generated by Claude Opus 5.5

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

❌ nf-test failed with latest Nextflow version

Note

Tests with Nextflow's latest version failed but it will not cause a CI workflow failure.
Please check if the failure is expected with newer (edge-)releases of Nextflow or if it needs fixing.

  • ❌ docker | latest-everything | Shard 5/8

See the full run for details.

@erikrikarddaniel erikrikarddaniel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with Claude Code.

This looks good to me. The contrast samples are now built one way for both models, and the size check runs on the samplesheet. That means the silent drop of unmatched samples is gone. I checked two things that could break the positional pairing, and both are safe. ch_genome_bam is never filtered before rMATS. The genome_bam schema enforces unique sample ids. The paired and unpaired snapshots also differ, so --paired-stats really takes effect in the tests.

Two small inline comments, neither blocking.

One optional thought for later: the new "condition has no sample" check only runs with --rmats. The same contrastsheet then passes silently with the other tools. It could move next to validateInputContrastsheet in PIPELINE_INITIALISATION, so that every tool gets it. That is out of scope for this PR.

.map { row, by_condition ->
[row.treatment, row.control].each { condition ->
if (!by_condition.containsKey(condition)) {
error("rMATS contrast '${row.contrast}': condition '${condition}' has no sample in the samplesheet")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new error has no test. A failure test like paired - unequal sample counts would cover it: a contrast naming a condition that has no sample, and an assert on workflow.stdout.

Comment on lines +71 to +72
Channel containing the comma separated list of the control BAM files of each contrast,
empty in single condition mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bam_list2 is an optional output, so a single condition run emits no entry rather than an empty one:

Suggested change
Channel containing the comma separated list of the control BAM files of each contrast,
empty in single condition mode
Channel containing the comma separated list of the control BAM files of each contrast,
with no entry in single condition mode

@piplus2

piplus2 commented Sep 24, 2026

Copy link
Copy Markdown
Author

Thanks @erikrikarddaniel ! You are right, in the next PR I'll make the contrasts consistent.

@piplus2
piplus2 merged commit 1b44723 into nf-core:dev Sep 24, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants