Skip to content

Methods and checksMethods

How every result is reached and what it was checked against, app by app.

Methods and checks pages

Bit score, E-value and P-value of one local alignment by Karlin-Altschul statistics, version 2.0.0

seq-alignment-significance@2.0.0: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.

What this page can and cannot show

Level: Checked against a reference; Agrees with BLAST+ 2.12.0 blastn at its printed digits; λ and K as given; no sum or composition statistics. Reference kind: our own exact-arithmetic script and a hand-worked case; the source's own worked example, CPython standard library (decimal), 3.13.18.

Checked by this project, not independently reviewed. Every method on this page has its equations, constants, sources and cases on record, and its cases agree with the stated reference within the stated tolerance. A reader can follow each method's worked example by hand; that shows the stated method gives the stated answer for one set of inputs, and does not test the code. The other cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed them.

Every version of this method · Every method · What the levels mean

Version 2.0.0

Level: Checked against a reference; Agrees with BLAST+ 2.12.0 blastn at its printed digits; λ and K as given; no sum or composition statistics. Reference kind: our own exact-arithmetic script and a hand-worked case; the source's own worked example, CPython standard library (decimal), 3.13.18. seq-alignment-significance@2.0.0

Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.

Verification statement: Eq. 1 to 3 and 5 at 60 digits in a script of our own, hand-worked; BLAST+ 2.12.0 blastn's printed E-values and bit scores on 24 BLAST+ runs on 18 sequence pairs (six re-runs of a pair with -searchsp; schemes 2/-3 and 1/-2, both score parities, E from about 90 to 2.6e-167) reproduced to half a unit in their last printed digit, given BLAST's own λ, K, effective lengths and, for E under 2/-3, its score rounded down to even; the tutorial's P of 0.95, 0.993 and 0.99995 reproduced; blastp's Spouge-corrected E-values are not Eq. 1

From a raw score with its lambda and K, or from a bit score, and the query and database lengths as the search used them: the bit score S' = (lambda S - ln K)/ln 2, E = K m n e^(-lambda S) = m n 2^(-S'), computed in log space, and P = 1 - e^(-E) as -expm1(-E); E and P withheld below 1e-300 with log10 E and log10 P given.

  • How results are reported: none: full double precision, unrounded; notes in this order: the length basis (UNCORRECTED_LENGTHS for actual lengths, LENGTH_BASIS_UNKNOWN for unknown), then SHORT_SEQUENCE, raised below 200 residues, the record's hard cut for the tutorial's "about 200"
  • Uncertainty: Double-precision arithmetic in log space on the supplied score, lambda, K and lengths; their own uncertainty, including the precision to which a program prints lambda and K, is not propagated.
  • Reference, as its record states it: NCBI BLAST+ 2.12.0 blastn, 24 BLAST+ runs on 18 sequence pairs (six re-runs of a pair with -searchsp; the outside comparison), with a 60-digit decimal script of our own and the tutorial's printed P values
  • Level confirmed by this project's ruling of 14 November 2026

What this page can and cannot show

What was checked

126 cases in 3 files, linked by this exact version.

Run through the tool at build against our own exact-arithmetic script and a hand-worked case; the source's own worked example, CPython standard library (decimal), 3.13.18: 91 agree within the tolerance the file states, 35 refuse as the case expects, 0 differ, 0 were not run.

  • File 1, 52 cases

    • Where the expected values came from: our own exact-arithmetic script and a hand-worked case
    • Recorded on: 2026-11-14
    • Reference: second implementation (Python 3.13, mpmath), 2026-11-14; licence BSD-3-Clause
    • Tolerance as the file states it: E and P relative 1e-12 (exact below 1e-300, where they are withheld); bit scores absolute 1e-9 bit; log10 values absolute 1e-9; search space relative 1e-15; texts, statuses and codes exact
  • File 2, 70 cases

    • Where the expected values came from: our own exact-arithmetic script and a hand-worked case
    • Recorded on: 2026-11-14
    • Reference: CPython standard library (decimal), 3.13.18; licence PSF-2.0
    • Tolerance as the file states it: E and P relative 1e-12 (exact below 1e-300, where they are withheld); bit scores absolute 1e-9 bit; log10 values absolute 1e-9; search space relative 1e-15; texts, statuses and codes exact
  • File 3, 4 cases

    • Where the expected values came from: the source's own worked example, Altschul SF, The Statistics of Sequence Similarity Scores, NCBI BLAST tutorial, section 'P-values' (read 11 November 2026, page sha256 c869afc7...): 'if one expects to find three HSPs with score >= S, the probability of finding at least one is 0.95'; 'E-value of 5 and 10 ... P-values of 0.993 and 0.99995'
    • Recorded on: 2026-11-14
    • Reference: CPython standard library (decimal), 3.13.18; licence PSF-2.0
    • Tolerance as the file states it: E and P relative 1e-12 (exact below 1e-300, where they are withheld); bit scores absolute 1e-9 bit; log10 values absolute 1e-9; search space relative 1e-15; texts, statuses and codes exact

Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.

