NeedlemanWunschAligner.php
Global pairwise sequence alignment by dynamic programming Freely inspired by BioPHP's project biophp.org Created 30 September 2026 Last modified 2 October 2026
Table of Contents
Classes
- NeedlemanWunschAligner
- The classic Needleman-Wunsch algorithm : a (firstLength+1) x (secondLength+1) matrix is filled so that cell (i, j) holds the best score of aligning the first i symbols of the first sequence against the first j symbols of the second one, then the alignment itself is recovered by walking that matrix back from its bottom-right corner to (0, 0). Only a linear (per-gap-symbol) gap penalty is supported ; an affine, opening-versus-extension penalty would need a second matrix and is not implemented here.