Skip to content

Use bam_cigar2qlen for query length calculation#1388

Draft
nh13 wants to merge 1 commit intopysam-developers:masterfrom
nh13:nh13/use-bam-cigar2qlen
Draft

Use bam_cigar2qlen for query length calculation#1388
nh13 wants to merge 1 commit intopysam-developers:masterfrom
nh13:nh13/use-bam-cigar2qlen

Conversation

@nh13
Copy link
Contributor

@nh13 nh13 commented Mar 2, 2026

Summary

  • Replace the manual CIGAR loop in calculateQueryLengthWithoutHardClipping with a call to HTSlib's bam_cigar2qlen()
  • Simplify calculateQueryLengthWithHardClipping to call bam_cigar2qlen() and then scan only for BAM_CHARD_CLIP operations (typically 0-2 at CIGAR ends)

Test plan

  • Run REF_PATH=: pytest tests/AlignedSegment_test.py -v

AI disclosure: This PR was AI-assisted using Claude Code. The issue was identified via AI-guided code review, and the implementation was drafted by AI with human review and approval.

@nh13 nh13 marked this pull request as draft March 3, 2026 06:21
@nh13 nh13 changed the title refactor: use bam_cigar2qlen for query length calculation Use bam_cigar2qlen for query length calculation Mar 3, 2026
@nh13 nh13 force-pushed the nh13/use-bam-cigar2qlen branch from a5bc05a to e937221 Compare March 3, 2026 06:24
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