Skip to content

Conversation

@pinin4fjords
Copy link
Member

Summary

Fixes #1591 - Corrects mislabeled bigwig files for reverse-stranded (dUTP) libraries where forward and reverse strand signals were inverted in the final output files.

Background

For reverse-stranded libraries, reads align to the opposite strand of the genes they represent:

  • Forward (+) strand genes → reads map to the reverse (-) strand
  • Reverse (-) strand genes → reads map to the forward (+) strand

This is due to the dUTP library preparation method where the second strand synthesis incorporates dUTPs, which are later degraded, preserving only the strand opposite to the original RNA.

The Problem

The pipeline was always using:

  • BEDTOOLS_GENOMECOV_FW with -strand + → output labeled as .forward.bigWig
  • BEDTOOLS_GENOMECOV_REV with -strand - → output labeled as .reverse.bigWig

This is correct for forward-stranded and unstranded libraries, but produces inverted labels for reverse-stranded libraries:

  • .forward.bigWig contained coverage from reads on the + strand, which represent - strand genes ❌
  • .reverse.bigWig contained coverage from reads on the - strand, which represent + strand genes ❌

This caused the bigwig tracks to appear inverted when visualized in IGV or other genome browsers.

The Solution

Made the -strand parameter conditional on meta.strandedness in the nextflow config:

For reverse-stranded libraries:

  • BEDTOOLS_GENOMECOV_FW now uses -strand - (captures forward genes) ✓
  • BEDTOOLS_GENOMECOV_REV now uses -strand + (captures reverse genes) ✓

For other library types:

  • Behavior remains unchanged (uses -strand + and -strand - respectively)

This ensures:

  • .forward.bigWig always contains coverage of forward (+) strand genes
  • .reverse.bigWig always contains coverage of reverse (-) strand genes

...regardless of library preparation method.

Changes

  • Modified workflows/rnaseq/nextflow.config to make ext.args conditional for both BEDTOOLS_GENOMECOV_FW and BEDTOOLS_GENOMECOV_REV processes

Test Plan

  • Run pipeline with reverse-stranded library data (e.g., dUTP method)
  • Verify bigwig files in IGV show correct strand orientation
  • Compare with known genes to confirm forward genes appear in forward.bigWig
  • Test with forward-stranded libraries to ensure no regression
  • Test with unstranded libraries to ensure no regression

🤖 Generated with Claude Code

pinin4fjords and others added 2 commits November 14, 2025 10:49
Fixes mislabeled bigwig files for reverse-stranded (dUTP) libraries
where forward and reverse strand signals were inverted in the final
output files.

For reverse-stranded libraries, reads align to the opposite strand
of the genes they represent:
- Forward (+) genes have reads on the reverse (-) strand
- Reverse (-) genes have reads on the forward (+) strand

The pipeline was always using `-strand +` for BEDTOOLS_GENOMECOV_FW
and `-strand -` for BEDTOOLS_GENOMECOV_REV, regardless of library
strandedness. This is correct for forward-stranded and unstranded
libraries, but produces inverted labels for reverse-stranded libraries.

This fix makes the `-strand` parameter conditional on meta.strandedness:
- For reverse-stranded libraries: swaps the strand parameters so that
  BEDTOOLS_GENOMECOV_FW uses `-strand -` and BEDTOOLS_GENOMECOV_REV
  uses `-strand +`
- For other library types: uses the original parameters

This ensures .forward.bigWig always contains coverage of forward (+)
strand genes and .reverse.bigWig always contains coverage of reverse
(-) strand genes, regardless of library preparation method.

Fixes #1591

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link

github-actions bot commented Nov 14, 2025

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

Posted for pipeline commit fbf71f8

+| ✅ 286 tests passed       |+
#| ❔   7 tests were ignored |#
!| ❗   9 tests had warnings |!

❗ Test warnings:

  • files_exist - File not found: assets/multiqc_config.yml
  • pipeline_todos - TODO string in base.config: Check the defaults for all processes
  • 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 main.nf: Optionally add in-text citation tools to this list.
  • pipeline_todos - TODO string in main.nf: Optionally add bibliographic entries to this list.
  • pipeline_todos - TODO string in main.nf: Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled!
  • pipeline_todos - TODO string in nextflow.config: Specify any additional parameters here
  • pipeline_if_empty_null - ifEmpty(null) found in /home/runner/work/rnaseq/rnaseq/subworkflows/local/prepare_genome/main.nf: _ versions = ch_versions.ifEmpty(null) // channel: [ versions.yml ]
    _

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 3.4.1
  • Run at 2025-11-14 11:04:06

@pinin4fjords pinin4fjords linked an issue Nov 14, 2025 that may be closed by this pull request
@pinin4fjords pinin4fjords added this to the 3.22.0 milestone Nov 14, 2025
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.

Bigwig files labeled incorrectly if reverse strand library

2 participants