The three types of alignment—Local, Global and Semi-Global—are actually quite similar, although they can often produce very different results. All use a method called dynamic programming to find the best scoring alignment between two sequences. Alignment scores are computed by adding up per-base match scores and subtracting a penalty for opening a gap (of any length) and another for the number of positions that have gaps. The match scores are based on a scoring matrix such as NUC42 or BLOSUM62. It’s always a good idea to explore the effects of various settings of these three parameters to see if you can get a more desirable outcome.

Depending on your two sequences, the three methods can potentially yield widely different results, so it’s important to understand how they differ.

Local Pairwise Alignment:

MegAlign Pro’s local alignment algorithm, a modernized variant of the one described by Smith-Waterman (1981), is designed specifically to find the highest scoring aligned segments of two sequences, even if the full extent of the two is not included in the final alignment. (Note: in MegAlign Pro, the “Show Context” check-box in the Style Panel lets you display any unaligned parts of the sequences flanking the aligned segments).

Global Pairwise Alignment:

The alternative to locally aligning is to align globally. To do this MegAlign Pro uses two variants of the Needleman and Wunsch (1970) algorithm. Global aligners don’t try to find the best scoring segment, but instead require that the full extent of both sequences be included in their results. There is no requirement or guarantee that the best scoring pair of aligned segments from a local alignment will be aligned in a global alignment.

Semi-Global Pairwise Alignment:

Semi-global alignment is a relatively new approach that is particularly suitable when the two sequences differ greatly in length. When that happens, the longer sequence will have overhangs on either end of the alignment. Since overhangs are represented with gaps, a global aligner will attempt to increase the match score and minimize accumulated gap penalties by aligning parts of the shorter sequence to overhanging sequence region(s). This effect can produce a number of unrealistic, usually small aligned segments spaced by gaps near the ends of the alignment. Semi-global alignment is designed to address this problem by not penalizing gaps in overhangs (aka “end gaps”).


The differences between these three pairwise approaches really can make an impact in the resulting alignment, but the choice of which to use really depends on your task. For basic cases, such as aligning two genes or proteins, Local alignment is a good starting point, but when things get more complicated, Global or Semi-Global may be the way to go. We have included three tutorials to demonstrate some of the differences between these methods.

Need more help with this?
Contact DNASTAR

Thanks for your feedback.