What was not checked

BLAST+'s public-domain notice (not yet read, held for the General Counsel); blastp, whose E-values apply Spouge's finite-size correction; how λ and K are derived for a scoring system; sum statistics and composition-based statistics (not reproduced); a program's own edge correction and database length counting.

Definition or model

A closed form: the result follows from the inputs by the equations alone.

Equations

Equation 1

ln E = ln K + ln m + ln n - lambda S (Eq. 1 in log space)
the search space m n is returned as given
S is used as given: BLAST+ 2.12.0 blastn, for gapped schemes whose round_down flag is set (reward 2 with penalty -3, -5 or -7, and 3 with -4), computes E from S rounded down to an even number and the bit score from S itself (blast_hits.c, "Round score down to even number for E-value calculations only", SB-2303), the tool applies no rounding: BLAST+'s E is reproduced by giving it the even score, and its bit score by giving the score as printed
order of checks: the kit's checks of each argument, then CONFLICTING_ARGUMENT for an argument the scoreKind does not use, then MISSING_ARGUMENT (rawScore, lambda, k, parameterSet
or bitScore), then BIT_SCORE_NOT_POSITIVE, in both modes, once S' is known
Symbol Meaning and unit
E expected number of alignments scoring at least S by chance in the search space
S raw score, in the scoring system's units
lambda Karlin-Altschul lambda, per raw-score unit
K Karlin-Altschul K
m query length as the search used it
n database length as the search used it

Source: Altschul SF, The Statistics of Sequence Similarity Scores, NCBI BLAST tutorial, equation Eq. 1, 2, 3 and 5 (images, read as images), section Bit scores; P-values; Database searches; Edge effects, the page as served on 11 November 2026 (no revision shown); read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c869afc786ed. Free to read (NCBI web page; terms not stated on the page (held for the General Counsel)), checked 2026-11-11. No erratum found (searched the page itself, which shows no revision history), 2026-11-11.

Equation 2

S' = (lambda S - ln K) / ln 2 (Eq. 2)
Symbol Meaning and unit
S' bit score, bit

Source: Altschul SF, The Statistics of Sequence Similarity Scores, NCBI BLAST tutorial, equation Eq. 1, 2, 3 and 5 (images, read as images), section Bit scores; P-values; Database searches; Edge effects, the page as served on 11 November 2026 (no revision shown); read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c869afc786ed. Free to read (NCBI web page; terms not stated on the page (held for the General Counsel)), checked 2026-11-11. No erratum found (searched the page itself, which shows no revision history), 2026-11-11.

Equation 3

ln E = ln m + ln n - S' ln 2 (Eq. 3 in log space)
Symbol Meaning and unit
S' bit score, bit

Source: Altschul SF, The Statistics of Sequence Similarity Scores, NCBI BLAST tutorial, equation Eq. 1, 2, 3 and 5 (images, read as images), section Bit scores; P-values; Database searches; Edge effects, the page as served on 11 November 2026 (no revision shown); read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c869afc786ed. Free to read (NCBI web page; terms not stated on the page (held for the General Counsel)), checked 2026-11-11. No erratum found (searched the page itself, which shows no revision history), 2026-11-11.

Equation 4

P = 1 - e^(-E) (Eq. 5): the chance of at least one alignment scoring at least S in this search space under the random-sequence model
Symbol Meaning and unit
P P-value

Source: Altschul SF, The Statistics of Sequence Similarity Scores, NCBI BLAST tutorial, equation Eq. 1, 2, 3 and 5 (images, read as images), section Bit scores; P-values; Database searches; Edge effects, the page as served on 11 November 2026 (no revision shown); read in full on 2026-11-11 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning c869afc786ed. Free to read (NCBI web page; terms not stated on the page (held for the General Counsel)), checked 2026-11-11. No erratum found (searched the page itself, which shows no revision history), 2026-11-11.

Conventions

