Local and global alignment answer different questions. Global alignment compares two sequences from end to end. Local alignment finds the best matching region inside them.
Global alignment
Global alignment forces the two sequences to align across their full length. Every base is either matched, mismatched or placed in a gap. It is the right choice when the sequences are expected to be homologous over their whole length, for example two alleles of the same gene or two closely related proteins.
The cost is that unrelated or extra sequence at either end must be absorbed into gaps. If one sequence has a long unshared tail, global alignment penalises it heavily and may distort the alignment of the shared region.
Local alignment
Local alignment finds the highest-scoring substring pair. It can start and end anywhere and ignores the rest. It is the right choice when you expect a shared domain, a conserved exon or a short motif inside longer sequences.
The cost is that the alignment may cover only a small part of the input. A local alignment score is not a statement about the whole sequence; it describes the best region. Two proteins can have a strong local match in one domain and no similarity elsewhere.
Semiglobal and overlap alignment
Semiglobal alignment is a family of compromises. Overlap alignment is useful when one sequence is a fragment of the other or when reads are assembled. Glocal alignment forces one sequence to align fully while allowing the other to be trimmed.
Many tools expose these as options rather than separate algorithms. Read the option names carefully. "Free end gaps" on one sequence is not the same as free end gaps on both.
Scoring
An alignment score is the sum of match rewards, mismatch penalties and gap penalties. Changing the scoring scheme changes the alignment. A high gap-open penalty favours long contiguous alignments, while a low penalty favours many small gaps.
For proteins, substitution matrices such as BLOSUM or PAM encode the probability of one amino acid replacing another. For DNA, simple match/mismatch scores are common, but transitions and transversions may be weighted differently. The scoring scheme should match the evolutionary distance you expect.
What the score means
A raw score is not comparable across different scoring schemes, sequence lengths or databases. A bit score normalises the raw score, and an E-value estimates how often a score that high would appear by chance in a database of a given size. A high score and a low E-value are related but not identical.
For a local alignment, a low E-value means the best local match is unlikely by chance. It does not mean the entire sequences are homologous. For a global alignment, the score describes the full-length comparison, but it still depends on the scoring parameters.
Choosing in practice
- Use global alignment for alleles, orthologues and sequences expected to share their full length.
- Use local alignment for domain searches, motif discovery and database searches.
- Use semiglobal or overlap alignment for fragments, reads and assemblies.
- Check both ends of the alignment and the gap pattern, not only the score.
- Report the algorithm, scoring scheme and gap penalties.
A worked comparison
Take a short exon embedded in two longer sequences. A global alignment may spread gaps across the unshared flanks and produce a modest score. A local alignment may find the exon with a high score and ignore the flanks. Both are correct answers to different questions.
If the biological question is "are these two transcripts the same isoform", global alignment of the shared region is appropriate. If the question is "does this protein contain a known domain", local alignment is appropriate. State the question before choosing the algorithm, and the result becomes much easier to interpret.
Gap penalties and scoring
A gap penalty has two parts: the cost of opening a gap and the cost of extending it. A high opening penalty favours fewer, longer gaps; a low opening penalty allows many short gaps. The choice changes the alignment and the score.
Substitution matrices assign scores to matches and mismatches. A matrix tuned for closely related sequences rewards identity; a matrix tuned for distant homologues allows more conservative substitutions. Using the wrong matrix can hide a real relationship or create a spurious one.
Report the matrix, the gap penalties and any filtering. An alignment score without the scoring scheme is not reproducible.
A practical check is to align a known pair at two reasonable settings. If the alignment of the functional region is stable, the conclusion is more robust. If the region moves or the gap pattern changes, the result depends on the parameters and should be described as such. Record both settings in the methods so a reader can see the sensitivity check. A result that survives a reasonable change is stronger than one that depends on a single parameter combination alone, and it is a useful habit to report the check.
Key points
- Global aligns end to end; local finds the best region.
- Semiglobal and overlap are useful for fragments.
- Scoring changes the result.
- Raw scores are not comparable across schemes.
- A local hit does not prove full-length homology.
Common mistakes
- Using global alignment on sequences with long unshared tails.
- Reading a local score as a whole-sequence similarity.
- Comparing raw scores from different tools.
- Ignoring gap penalties when interpreting an alignment.
- Reporting an alignment without the scoring scheme.
When to ask for help
If an alignment looks implausible, if the score changes sharply with a small parameter change, or if you need to compare sequences of very different lengths, ask for a review. You can order an analysis or read the BLAST results guide. The free pairwise alignment tool runs local and global comparisons, and the Sequence Analysis studio adds dotplots and translation.
Sources and further reading
Written by the Solagene team for research and education. Found an error? Tell us and we will correct it.