Skip to content

adjusts indel CIGAR to better match bwa-meth - #70

Open
bwlang wants to merge 1 commit into
lh3:masterfrom
bwlang:indel_align_fix
Open

adjusts indel CIGAR to better match bwa-meth#70
bwlang wants to merge 1 commit into
lh3:masterfrom
bwlang:indel_align_fix

Conversation

@bwlang

@bwlang bwlang commented Aug 11, 2026

Copy link
Copy Markdown

This pull request fixes a bug in the left alignment of indels when using the --meth mode. Previously, indels were not always left-aligned according to SAM and VCF conventions due to the way methylation-aware base comparisons were handled. The update introduces a new function to correctly determine when bases can be considered equivalent during left alignment, improving compatibility and accuracy.

Bugfixes and Algorithm Improvements

  • Added the mb_base_swap_ok function to correctly determine if swapping two bases across an indel preserves alignment score, accounting for methylation-aware equivalence (e.g., C<->T and G<->A) (align.c).
  • Updated the indel left-alignment logic in mb_fix_cigar to use mb_base_swap_ok, ensuring indels are shifted left as far as possible under methylation-aware scoring (align.c).
  • Modified the call to mb_fix_cigar in mb_update_extra to pass the scoring matrix, enabling methylation-aware base comparison during left alignment (align.c).

Documentation

  • Added an entry in NEWS.md describing the bug, the fix, and the impact on alignment accuracy and compatibility with bwa-meth (NEWS.md).

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