Skip to content

New module: custom/collectfeaturecounts - #12846

Open
erikrikarddaniel wants to merge 1 commit into
nf-core:masterfrom
erikrikarddaniel:custom-collectfeaturecounts
Open

New module: custom/collectfeaturecounts#12846
erikrikarddaniel wants to merge 1 commit into
nf-core:masterfrom
erikrikarddaniel:custom-collectfeaturecounts

Conversation

@erikrikarddaniel

@erikrikarddaniel erikrikarddaniel commented Aug 29, 2026

Copy link
Copy Markdown
Member

PR checklist

Description

Collects one or more subread/featurecounts raw output files (typically one per sample, for the same feature type/ORF caller) into a single long-format table (orf, chr, start, end, strand, length, sample, count, tpm), computing per-sample TPM and dropping zero-count rows.

Ported from two independently-hardened, now-functionally-identical local modules — nf-core/magmap's and nf-core/metatdenovo's own COLLECT_FEATURECOUNTS — as part of a cross-repo effort to share their summary-table-generation code (tracked in nf-core/magmap#237). Both pipelines' local copies were first made caller/pipeline-agnostic by moving their one pipeline-specific ID-reconciliation special-case (magmap's genome-accession join, metatdenovo's Transdecoder cds.-prefix stripping) into small local post-processing steps — see nf-core/magmap#238 and nf-core/metatdenovo#483.

tpm is rounded to 6 decimal places. This carries over a fix from nf-core/metatdenovo#483/#484: when the same underlying counts get independently re-computed elsewhere (e.g. after a caller-consolidation step using a different R backend — dtplyr/data.table here vs plain dplyr there), the unrounded double can round its last significant digit differently for the same mathematical value, which made an exact-equality test downstream intermittently fail. Rounding here keeps output stable regardless of which backend a consumer uses to recompute the same value.

Testing

Verified with real Docker runs against two new fixtures (two samples, mixed zero/non-zero counts, one shared multi-exon gene) — nf-core/test-datasets#2247. tpm correctly sums to exactly 1e6 per sample after rounding, zero-count rows are dropped, sample names are correctly stripped of their .sorted.bam suffix.

Generated by Claude

Collects one or more subread/featureCounts raw output files (typically
one per sample, for the same feature type/ORF caller) into a single
long-format table with per-sample TPM computed, dropping zero-count
rows.

Ported from two now-identical, independently-hardened local modules
(nf-core/magmap's and nf-core/metatdenovo's own COLLECT_FEATURECOUNTS)
as part of the cross-repo summary-table consolidation tracked in
nf-core/magmap#237. Includes the tpm-rounding fix from
nf-core/metatdenovo#483/nf-core#484 (rounds tpm to 6 decimal places, since
independently-computed tpm values for the same counts can otherwise
round the last significant digit differently depending on which R
backend does the division).

Test data (raw subread/featurecounts fixtures, real per-sample
featureCounts.tsv output, not yet present on the modules branch) in
nf-core/test-datasets#2247.

Generated by Claude

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UvGYU6kuXJeVv9ffdSzdzH
@erikrikarddaniel
erikrikarddaniel marked this pull request as ready for review August 29, 2026 07:35
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.

1 participant