Local alignment finds the best matching subregion instead of forcing the full sequences to align end to end.

highlighted = computed this step

Local alignment clamps negatives to zero

Local alignment resets any negative cell to 0. That lets a bad prefix disappear instead of forcing the full sequences into an end-to-end alignment.

cell=max(0,diag,up,left)\text{cell}=\max(0,\text{diag},\text{up},\text{left})
Local alignment matrixSmith-Waterman resets negative scores and traces back from the highest cell.TTAAGGTTAAGG000000000000110000000120000000003100000001420

Traceback starts at the highest cell

Instead of starting at the corner, local traceback starts at the highest cell and stops when the score returns to 0. Here the shared region AAGG aligns with AAGG and scores 4.

local score=4\text{local score}=4
Local alignment matrixSmith-Waterman resets negative scores and traces back from the highest cell.TTAAGGTTAAGG000000000000110000000120000000003100000001420

Local alignment models a matching subregion

Local versus global is a modelling choice, not a universal truth. Use local alignment when only a region is expected to match, and use global alignment when the full sequences should align.

local=best matching subregion\text{local}=\text{best matching subregion}
Local alignment matrixSmith-Waterman resets negative scores and traces back from the highest cell.TTAAGGTTAAGG000000000000110000000120000000003100000001420