Skip to content

feat: groups liftover results by chain#9

Merged
claymcleod merged 7 commits intomainfrom
feat/grouped-liftover
Mar 19, 2026
Merged

feat: groups liftover results by chain#9
claymcleod merged 7 commits intomainfrom
feat/grouped-liftover

Conversation

@claymcleod
Copy link
Member

@claymcleod claymcleod commented Mar 19, 2026

Previously, Machine::liftover() returned a flat list of ContiguousIntervalPairs with no information about which chain each segment originated from. This made it impossible to distinguish between segments from different chains covering the same region (ambiguous mapping) and segments from the same chain separated by a gap (straddle).

Machine::liftover() now returns Vec<LiftoverResult>, where each LiftoverResult groups the segments from a single chain together with the full chain header. This lets callers trivially distinguish ambiguous mappings (results.len() > 1) from straddle splits (results[0].segments().len() > 1).

The builder also now validates at build time that no two chain sections share the same ID with inconsistent headers, surfacing a DuplicateChainId error rather than silently dropping metadata at query time.

All hand-written Display and std::error::Error impls across the crate have been replaced with thiserror derives. The compare-crossmap binary now selects the highest-scoring chain when multiple chains overlap a single-position query (matching CrossMap's behavior) and logs timing information for both tools. MSRV has been bumped to 1.85.0.

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • You have added any relevant tags to the pull request.
  • Your code builds clean without any errors or warnings (use cargo test and cargo clippy).
  • You have added tests (when appropriate).
  • You have updated the wiki (when appropriate).
  • You have updated the README or other documentation to account for these changes (when appropriate).
  • You have added an entry in the CHANGELOG.md.

Previously, `Machine::liftover()` returned a flat list of
`ContiguousIntervalPair`s with no information about which chain each
segment originated from. This made it impossible to distinguish
between segments from different chains covering the same region
(ambiguous mapping) and segments from the same chain separated by a
gap (straddle).

- `Machine::liftover()` now returns `Vec<LiftoverResult>`, where each
  `LiftoverResult` groups the segments from a single chain together
  with the full chain header.
- `LiftoverResult` exposes `.chain()` (returning the
  `alignment::section::header::Record`) and `.segments()`.
- The builder now validates that no two chain sections share the same
  ID with inconsistent headers, erroring via
  `Error::DuplicateChainId` at build time.
@claymcleod claymcleod self-assigned this Mar 19, 2026
Replaces hand-written `Display` and `std::error::Error` impls across
the crate with `#[derive(Error)]` and `#[error(...)]` attributes.
Also bumps the MSRV to 1.83.0 (required by `thiserror` v2), fixes
a pre-existing clippy lint in `compare-crossmap`, and updates the
binary to use the new `LiftoverResult` API.
When multiple chains overlap the same single-position query, the
comparison binary now selects the result from the highest-scoring chain
rather than asserting that only one chain matched. This aligns with how
`CrossMap` resolves ambiguous mappings.
Also bumps MSRV to 1.85.0 for `clap` 4.6.0 compatibility.
@claymcleod claymcleod force-pushed the feat/grouped-liftover branch from 83a7d6d to e345917 Compare March 19, 2026 16:10
claymcleod added a commit that referenced this pull request Mar 19, 2026
@claymcleod claymcleod force-pushed the feat/grouped-liftover branch from 3570664 to d406f6f Compare March 19, 2026 16:31
@claymcleod claymcleod merged commit 0233080 into main Mar 19, 2026
8 checks passed
@claymcleod claymcleod deleted the feat/grouped-liftover branch March 19, 2026 16:33
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