Entropy is deferred until exact endpoints are known and only for scores in `[K, 3K]`. This keeps KegAlign's result on every tested input (the logarithm is an independent implementation, within 3.4e-14 relative error) while removing composition bookkeeping from the common path.
F.1 — Enter the narrow entropy bandStep 1 of 3
WHAT GOES IN: Exact X-drop total score, threshold K, and the `--noentropy` setting. WHAT HAPPENS: Scores from K through 3K enter entropy correction; higher scores bypass it and lower scores fail. WHAT COMES OUT: A direct decision or one interval requiring composition counts. INVARIANT: The band is closed at both K and 3K, matching KegAlign.
Readable journey
F.1 — Enter the narrow entropy band
- what goes in
- Exact X-drop total score, threshold K, and the `--noentropy` setting.
- what happens
- Scores from K through 3K enter entropy correction; higher scores bypass it and lower scores fail.
- what comes out
- A direct decision or one interval requiring composition counts.
- invariant
- The band is closed at both K and 3K, matching KegAlign.
- Total score → Band check: score + K + setting
- Band check → Direct accept/reject: below K or above 3K
- Band check → Entropy recount: K through 3K
F.2 — Recount matching unambiguous bases
- what goes in
- The closed HSP interval selected by the X-drop maxima.
- what happens
- The warp revisits the interval and counts matching A, C, G, and T pairs in four packed fields.
- what comes out
- Four base-composition counts and their total.
- invariant
- Mismatches, ambiguous symbols, softmask symbols, and positions beyond either maximum do not count.
- Closed HSP → Warp recount: start through start + len
- Warp recount → Warp recount: keep equal unambiguous pairs
- Warp recount → Packed A/C/G/T counts: one reduced count vector
F.3 — Reproduce KegAlign's float boundary
- what goes in
- Total score, composition counts, and `logf(4)` widened to double.
- what happens
- With at least 20 counted bases, normalized entropy scales the score (with fewer, the score stands), then the result follows KegAlign's conversion points before comparison with K.
- what comes out
- An accepted entropy-adjusted score or rejection.
- invariant
- Replacing widened `logf(4)` or the score conversions with mathematically cleaner doubles can change boundary cases.
- Base counts → Normalized entropy: -sum(p ln p) / widened logf(4)
- Normalized entropy → Scaled score: score × entropy
- Scaled score → Threshold K: KegAlign conversion + compare