Pairwise protein alignment
Global Needleman–Wunsch alignment of two protein sequences with BLOSUM62 and affine gaps.
Global Needleman–Wunsch alignment of two protein sequences with BLOSUM62 and affine gaps.
A pairwise alignment lines up two protein sequences residue by residue, inserting gaps where one sequence has an insertion or deletion relative to the other, so that homologous positions sit in the same column. This tool performs a global alignment with theNeedleman–Wunsch algorithm: both sequences are aligned along their full length, which is the right choice for comparing two proteins that are homologous from end to end, such as orthologues from different species or two members of the same family.
The algorithm fills a matrix in which each cell holds the best score for aligning the firsti residues of one sequence with the first j of the other. Each cell is the maximum of three moves: aligning two residues (the diagonal, scored from the substitution matrix), or placing a gap in either sequence (scored with the gap penalties). Tracing back from the final cell gives the optimal alignment. The version here uses Gotoh's affine gap formulation, so long gaps are scored correctly.
BLOSUM62 gives every pair of amino acids a score derived from substitution frequencies in conserved blocks: identical residues score high (W/W is 11, A/A is 4), conservative changes score positive (I/L is 2, D/E is 2), and unlikely changes score negative (W/G is −2, C/E is −4). It is the default matrix in BLAST and suits sequences from roughly 30 % to 90 % identity. The gap open penalty is paid once per gap and thegap extend penalty for each further column, so a single 5-residue gap at the defaults costs 10 + 4 × 1 = 14, less than five separate 1-residue gaps at 50.
Identity is the fraction of alignment columns with the same residue in both sequences. Similarity adds columns where the two residues differ but have a positive BLOSUM62 score, the same rule BLAST uses for "positives". Both use the full alignment length, including gap columns, as the denominator. Theidentity and similarity calculator gives the same numbers for an alignment you already have, and reports all pairs of a multiple alignment.
Global alignment (Needleman–Wunsch) aligns two sequences end to end, so every residue of both is placed, with gaps where needed. Local alignment (Smith–Waterman) finds only the best-scoring region shared by the two sequences and ignores the rest. Use global for full-length homologues and local for finding a shared domain in otherwise different proteins.
Opening a gap costs the gap open penalty once; every additional column in the same gap costs the smaller gap extend penalty. This affine scheme prefers one long gap over many short ones, which matches how insertions and deletions happen in evolution. The defaults of 10 and 1 with BLOSUM62 are the values BLAST uses for protein searches.
The score is the sum of the BLOSUM62 values of every aligned residue pair, minus the gap penalties. It has no meaning on its own; it is only comparable between alignments of the same sequences with the same scoring scheme. Percent identity and similarity are the numbers to report.
Needleman–Wunsch returns the highest-scoring alignment under the chosen scheme. Lower gap penalties let the algorithm insert more gaps to line up matching residues, raising identity but often producing biologically unrealistic alignments. Higher penalties give compact alignments with fewer gaps.
The algorithm needs memory proportional to the product of the two lengths. Two sequences of 2,000 residues each align in well under a second in the browser; above about 5,000 residues each the page may become slow. Nothing is uploaded.