Skip to content
Tutorials Center
My learning

Topics

Lesson 16 of 49 ยท Sequence Alignment

Multiple sequence alignment

Learn multiple sequence alignment: why it is hard, progressive alignment with guide trees, tools such as MAFFT and Clustal Omega, conservation, consensus and information content.

Aligning two sequences tells you how those two relate. Aligning many sequences of the same family tells you something deeper: which positions the family has kept unchanged for hundreds of millions of years and which it has allowed to wander. A residue that is identical in a human enzyme, a yeast enzyme and a bacterial enzyme is almost certainly essential to the protein's job. A multiple sequence alignment (MSA) arranges three or more sequences in a table so that each column holds residues believed to descend from one ancestral position. It is the raw material for conservation analysis, motif discovery, structure prediction and the phylogenetic trees of the next chapter.

Five protein sequences stacked in columns with conserved columns shaded and a bar chart of conservation
Caption: in a multiple alignment each column is a hypothesis about a shared ancestral position; fully conserved columns (dark teal, asterisk) are the likeliest functional sites.

What you will learn

  • Why exact multiple alignment is impractical and how progressive alignment works.
  • The roles of the guide tree, iterative refinement and consistency.
  • How to measure conservation, build a consensus and compute information content.
  • Common tools, file formats and the importance of inspecting an alignment.

Key terms

  • Column: a position in the alignment, believed to be homologous across the sequences.
  • Guide tree: a tree that decides the order in which sequences are merged.
  • Profile: a table giving, for each column, the frequency of every residue.
  • Consensus: the most common residue in each column.
  • Information content: a measure, in bits, of how strongly a column prefers particular residues.

Why it is hard

The dynamic programming of the previous lessons extends to k sequences, but the matrix becomes k-dimensional. For three sequences of length 300 you would fill 27 million cells, for ten sequences 5.9 ร— 10^24. Finding the optimum of the usual objective, the sum of pairs score (add up the pairwise scores of every pair of residues in every column), is in fact NP-hard in the number of sequences. Practical MSA software therefore uses heuristics, and it is important to understand that every MSA program returns a good alignment, not the provably best one.

Progressive alignment

The dominant idea, due to Feng and Doolittle (1987) and popularized by the Clustal programs, is to build the alignment step by step:

  1. Compute all pairwise alignments (or fast approximations of them) and turn the similarities into distances.
  2. Build a guide tree from those distances with a clustering method (UPGMA or neighbor-joining, which you will implement in chapter 4).
  3. Following the tree from the leaves toward the root, align the most similar sequences first, then align their result against the next closest sequence or group, and so on. When two groups are aligned, each group is treated as a profile, and the alignment compares columns against columns.

The method is fast and works well, but it has a classic weakness: "once a gap, always a gap." An early mistake between two close sequences is frozen and can never be corrected by later, more informative sequences. Modern programs reduce this problem in two ways. Iterative refinement (MUSCLE, MAFFT) repeatedly removes a sequence or a group, realigns it against the rest of the alignment and keeps the change when the score improves. Consistency-based scoring (T-Coffee, ProbCons, and in a different form MAFFT's L-INS-i) uses the information in all the pairwise alignments, so that two sequences are aligned in a way that agrees with how both align to the third.

Tools you will meet

  • Clustal Omega: the modern successor of ClustalW, designed to scale to thousands of sequences.
  • MAFFT: very fast, with strategies from FFT-NS-1 (quickest) to L-INS-i (most accurate for sequences with a few conserved domains).
  • MUSCLE (version 5): iterative, accurate for moderately sized sets.
  • T-Coffee: consistency-based, slower, strong for small, difficult sets.
  • PRANK: phylogeny-aware, handles insertions and deletions in an evolutionary manner, valuable before analyses of selection.

Alignments are saved as aligned FASTA (the same format as FASTA, with - characters for gaps), Clustal format (blocks with conservation symbols), Stockholm (used by Pfam), or PHYLIP (used by older phylogeny programs). Viewers such as Jalview and AliView let you color residues by property and inspect columns.

Conservation, consensus and information

Once you have an alignment, you can read its columns. The conservation of a column is the frequency of its most common residue. The consensus sequence lists that most common residue per column, often marking fully conserved columns. A profile (or position-specific scoring matrix, PSSM) stores the whole frequency distribution of each column and can be used to search for more family members: PSI-BLAST works this way.

Biologists often summarize a profile as a sequence logo, where each column's stack height shows its information content and each letter's height its share. The information content of a column, in bits, is log2(A) - H, where A is the alphabet size (4 for DNA, 20 for protein) and H is the Shannon entropy of the column, H = -sum(p_i * log2(p_i)). A fully conserved DNA column has H = 0 and so carries 2 bits; a column with all four bases equally likely carries 0 bits. For proteins the maximum is log2(20) โ‰ˆ 4.32 bits. (Small alignments need a correction because few sequences underestimate the entropy.)

Quality matters

An alignment is a model, not data. Check it: look for stretches that are mostly gaps, for sequences that do not belong (a fragment or a contaminant stretches the whole alignment), and for regions where the alignment looks arbitrary. Before phylogenetic analysis, ambiguous regions are often removed with trimming tools such as trimAl or Gblocks, although aggressive trimming also discards signal. Try two programs, or two settings, and see whether the conclusions you care about survive.

Practical advice

For a new data set, start with MAFFT in its automatic mode, look at the result in a viewer, and note any region that looks suspicious. If the sequences have a conserved core and variable ends, try the local-pair strategy; if there are many hundreds of sequences, use the fast strategies first and refine later. Always remove fragments and obvious contaminants before aligning, because one bad sequence can disturb the whole table. Save the alignment together with the command that produced it, so that the analysis can be repeated.

Common misconceptions

  • "The MSA is a fact." It is an inference. Different programs can produce different alignments of difficult sequences, and downstream results can change.
  • "More sequences always give a better alignment." Adding distant or poor sequences can make the alignment worse; quality and diversity matter more than count.
  • "A fully conserved column is functionally important." It is suggestive, but conservation can also reflect close relatedness or sampling bias.
  • "Gaps are errors." Gaps record insertions and deletions, often meaningful, but they can also mark misalignment.

Try it

Python Conservation, consensus and information content

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python A guide tree from pairwise alignments

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Color an alignment by residue property

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is the purpose of the guide tree in progressive alignment?

    The most similar sequences are aligned first, following the tree from leaves to root.
  2. 2. What does 'once a gap, always a gap' warn about?

    Progressive alignment freezes early gaps; iterative refinement and consistency scoring mitigate this.
  3. 3. A DNA column has all four bases equally frequent. What is its information content?

    Entropy is 2 bits, so information = log2(4) - 2 = 0.
  4. 4. What is a consensus sequence?

    Consensus lists the most frequent residue per column.
  5. 5. Why try more than one alignment program for a difficult set?

    If conclusions survive different alignments, they are more trustworthy.

Summary

  • Exact MSA is NP-hard, so programs use progressive alignment with guide trees, iterative refinement and consistency.
  • Columns are hypotheses of shared ancestry; conservation, consensus, profiles and logos summarize them.
  • Information content is log2(alphabet size) - entropy.
  • Inspect and, if needed, trim alignments before downstream analysis.

Next: Chapter 3 review