What an alignment does
An alignment lines two sequences up so that matching positions sit in the same column. Where one sequence has extra bases or residues, gaps (-) are put in the other. The result shows where the two agree, where they differ and where something was inserted or deleted.
Align two sequences
- Open Pairwise Align and choose DNA or protein.
- Paste the two sequences.
- Read the alignment with the identity, number of gaps and score underneath.
Both tools align the sequences end to end, a global alignment. That suits two versions of the same gene or protein. To find a short piece inside a long sequence, a pattern search is the better tool.
Gaps and scores
Each match adds to the score and each mismatch and gap takes away from it. Opening a gap costs more than making an existing one longer, which is called an affine gap penalty. It reflects biology: one insertion of six bases is more likely than six separate insertions of one. Protein alignments score mismatches with the BLOSUM62 matrix, which treats swaps between similar amino acids, such as leucine and isoleucine, as nearly matches.
Identity vs similarity
Identity is the percentage of aligned positions that are exactly the same. Similarity, for proteins, also counts positions with chemically similar amino acids. Two proteins can be 40% identical and 60% similar. For several sequences that are already aligned, Identity and Similarity gives the figures for every pair.
A small example
ACGTTGCA
ACG-TGCA
The second sequence is missing one T. Seven of the eight columns match, and the gap shows where a base was inserted in one or deleted in the other.
Identity depends on what you divide by
Seven matches can be reported as 7 ÷ 8 = 87.5%, counting every column of the alignment, or as 7 ÷ 7 = 100%, counting only the shorter sequence. Different programs choose differently, so state which one you used when comparing figures.
Common problems
- A short sequence is stretched with gaps. A global alignment forces both sequences to align end to end. For a fragment inside a longer sequence, use a local alignment or a search.
- A sequencing read barely aligns. It may come from the other strand. Reverse complement it and align again.
- Distant genes align poorly as DNA. The protein changes more slowly than the DNA, because many base changes are silent. Translate both and align the proteins.