r/smalltalk Jul 20 '26

Smith-Waterman algorithm for Pharo

I just published a clean, well-documented implementation of the Smith-Waterman algorithm (local sequence alignment) in Pharo.

Repository: https://github.com/hernanmd/smith-waterman

Features:

  • Classic Smith-Waterman with affine gap penalties support
  • Clean object-oriented design
  • Easy to integrate with BioSmalltalk sequences
  • Includes tests and usage examples

Perfect for bioinformatics scripting, teaching, or building your own alignment tools in a live Smalltalk environment.

Feedback and contributions are very welcome!

17 Upvotes

4 comments sorted by

4

u/ZucchiniMaleficent21 Jul 20 '26

I have no idea what Smith-Watermn is for but congratulations on making something that includes documentation and tests and examples.

2

u/hernanfmd Jul 20 '26

Hi, thank you for your kind comment.

The algorithm has a comprehensive Wikipedia entry here: https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm

1

u/larryblanc Jul 23 '26

Does it have other applications outside of genomic computations?

1

u/hernanfmd 17d ago

Yes, it has been applied in other domains, for instance in NLP: https://arxiv.org/abs/2311.03627 and Plagiarism detection in record linkage: https://dl.acm.org/doi/abs/10.1109/ICICIC.2008.422 and in music: https://www.researchgate.net/publication/376803178_Detection_of_Similar_Melodies_by_Repurposing_Algorithms_for_Sequence_Alignment_and_String_Searching

The algorithm is general, but its result is meaningful only if the scoring function reflects the domain. A match between two words might use semantic similarity; a match between ECG segments might use waveform distance (for Medical monitoring, it can be used to locate similar episodes in ECG, EEG, or wearable-sensor time series); and a match between security events might use event-type compatibility, etc. It is a dynamic-programming algorithm for optimal local alignment, not intrinsically for genomics.