Skip to content

Partial implementation of allowing TSMs to start and end outside of the focus region#191

Merged
sebschmi merged 18 commits into
mainfrom
188-allow-tsms-to-start-and-end-outside-of-the-focus-region
Jun 5, 2026
Merged

Partial implementation of allowing TSMs to start and end outside of the focus region#191
sebschmi merged 18 commits into
mainfrom
188-allow-tsms-to-start-and-end-outside-of-the-focus-region

Conversation

@sebschmi

@sebschmi sebschmi commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 5, 2026 05:55
@sebschmi sebschmi linked an issue Jun 5, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an (explicitly partial) implementation path toward allowing template-switch alignments (TSMs) to start and/or end outside the configured focus AlignmentRange, primarily to support inputs that are already gapped (e.g., derived from an existing alignment).

Changes:

  • Adds a new Ts14OutOfRangeStrategy plus plumbing to compute and pass “additional explicit” TSM start/end coordinates derived from the original (gapped) sequences.
  • Introduces new internal alignment node/edge kinds (Root, AlternativeStart, and indexed PrimaryReentry) to support multiple possible alignment starts/ends.
  • Extends the configurable aligner + Python bindings to accept gap_characters so callers can treat sequences as gapped alignments while keeping range coordinates on ungapped sequences.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tsalign/src/align/template_switch_distance_type_selectors.rs Threads AdditionalExplicitTSMStartsAndEnds through the CLI strategy-selection pipeline and switches primary range pruning strategy.
tsalign/src/align.rs Adds --allow-ts-14-out-of-range flag and computes AdditionalExplicitTSMStartsAndEnds from original sequences + skip characters.
test_files/config/bench/config.tsa Updates benchmark configuration numeric parameters (offset/cost tables).
test_files/chr15_52720987_52721016.sh Adds a repro script invoking --allow-ts-14-out-of-range.
test_files/chr15_52720987_52721016.fa Adds a repro FASTA input pair for the new behavior.
test_files/chr11_39595337_39595347.sh Adds another repro script (including a --no-ts run) invoking --allow-ts-14-out-of-range.
test_files/chr11_39595337_39595347.fa Adds another repro FASTA input pair.
python_bindings/src/lib.rs Adds gap_characters argument to Python Aligner.align() and forwards it to the Rust aligner.
lib_tsshow/src/ts_arrangement/source.rs Updates pattern matches for the new/changed alignment types.
lib_tsshow/src/plain_text/mutlipair_alignment_renderer.rs Updates rendering validation to account for new/changed alignment types.
lib_tsalign/src/tests.rs Updates tests to pass new args/dynamic strategies and adjusts expected costs.
lib_tsalign/src/a_star_aligner/template_switch_distance/strategies/allow_ts_14_out_of_range.rs New strategy helper to compute explicit TSM start/end coordinates outside the focus range.
lib_tsalign/src/a_star_aligner/template_switch_distance/strategies.rs Exposes the new allow_ts_14_out_of_range module.
lib_tsalign/src/a_star_aligner/template_switch_distance/lower_bounds/template_switch.rs Updates lower bound construction for new context args and new identifiers.
lib_tsalign/src/a_star_aligner/template_switch_distance/lower_bounds/template_switch_alignment.rs Same as above for alignment lower bound logic.
lib_tsalign/src/a_star_aligner/template_switch_distance/identifier.rs Adds Root + AlternativeStart identifiers and a constructor helper.
lib_tsalign/src/a_star_aligner/template_switch_distance/display.rs Updates Display for new alignment/identifier variants.
lib_tsalign/src/a_star_aligner/template_switch_distance/context.rs Adds dynamic strategy + explicit start/end data to context; adds successor generation and updated target detection.
lib_tsalign/src/a_star_aligner/template_switch_distance/alignment_type.rs Adds AlternativeStart and indexed PrimaryReentry, plus trait hooks for alternative start/end coordinates.
lib_tsalign/src/a_star_aligner/template_switch_distance.rs Threads the new PrimaryReentry { reference_index, query_index } into successor construction.
lib_tsalign/src/a_star_aligner/gap_affine_edit_distance.rs Implements new IAlignmentType hooks (alternative_start/end) as no-ops for non-TS alignment.
lib_tsalign/src/a_star_aligner/configurable_a_star_align.rs Adds gap_characters filtering + ts_14_out_of_range plumbing and computes explicit starts/ends when enabled.
lib_tsalign/src/a_star_aligner/alignment_result/alignment/template_switch_specifics.rs Accounts for new internal alignment types when computing alignment costs.
lib_tsalign/src/a_star_aligner/alignment_result/alignment/stream.rs Accounts for new internal alignment types in stream coordinate logic.
lib_tsalign/src/a_star_aligner/alignment_result.rs Extends IAlignmentType and stores alignment limits in statistics; adds alignment_range() accessor.
lib_tsalign/src/a_star_aligner/alignment_geometry.rs Adds AlignmentRange::new(...) plus convenience setters and coordinate accessors.
lib_tsalign/src/a_star_aligner.rs Tries to adjust reported alignment range based on alternative start/end markers.
lib_ts_chainalign/src/chain_align.rs Updates alignment result construction to pass an AlignmentRange instead of separate offsets.
Cargo.toml Tweaks workspace dev/release debug profile settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib_tsalign/src/a_star_aligner/template_switch_distance/context.rs
Comment thread lib_tsalign/src/a_star_aligner.rs Outdated
Comment thread python_bindings/src/lib.rs Outdated
Comment thread tsalign/src/align.rs Outdated
sebschmi and others added 3 commits June 5, 2026 09:09
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sebschmi sebschmi enabled auto-merge June 5, 2026 06:15
@sebschmi sebschmi merged commit 83e9e79 into main Jun 5, 2026
28 checks passed
@sebschmi sebschmi deleted the 188-allow-tsms-to-start-and-end-outside-of-the-focus-region branch June 5, 2026 06:19
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.

Allow TSMs to start and end outside of the focus region

2 participants