What each mode computes:

  • scoreKind = raw-score: a raw score with the lambda and K of its scoring system: the bit score by Eq. 2 and E by Eq. 1
  • scoreKind = bit-score: a bit score: E by Eq. 3; no raw score is recovered
  • lengthBasis = effective: the lengths are the effective lengths the program used after its edge correction
  • lengthBasis = actual: the lengths are the sequences' actual lengths, with no edge correction
  • lengthBasis = unknown: whether the lengths were edge-corrected is not known; the reply says what follows either way (LENGTH_BASIS_UNKNOWN)
  • parameterSet = gapped: lambda and K are the program's gapped values; echoed only, the arithmetic is the same
  • parameterSet = ungapped: lambda and K are the program's ungapped values; echoed only, the arithmetic is the same

Constants

Constants: none used.

Worked example

Worked example: one case of seq-alignment-significance@2.0.0, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • scoreKind = raw-score
  • rawScore = 100
  • lambda = 0.25
  • k = 0.125
  • parameterSet = gapped
  • queryLength = 256
  • databaseLength = 1024
  • lengthBasis = effective

Steps

  1. b = 39.067376 bit, from rawScore, lambda, k; by equation 2; gives result.bitScore.
  2. e = 4.5508014e-7, from rawScore, lambda, k, queryLength, databaseLength; by equation 1; gives result.eValue.

The working, as the case writes it:

ln E = ln 0.125 + ln 256 + ln 1024 - 0.25 x 100 = -14.6027922916008203587415181781
S' = (0.25 x 100 - ln 0.125) / ln 2 = 39.0673760222240851839981170250

Answer

  • result.bitScore = 39.067376 bit
  • result.eValue = 4.5508014e-7

Where these values came from: our own exact-arithmetic script and a hand-worked case; Worked by hand by Drybench on 11 November 2026 (R10). This is not an independent check.

At build the tool returned this answer within the tolerance the file states: E and P relative 1e-12 (exact below 1e-300, where they are withheld); bit scores absolute 1e-9 bit; log10 values absolute 1e-9; search space relative 1e-15; texts, statuses and codes exact.

Who worked this case: not recorded.

What it refuses, and its input ranges

  • BIT_SCORE_NOT_POSITIVE: a bit score of zero or below puts E at or above the search space, outside the regime the statistics describe Next: Check the bit score; give the raw score with lambda and K if that is what you have.

Flags and notes a reply may carry

A note a reply may carry:

  • UNCORRECTED_LENGTHS: Lengths not corrected for edge effects: the tutorial states that the statistics then tend to be somewhat conservative for short sequences.
  • LENGTH_BASIS_UNKNOWN: Whether the lengths were corrected for edge effects is not stated. If they are actual lengths, the tutorial states that the statistics then tend to be somewhat conservative for short sequences; if they are the effective lengths a program used, E here is on that program's search space.
  • SHORT_SEQUENCE: A length is below about 200 residues, where the tutorial says the edge-effect correction stops being negligible.

Changes

2026-11-14-seq-alignment-significance@2.0.0-1

2026-11-14 · seq-alignment-significance@2.0.0 · Corrections to our methods

  • What was wrong: For lengths of unknown basis the reply gave the note UNCORRECTED_LENGTHS, which states that the lengths were not corrected for edge effects, something the caller had not said. In raw-score mode a raw score whose bit score is zero or below was computed, although the method's own refusal condition covers it. log10 P was formed from the rounded P, so where P is near 1 it lost its relative precision (0 in place of about -8.4e-23 at E = 50).
  • Affected: Version 1.0.0 of the assistant tool seq_alignment_significance: the notes on unknown lengths, raw scores with a bit score of zero or below, and log10 P where E is above about ln 2. E, P and the bit score did not change.
  • What changed: In 2.0.0 unknown lengths get their own note, LENGTH_BASIS_UNKNOWN, worded conditionally; the raw-mode refusal applies once the bit score is known; log10 P is computed by log1p where P is near 1. The record states the note order and BLAST+ blastn's rule of computing E from the score rounded down to even under some schemes, and BLAST+ 2.12.0 blastn is recorded as an outside check on 24 alignments.
  • How it was found: A second implementation in Python by a separate agent of the same model family, in the raising run's full check of 14 November 2026 (finding SEQ-F8), and the CSO's review of the same run (S109 to S116).
  • Cases added: stored reference values and stored reference values re-record the retired -1 and -2 at 2.0.0, with the raw-mode refusal either side, both length-basis notes, P near 1 and 24 BLAST+ blastn alignments.

Tools that use it

Cite this version

Bit score, E-value and P-value of one local alignment by Karlin-Altschul statistics. Drybench; seq-alignment-significance@2.0.0; https://www.drybench.com/methods/m/seq-alignment-significance/2.0.0 (accessed [date]).