Score global prefixes
The alternatives are a symbol pair, a gap in one sequence or a gap in the other. g is a positive cost and is therefore subtracted.[1]
Global alignment uses both complete sequences. Aligning a nonempty prefix against an empty one requires the corresponding number of gap columns rather than free zero initialization.[1]
An interior cell stores the best score for its prefix pair. Optimal substructure justifies the maximum recurrence: every alignment ends with one of the three alternatives. Replacing its preceding part with a better valid prefix path would increase the total score. After filling the table, tracing back from its final cell yields an optimal global alignment. Ties can produce multiple optimal paths.
Local Smith–Waterman alignment instead allows a zero restart and searches for matching subsequences. Do not silently insert that reset into this global recurrence. Protein substitution matrices, affine gap costs and special terminal-gap rules also change the precise model.[1]
Score, identity and coverage are different
I is the dimensionless fraction and I% its numerical percentage. The denominator here is the positive integer total of all alignment columns, including one-sided gaps. Double-gap columns do not belong in a valid alignment.[1][2]
Identity requires exactly equal symbols. Distinct amino acids can still receive a positive substitution score, which concerns scoring or similarity. Coverage describes how much of the entire query occurs in the alignment. A short fragment with 100 percent identity can thus cover only a small part of the query. Ambiguity codes additionally require checking the program’s identity and scoring definitions.[1][2]
A high score is not a probability of homology. The BLAST E-value reference explains how local scores are assessed against chance hits under an appropriate search model. Its local statistics cannot automatically assess arbitrary global alignments. Homology also concerns common ancestry, not necessarily identical present-day function.[3]
Two complete global examples
ACT versus AGT without a gap
- Given
- Match +2, mismatch −1 and gap cost g=2. Sequences ACT and AGT.
- Find
- Determine global score and separate percent identity.
Separate the scoring and counting rules.
Score aligned pairs A/A, C/G and T/T.
Use all three columns as denominator.
Result: Global optimum score is 3 and identity about 66.67 percent. The linear recurrence yields the same final cell; two matching pairs do not imply 66.67 percent probability of shared function.
Check: The matrix ends at F33=3. Replacing a mismatch with two additional gaps costs at least 4 points and does not improve this alignment.
ACGT versus AGT with a necessary gap
- Given
- Same scoring rules. Consider global alignment ACGT against A−GT.
- Find
- Check score, identity and optimality for these two short sequences.
Use the same complete definition as in the first example.
The four columns are A/A, C/gap, G/G and T/T.
Retain the gap column in the denominator.
Result: The alignment scores 4 with 75 percent identity. The shorter sequence contains only 3 symbols, and global alignment requires at least one gap; the upper score bound is 6−2=4 and is attained.
Check: 3/4 counts all columns; 3/3 excludes the gap and uses a different denominator definition.
Recall the method later with the formula’s flashcards.
11 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Gap conventions and multiple optima
This explicitly declared affine convention charges o for the first gap position and e for each additional one. Other software writes a+bk; equivalent parameters satisfy a=o−e and b=e. Do not transfer unchanged numbers between differently defined opening penalties.[1]
The cell calculator here uses linear costs only. Affine recurrence needs additional states for opening versus extending a gap. Even an optimal score need not determine a unique identity: for AG versus GA with match +2, mismatch 0 and gap cost 1, the ungapped alignment has score 0 and identity 0. AG− versus −GA also scores 0 but has one matching pair among 3 columns. Both are optimal under precisely these rules: order prevents two matches, and one match requires two gap columns.
When comparing percentages, document the actual alignment, scoring rules and denominator. These short strings are original teaching examples. Long biological comparisons additionally require an appropriate algorithm, transparent parameters and, where applicable, a separate significance analysis.[1][3]
Five tasks on recurrence and interpretation
Calculate · Foundation
Diagonal predecessor 2, above 0, left 0; current mismatch score −1 and positive gap cost 2. Find the new cell.
Show hint
Score the three alternatives first.
Learning goal: Compute one interior global table cell.
Show solution and calculation
F=max(2−1,0−2,0−2)=max(1,−2,−2)=1.
This maximum is a score, not a probability.
Rearrange · Application
An alignment has 12 columns and 75 percent identity. How many exact symbol matches does it contain?
Show hint
75 percent is fraction 0.75.
Learning goal: Translate identity percentage into an admissible match count.
Show solution and calculation
Nmatch=0.75·12=9.
Check 9/12=0.75.
Actual counts must be integer; a rounded percentage need not uniquely identify an exact match count.
Interpret · Application
10 exact matches among 12 columns, including 2 gap columns. Compare identity including all columns versus excluding gaps.
Show hint
Observations are unchanged; only the counting rule changes.
Learning goal: Distinguish changed denominator from biological change.
Show solution and calculation
Including all columns 10/12≈83.33 percent.
Excluding gaps 10/(12−2)=100 percent.
Different denominators prevent comparison without stating the convention.
Error analysis · Application
Global alignment A versus T; mismatch −1, gap cost 2. A program resets F11 to zero. Check using F00=0 and F10=F01=−2.
Show hint
The global maximum here contains no extra zero alternative.
Learning goal: Distinguish global initialization from local zero reset.
Show solution and calculation
F11=max(0−1,−2−2,−2−2)=−1.
Zero would be a local restart, outside this global recurrence.
Transfer · Challenge
A length 3 gap uses o+e(k−1) with o=5, e=1. Someone transfers 5 and 1 unchanged to a+bk. Compare costs and correct the equivalent parameters.
Show hint
Rewrite o+e(k−1) as o−e+ek.
Learning goal: Distinguish two affine-parameter conventions.
Show solution and calculation
First convention: 5+1·2=7.
Unchanged a=5, b=1 gives 8.
Equivalent a=4, b=1 yields 4+3=7.
This is a parameter-definition difference; the linear cell calculator implements neither affine multistate recurrence.
Check your understanding with the formula’s reference test.
7 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Sources for this explanation
Quanta · Updated November 1, 2026
- Biopython, Pairwise sequence alignment: global/local modes, scoring and aligned-column length
- NCBI, BLAST Command Line Applications User Manual, Appendices: alignment length, identity and output fields
- NCBI, The Statistics of Sequence Similarity Scores: local scores, bit scores, database searches and P-values
- Needleman and Wunsch (1970), A general method applicable to the search for similarities in the amino acid sequence of two proteins, J.Mol.Biol.48,443–453; historical origin
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Explained global linear recurrence, initialization and identity denominator; distinguished gap conventions and ambiguity with two examples and five tasks.
Cite this reference page
Quanta. Sequence Alignment: Score and Identity. Updated November 1, 2026. https://quanta-study.de/en/formula-sheet/sequenzalignment-score-identitaet
When citing a specific scientific statement, also cite the specialist source linked to that statement.