Skip to content

feat: add WatermanSmithBeyer algorithm#20

Open
MavenRain wants to merge 1 commit intolignum-vitae:mainfrom
MavenRain:feat/waterman-smith-beyer
Open

feat: add WatermanSmithBeyer algorithm#20
MavenRain wants to merge 1 commit intolignum-vitae:mainfrom
MavenRain:feat/waterman-smith-beyer

Conversation

@MavenRain
Copy link
Copy Markdown

Summary

Closes #7.

Adds the WatermanSmithBeyer algorithm, a global alignment algorithm that uses
affine gap penalties and considers all possible gap lengths (O(n^3)).

Design

  • Uses ExtendedGapScoring (gap open + gap extend) with cost function w(k) = gap_open + (k-1) * gap_extend
  • Stores optimal gap step sizes in the extra pointer matrices from
    AlignmentData::new_gotoh(), avoiding any changes to AlignmentData or
    Matrix2D
  • Custom WsbAligner traceback iterator handles variable-length gaps (pushes
    multiple characters per gap step)
  • Follows the same GlobalAlignmentMatrix trait pattern as NeedlemanWunsch

Files

  • src/alignment/edit/waterman_smith_beyer.rs (new) -- scoring matrix
    computation
  • src/alignment/global_base.rs -- added WatermanSmithBeyer variant and
    WsbAligner traceback
  • src/alignment/edit/mod.rs, src/lib.rs -- module registration and
    re-export
  • tests/wsb_test.rs (new) -- 9 tests

Test plan

  • 33 tests pass (24 existing + 9 new)
  • cargo clippy clean
  • cargo fmt clean

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.

Add WatermanSmithBeyer

1 participant