Skip to content

Conversation

@pinin4fjords
Copy link
Member

Description

Fixes #1653

When mark duplicates is enabled (skip_markduplicates=false) and UMI deduplication is disabled (with_umi=false), both the aligner's flagstat files (showing 0 duplicates) and the markduplicates flagstat files (showing actual duplicate counts) were being passed to MultiQC.

This caused MultiQC to randomly select one of the flagstat files per sample, sometimes showing incorrect zero duplicate counts in the samtools/flagstat table.

Changes

Modified the logic in workflows/rnaseq/main.nf so that:

  1. When UMI deduplication is enabled (with_umi=true): UMI dedup stats are used (unchanged behavior)
  2. When UMI dedup is disabled AND markduplicates will be skipped (skip_markduplicates=true): Aligner stats are used
  3. When UMI dedup is disabled AND markduplicates will run (skip_markduplicates=false): Aligner stats are NOT added here - the BAM_MARKDUPLICATES_PICARD subworkflow adds its stats later

This ensures only one set of flagstat files (the correct ones with actual duplicate counts) is passed to MultiQC.

Testing

Ran the test profile with --skip_pseudo_alignment and verified:

  • Only .markdup.sorted.bam.flagstat files are present in the MultiQC work directory
  • No .sorted.bam.flagstat files from the aligner are present
  • The MultiQC flagstat table correctly shows duplicate counts for all samples

Co-authored-by: GitHub Copilot copilot@github.com

When mark duplicates is enabled (skip_markduplicates=false) and UMI
deduplication is disabled (with_umi=false), both the aligner's flagstat
files (showing 0 duplicates) and the markduplicates flagstat files
(showing actual duplicate counts) were being passed to MultiQC.

This caused MultiQC to randomly select one of the flagstat files per
sample, sometimes showing incorrect zero duplicate counts.

The fix ensures that when markduplicates will run, only its stats are
passed to MultiQC. The aligner stats are only added when both with_umi
is false AND skip_markduplicates is true.

Co-authored-by: GitHub Copilot <copilot@github.com>
@pinin4fjords pinin4fjords linked an issue Dec 9, 2025 that may be closed by this pull request
@pinin4fjords pinin4fjords requested a review from ggrimes December 9, 2025 11:43
@github-actions
Copy link

github-actions bot commented Dec 9, 2025

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

Posted for pipeline commit 9382056

+| ✅ 285 tests passed       |+
#| ❔   8 tests were ignored |#
!| ❗   9 tests had warnings |!
Details

❗ 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.5.1
  • Run at 2025-12-11 10:34:10

@pinin4fjords
Copy link
Member Author

Thanks @maxulysse !

@pinin4fjords pinin4fjords merged commit e6739b0 into dev Dec 11, 2025
78 of 94 checks passed
@pinin4fjords pinin4fjords deleted the fix/multiqc-flagstat-duplicates branch December 11, 2025 11:34
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.

multiqc flagstat report table

3 participants