Repository navigation
7 - (ui) - Reverse complement annotations for reverse alignments - #8
Merged
Merged
Conversation
…ignments tracy aligns a reverse read against the reverse complement of the reference, and its refpos is the original-strand position of the last refalign column. Annotations were drawn on the original strand from refpos as if it were the first column, so they sat in the wrong place. For forward = 0 the annotations are now mirrored onto the reverse complement with sequence-utils and refpos is converted to the position of the first column. The reference-row numbers are then positions on the reverse complement. Because refalign is only the aligned stretch, a mismatch between the annotation file and the reference cannot otherwise be seen. When the file carries a sequence, the aligned bases are looked up in it at refpos and a warning is shown in the annotation panel if they are not found. Coding and writing assisted with Claude Sonnet 5.5 Prompts (edited for grammar, private details removed): - 2026-10-29: "Implement issue 7: reverse complement the annotations if forward = 0." - 2026-10-29: "Use the reverse complement utility from the libraries if there is one." - 2026-10-29: "Add a runtime check that the GenBank reference sequence matches the aligned one, otherwise show a warning in the UI."
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.
What
Annotations are now reverse complemented when the alignment is a reverse one (
forwardis 0), so they line up with the reference row and the trace. The reference-row numbers for such an alignment are positions on the reverse complement. A warning in the Annotations panel appears when the annotation file's sequence does not contain the aligned reference atrefpos.Why
tracy writes
refalignas the reverse complement of the reference, butrefposis the original-strand position of its last column. Annotations were placed fromrefposas if it were the first column, so every reverse alignment, including the bundled example, showed them in the wrong place. I checked the bundled example against its GenBank file: the reverse complement of the bases atrefposequalsrefalign, and the converted first column matches whererefalignis found in the reverse complement.Decision
The annotations are mirrored with
getReverseComplementAnnotationfrom@teselagen/sequence-utils, withendconverted to and from inclusive around the call. Without an annotation file the reference length is unknown, sorefposis left in original-strand coordinates in that case.Not in this PR
Fixes #7
Coding and writing assisted with Claude Sonnet 5.5