Skip to content

[codex] Left-align equivalent indels#173

Merged
iskandr merged 1 commit into
masterfrom
fix-left-align-indels
Apr 23, 2026
Merged

[codex] Left-align equivalent indels#173
iskandr merged 1 commit into
masterfrom
fix-left-align-indels

Conversation

@iskandr
Copy link
Copy Markdown
Contributor

@iskandr iskandr commented Apr 23, 2026

Summary

This PR teaches ReadCollector to left-align equivalent indels within a read alignment so that homopolymer insertions/deletions are counted against the queried canonical variant instead of being treated as reference support.

What changed

  • detect insertion and deletion events from pysam aligned pairs when a specific variant is being queried
  • walk each equivalent one-base-left-shift state inside the local alignment and match it against the queried trimmed variant
  • rewrite the logical read interval to the canonical left-aligned indel split when a match is found
  • relax AlleleRead.from_locus_read(...) so it trusts the collector's logical interval for canonicalized insertions
  • add locus-read and read-evidence regressions for right-shifted homopolymer insertions and deletions
  • bump isovar to 1.4.23

Why

Issue #79 is a correctness bug: DNA variants are generally left-aligned, but RNA aligners may place an equivalent indel later within a repeat. Isovar previously compared only the literal allele at the queried locus, so those equivalent alignments were counted as ref/other instead of alt.

Impact

  • equivalent homopolymer indels now collapse onto the same canonical variant locus
  • downstream allele read exports and read counts become stable across alignment placement of the same indel
  • the assembly layer now sees a consistent logical indel split for those reads

Validation

  • ./lint.sh
  • ./test.sh

Closes #79

@iskandr iskandr marked this pull request as ready for review April 23, 2026 17:20
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 93.4% (-0.04%) from 93.441% — fix-left-align-indels into master

@iskandr iskandr merged commit 4587a32 into master Apr 23, 2026
6 checks passed
@iskandr iskandr deleted the fix-left-align-indels branch April 23, 2026 17:26
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.

Left align indels

2 participants