Skip to content

bamCoverage --MNase: three centre bases for odd fragment lengths - #1466

Open
cindykrafft wants to merge 1 commit into
deeptools:masterfrom
cindykrafft:fix4/mnase-odd-fragment-centre
Open

bamCoverage --MNase: three centre bases for odd fragment lengths#1466
cindykrafft wants to merge 1 commit into
deeptools:masterfrom
cindykrafft:fix4/mnase-odd-fragment-centre

Conversation

@cindykrafft

Copy link
Copy Markdown

Alignmentfilters::manipulate_record (src/filtering.rs) returned frag_start..frag_start + 4 for an odd template length: four bases, one left and two right of the fragment centre, where the --MNase help documents "only 3 nucleotides at the center of each fragment" (#1118; the Python implementation had the same four bases through true division of read.tlen). + 3 restores the documented three; even lengths are unchanged.

Tests: two cargo tests in src/tests/test_filtering.rs on synthetic proper-pair records (insert sizes 150 → [174, 175]; 149 → [173, 174, 175]; 131 → [1064, 1065, 1066]), and test_bam_coverage_MNase_odd_fragment_length on the shipped test_paired2.bam (147-bp pairs give 3 bases, 166/154-bp pairs give 2). The cargo test fails on master (left: Some([173, 174, 175, 176])), the pytest fails on the master build; with the patch cargo test 50 passed, test_bamCoverage_and_bamCompare.py and the full pytest suite pass.

Found in Mytochondria, a volunteer project that checks the numerical core of research software and verifies every finding by execution (methods and harnesses: https://github.com/cindykrafft/mytochondria/tree/main/audits/deeptools)


Generated by Claude Code


manipulate_record returned frag_start..frag_start + 4 for an odd
template length, i.e. four bases -- one left and two right of the
fragment centre -- where the --MNase help documents "only 3 nucleotides
at the center of each fragment" (deeptools#1118; the Python implementation had
the same defect through true division of read.tlen).  Even lengths are
unchanged.

Tests: cargo tests on synthetic proper-pair records of insert size 150,
149 and 131; a pytest on the shipped test_paired2.bam (147-bp pairs give
3 bases, 166/154-bp pairs give 2).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TaHntBDKuZJpMAAMenkC44
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.

bamCoverage taking four nucleotides instead of three when --MNase is used

1 participant