Sequence Alignment: How Does It Work?
The animation shows the process of aligning two short sequences. The two sequences slide over one another and any nucleotides that match between the two sequences briefly light up. The sequences slide back and forth until the two sequences have the greatest number of matches.
There are several different computer programs that can generate an alignment. All of them try to maximize the number of matches among all sequences being aligned by changing the positions of the sequences relative to one another and/or by adding gaps.