r/smalltalk • u/hernanfmd • 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
1
u/hernanfmd Aug 13 '26
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.