New module: modkit/entropy - #11283
Conversation
cc8a7f2 to
e0004d3
Compare
e0004d3 to
d95d97b
Compare
Add new nf-core module wrapping `modkit entropy`, which computes methylation entropy over genomic windows from one or more mod-BAMs. Supports an optional BED of regions for per-region descriptive statistics; emits a genome-wide BED otherwise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d95d97b to
0978565
Compare
itrujnara
left a comment
There was a problem hiding this comment.
Hi, thanks for the high-quality submission. I have left a handful of comments.
|
This PR has been tagged as awaiting-changes or awaiting-feedback by an @nf-core/modules contributor. Remove stale label or add a comment if it is still useful. |
…ions Addresses @itrujnara's review: - Stub now simulates the `--regions` layout. `modkit entropy --regions` writes a directory containing `<prefix>_regions.bed` and `<prefix>_windows.bedgraph` instead of the single genome-wide BED, so the stub branches on `regions`. - Added a real and a stub test that exercise the `regions` input, asserting the exact output filenames and that `bed` is not emitted when `regions` is set. - Tests now check file contents. `--header` is passed via `ext.args` so the header line and row structure can be asserted for all three output flavours. Also removed the `tsv` output channel: `modkit entropy --regions` emits only `_regions.bed` and `_windows.bedgraph` (verified against modkit 0.6.1), so the emit never fired. The `meta.yml` description claiming a `.tsv` output was corrected to match. The entropy column is not byte-deterministic across thread counts, so the non-stub tests continue to snapshot only the versions topic. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7RSvpouxbMBdimYSwJ5ZP
|
Thanks for the review @itrujnara — all three points addressed. 1. Stub now simulates the While confirming the filenames against 2. Added tests that use the 3. Yes — now checking file contents.
Still snapshotting only the versions topic for the non-stub tests: the entropy |
`nf-core lint` (tools@dev) checks that the string "versions" appears in each
snapshot entry via `test_snap_versions`. The two non-stub tests snapshotted
`process.out.versions_modkit` as a bare list, so the serialised content held
only the values ("MODKIT_ENTROPY", "modkit", "0.6.1") and the check failed.
Snapshotting `[versions: process.out.versions_modkit]` keeps the same content
and satisfies the check. Verified with nf-core/tools 4.1.0: 64 passed, 0 failed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E7RSvpouxbMBdimYSwJ5ZP
Ports the review changes from nf-core#11286 to this module. - `assert process.success` moved out of `assertAll` and to the top of each `then` block — ahead of the `path(...).readLines()` calls, which would otherwise throw on a failed run before any assertion reported. - The two stub tests snapshot `sanitizeOutput(process.out)`, which drops the duplicated numbered output keys. Requires nft-utils 1.x, which is why master is merged in first. - The two non-stub tests still snapshot only the versions topic: entropy's floating-point columns are not byte-deterministic across CPU counts, so those outputs stay asserted on structure rather than md5. - tests/nextflow.config is kept: it sets a real `ext.args = '--cpg --header'`. - Bump ont-modkit 0.6.1 -> 0.6.4 (clears the `bioconda_latest` lint warning); container tag `0.6.4--h7f49ad2_0` verified on the Galaxy depot and quay.io. The header and column-count assertions pass unchanged at 0.6.4, so the entropy BED/bedgraph layout is stable across the bump. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAsT7dzCcLSicJxFRWJozr
PR checklist
--cpgmode).topic: versions.process_high).Summary
Adds a new nf-core module wrapping `modkit entropy`, which computes methylation entropy over genomic windows from one or more mod-BAMs. Entropy is a per-window measure of the diversity of methylation patterns across reads covering the window and is complementary to mean methylation.
The module supports modkit's file-vs-directory output dichotomy: when `--regions` is supplied (either via `ext.args` or the third input channel), modkit writes per-region BED / bedgraph / TSV into a directory (emitted via `regions_bed`, `bedgraph`, `tsv` outputs); otherwise a single genome-wide BED is produced (emitted via `bed`).
Accepts multiple input BAMs (passed as repeated `--in-bam`) for multi-sample entropy.
Why
`modkit entropy` is the canonical tool for quantifying methylation heterogeneity in ONT methylation data and is not currently in nf-core/modules. It complements the existing `modkit/pileup` (mean methylation) for heterogeneity-aware analyses.
Test data
Uses the existing `test.sorted.phased.bam` from nf-core/test-datasets (modules branch, `genomics/homo_sapiens/nanopore/bam/`). No new test data required.
🤖 Generated with Claude Code