fix: pair fa:Z extras with correct annotations on reverse-strand reads#103
Merged
fix: pair fa:Z extras with correct annotations on reverse-strand reads#103
Conversation
FiberAnnotations::new re-orders fs/fl into aligned (reference) order when the record is reverse-complement aligned, but from_bam_tags was pairing the fa:Z extras in their original tag-storage order. Result: on reverse-strand reads the extras of adjacent annotations were silently swapped. ref_start /ref_end remained correct; only the extra columns were mis-paired, so the symptom looked like peak-size labels getting swapped between overlapping peaks. Fix: reverse the split fa:Z values when record.is_reverse() so they match FiberAnnotations::new's already-flipped order. Adds two regression tests covering a forward-strand baseline and a reverse-strand case with 5 peaks (last two overlapping) to catch any off-by-one pairing error. Confirmed the reverse-strand test fails without the fix.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FiberAnnotations::newflips fs/fl viapositions_on_aligned_sequencebutfrom_bam_tagsleft the auxiliaryfa:Zvector in tag-storage order — causing extras to be paired with the wrong annotation (symmetric peak swap) whenever multiple peaks were present.ann_valsbefore zipping whenrecord.is_reverse()so extras align with the already-flipped annotations.Test plan
cargo testpasses with the fix