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.
| stub: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
| """ | ||
| touch ${prefix}.bed |
There was a problem hiding this comment.
Can we get the stub to simulate the bigger output when regions is passed?
| } | ||
| } | ||
|
|
||
| test("homo sapiens - nanopore modbam - cpg") { |
There was a problem hiding this comment.
We need a test that uses the regions input
| { assert process.out.bed }, | ||
| { assert path(process.out.bed[0][1]).exists() }, | ||
| { assert path(process.out.bed[0][1]).size() > 0 }, | ||
| // modkit entropy's BED output isn't byte-deterministic across CPU |
There was a problem hiding this comment.
Is it possible to check anything inside the file (e.g. header line)?
|
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
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