Repository navigation
fix(compare): exclude BAM bin field from core field comparison - #208
Conversation
The raw byte comparison introduced in #197 included the BAM `bin` field (bytes 10-11) when comparing core fields. The bin field is a BAM-specific index optimization not part of the SAM data model, and different tools may compute different values for the same alignment. This caused false core_diff reports when comparing outputs from different tools (e.g. fgumi vs fgbio) that only differed in tag order and bin values. Skip bytes 10-11 in `raw_core_fields_equal` so that bin differences no longer trigger false mismatches. Fixes #207
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #208 +/- ##
==========================================
- Coverage 88.06% 88.06% -0.01%
==========================================
Files 113 113
Lines 52795 52820 +25
==========================================
+ Hits 46495 46516 +21
- Misses 6300 6304 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change modifies raw byte comparison logic for BAM core fields by excluding the 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
binfield (bytes 10-11) fromraw_core_fields_equalso that bin differences between tools no longer cause falsecore_diffreportsContext
PR #197 replaced
RecordBuf-based field-by-field comparison with raw byte comparison. The raw comparison inadvertently included the BAMbinfield, which is a BAM-specific index optimization not part of the SAM data model. Different tools (e.g. fgumi vs fgbio) may compute different bin values for the same alignment, causing all records to be flagged ascore_diffeven when core fields are identical.Test plan
test_core_equal_different_bin_values— records with identical core fields but different bin values are reported as equaltest_structured_different_bin_different_tag_order— records with different bin and different tag order reportcore_match=true,tags_match=false,tag_order_match=truecargo ci-test)cargo ci-fmt && cargo ci-lint)Fixes #207