BLAST E-value calculator
Turns a raw or bit score into an E-value with the Karlin–Altschul equation, length correction included.
Turns a raw or bit score into an E-value with the Karlin–Altschul equation, length correction included.
The E-value of an alignment is the number of alignments at least this good that the search would be expected to turn up by chance alone. An E-value of 10 means ten such matches are expected from random sequence, so the hit says nothing; an E-value of 1e-20 means chance would need twenty orders of magnitude more searching to produce it, so the similarity is almost certainly real. Because it counts chance events rather than measuring similarity, the E-value depends on how much sequence was searched, not only on the alignment itself.
S is the raw alignment score from the substitution matrix, m the query length,n the total length of the database, and λ and K the two statistical parameters of the scoring system. The scores of the best local alignments between unrelated sequences follow an extreme value (Gumbel) distribution, and this equation is its tail: every extra point of raw score divides the expected number of chance hits by e to the power of λ, while doubling the database doubles it.
The raw score S is in whatever units the matrix happens to use, so a score of 120 means nothing until you know which matrix produced it. The bit score normalises it: it is the raw score expressed in bits of information, with λ and K already folded in. Two searches with different matrices can be compared through their bit scores, and the same bit score in a database twice as large simply gives twice the E-value. A bit score of about 50 is the usual rough threshold for a meaningful protein hit.
The E-value is an expected count and can be any positive number; the P-value is the probability that at least one chance hit reaches this score, so it can never exceed 1. Chance hits are close to a Poisson process, which gives the relation above. Below E = 0.01 the two agree to better than 1 percent, which is why BLAST reports only the E-value.
A high-scoring alignment needs a certain number of residues to build up its score, so it cannot begin in the last few positions of a sequence. That unusable margin is thelength adjustment ℓ, sometimes called the expected alignment length. It is subtracted from the query once and from every one of the N database sequences, which is why a database of many short sequences loses far more of its length than one long chromosome. The relation is circular, since ℓ depends on the corrected lengths, so it is solved by iteration.H is the relative entropy of the scoring system in nats: the average information per aligned pair.
Skipping this correction makes E-values from short queries look several times better than they are. The Search space tab reports ℓ and the effective search space on their own.
A 350-residue query is searched with BLOSUM62 and gap costs 11 and 1 against a database of 2 × 10⁸ residues in 570,000 sequences, and the best alignment scores 120. With λ = 0.267, K = 0.041 and H = 0.140 the length adjustment comes to 148, so the effective query length is 202 and the effective database length 1.16 × 10⁸, an effective search space of2.34 × 10¹⁰ letter pairs, a third of the raw 7.00 × 10¹⁰.
The bit score is (0.267 × 120 − ln 0.041) / ln 2 = 50.83 bits, and the E-value is 2.34 × 10¹⁰ × 2^(−50.83) = 1.17 × 10⁻⁵. The P-value is the same to three digits, because at this size 1 − e^(−E) and E are indistinguishable. To reach E = 0.01 in the same search, a raw score of 94.7, which is 41.1 bits, would be enough.
| Scoring system | λ | K | H (nats) |
|---|---|---|---|
| BLOSUM62, gaps 11/1 | 0.267 | 0.041 | 0.140 |
| BLOSUM62, ungapped | 0.3176 | 0.134 | 0.401 |
| blastn, match +1 mismatch −3, ungapped | 1.374 | 0.711 | 1.31 |
Gapped and ungapped statistics differ a great deal, and λ falls while K rises when gaps are allowed, so use the pair that matches how the alignment was made. BLAST prints the values it used at the foot of its report; paste them into the custom fields if your matrix or gap costs are not listed. For the information content of a substitution matrix itself see thescoring matrix calculator, and for the entropy of a sequence or an alignment column the Shannon entropy tool.
Every substitution matrix is a table of log-odds. Each score compares how often a pair of residues is aligned in the alignments the matrix was built from, its target frequencyqij, with how often the same pair turns up between unrelated sequences, pipj:
Run backwards, with λ the positive root of Σ pipje^(λ sij) = 1, the equation recovers the frequencies hidden in any matrix. Their diagonal adds up to theimplied percent identity: the identity of the alignments the matrix is tuned to find. The result's Details bar shows both, for the scoring system chosen under the result, against the Robinson and Robinson background.
| Matrix | λ ungapped | Implied identity | H (nats) |
|---|---|---|---|
| BLOSUM62 | 0.3178 | 30.2% | 0.402 |
| blastn, +1 / −3 | 1.374 | 98.8% | 1.31 |
BLOSUM62 is aimed at pairs about 30% identical, which is why it is the sensible default for distant protein homologs and why BLOSUM80, built from more similar blocks, is better on close ones and worse on far ones. The nucleotide +1/−3 scheme is aimed at alignments about99% identical, the near-exact matches megablast looks for, and a mismatch costing three times a match is what forces that. Target frequencies are a property of the ungapped statistics of a matrix, so with gapped parameters selected the λ here (0.3178 for BLOSUM62) is not the gapped λ of 0.267 used for the E-value above.
The relative entropy H falls out of the same table, H = Σ qij ln(qij ÷ pipj), and it is the H the length correction above uses: 0.402 nats per aligned pair for BLOSUM62, against 1.31 for the nucleotide matrix, which is the information a single aligned pair is worth. A matrix with a small H carries less per position, so ℓ grows and more of every sequence is given up before an alignment can score.
A raw score comes from an alignment. TheSmith-Waterman aligner gives the optimal local score for a pair of sequences, which is exactly the quantity this equation was derived for, and theNeedleman-Wunsch aligner gives the global one. Note that Karlin-Altschul statistics describe local alignment; a global score has no E-value of this kind.
For a protein search against a large database, an E-value below 1e-5 is normally treated as a real homolog and anything below 1e-3 as worth a closer look. Values near 1 are what you expect to see by chance and mean nothing on their own. The cut-off is not absolute: a short but exact match, a low-complexity region or a small database all shift what a given E-value is worth.
The E-value is the expected number of hits at least this good that chance alone would produce in this search. The P-value is the probability of seeing at least one such hit, which is 1 minus e to the power of minus E. Below about 0.01 the two are almost equal; above that they diverge, because a P-value can never exceed 1 while an E-value can be 50.
Because the E-value is proportional to the search space. Doubling the database doubles the number of chance hits at any score, so it doubles the E-value. The bit score does not change, which is why bit scores are the right thing to compare between searches and E-values are not.
They are the two statistical parameters of the scoring system. Lambda is the natural scale of the raw scores, which converts a score into units of information, and K is a constant that corrects for the correlation between overlapping alignments. Both depend on the substitution matrix, the gap costs and the background residue frequencies, and both are computed once for each scoring system rather than for each search.
Every matrix implies one. Its target frequencies q_ij, recovered as p_i p_j e^(lambda s_ij), say how often each pair of residues should be aligned, and the diagonal of that table adds up to the identity the matrix is tuned for. BLOSUM62 comes to 30.2% identity at its ungapped lambda of 0.3178, which is why it works on distant homologs; the blastn +1 / -3 scheme comes to 98.8%, which is why it is used for near-exact nucleotide matches. Both are shown under Details, with the most frequent pairs.
An alignment needs room to reach a high score, so a match cannot start in the last few residues of the query and still be long enough to matter. The length adjustment removes that unusable margin from the query and from every database sequence before the search space is computed. On short queries the correction is large and ignoring it makes E-values look far too significant.