# kmer.bio — Protein Read Identification Benchmark v2 (reproduction kit)

This kit reproduces the evaluation published in **"Identifying the protein
read across the full identity range"** (the paper v5): 983 truth sources and
979 target-decoy negatives drawn deterministically from the complete
Swiss-Prot release 2026_03, four read tracks (five read conditions in the
truth table), verdict semantics frozen before a single evaluation run.
Everything here verifies offline, today, with Python 3.10+ and no
dependencies — the one step that calls the identification service uses the
public API (the free anonymous door covers the benchmark run; below).

## What is in the kit

| File / directory | What it is |
|---|---|
| `fixtures/` | The frozen truth sets — **14 FASTA files** (four member tracks — 7,771 reads — and ten decoy files: eight distinct blocks — the nanopore and six-class tracks at 1×/5×/30×, the recognizer and dye at 1× — plus the two byte-identical `_d1` duplicates of the 1× blocks; 7,735 distinct reads, 15,506 in total), the per-read truth (`truth.tsv` — five read conditions; the six-class track is a projection of the nanopore reads, same source and window), the per-read identity bin of the recognizer-class track (`identidad.tsv`), and the truth-set manifest with the sha256 of every fixture |
| `genera_truthset.py` | The sampling driver — re-derives the 983 sources, their windows, the decoy construction, the four-source exclusion and the per-read seeds from the public Swiss-Prot release and the frozen master seed, and verifies them against the shipped truth set |
| `submit.py` | The submission client — sends every fixture track to the kmer.bio identification API (reads plus panel name) and records one verdict per read |
| `metrics.py` | The evaluation — recomputes every τ table of the paper from a verdict file: both precision conventions, the frozen operating-point rule (members + decoys), coverage, recall, F1; the verdict semantics are pinned by self-tests. `--v4` recomputes the v4 run's band table (the calibrated gate, out-of-fold) from the shipped verdicts |
| `expected/` | Our frozen results — the exact kernel's τ tables (the baseline, `tau-tables-*.txt`), its operating points and identity-vs-coverage record, the v4 run's tables (`v4-band.tsv`, `v4-strata.tsv`, `v4-wire.tsv`, `v4-operating-points.md`, and the per-read verdicts `v4-verdicts.tsv`), the frozen criteria (`criteria.md` — the grid, the four criteria, the comparison rule, the two-fold calibration), and the paper v5's external comparison (`v5-external/`: the MMseqs2's per-read top-1 records against the panel and the library, and the whatprot's dye-track records, with their zero-FP points) |
| `verdicts/` | Where `submit.py` writes your run's verdicts (empty until you run it) |

## The tracks (fixtures → paper)

| Fixture | The paper's name | Reads |
|---|---|---|
| `nano_full20.fa` | Full 20-residue alphabet — nanopore consensus at depths 1×/5×/30× (ids `nano_d1_…`, `nano_d5_…`, `nano_d30_…`) | 2,949 |
| `nano_dayhoff6.fa` | Six-class projection of the same reads | 2,949 |
| `qsi_v3.fa` | Recognizer classes — today's kit (the current commercial recognizer alphabet: 6 classes covering 13 residue types) | 983 |
| `fluoro.fa` | Dye track — two symbols (U = unlabeled, L = labeled, ? = failed cycle); detected tracks only, the paper's declared denominator | 890 |

The decoy blocks: `decoy_full20*.fa` and `decoy_dayhoff6*.fa` (per depth),
`decoy_qsi_v3.fa` (979 — the four-source exclusion), `decoy_fluoro.fa` (882).

## The corpus of record, and the exclusion

Four of the 983 windows are dominated by a single recognizer class. Inverting
such a window reproduces the window — the inverted string is the same string
— so the inversion is not a negative at all. Their decoys are not emitted;
the members stay byte-identical. The corpus of record is **983 members and
979 decoys**, and the low-complexity regime is declared outside the
benchmark's scope (the paper's §6.4).

## What is reproducible, and what is not

- **The tables: yes, offline.** `metrics.py` applies the frozen grid to the
  per-read verdicts `(id, accession, containment)` — it consumes the engine's
  outputs, it does not implement the engine.
- **The verdicts: no, not without the service.** `submit.py` asks the
  identification API for them; the kit ships ours, frozen, as the expected
  outputs.
- **The construction: never in the kit.** No parameter, no formula, no
  internal column travels here. The verdict file is behavior, not mechanism.

## How to run it

1. **Verify.** `python genera_truthset.py verificar <uniprot_sprot.fasta>`
   re-derives the sampling design from the public library and checks every
   fixture checksum against the manifest.
2. **Recompute the paper's tables.** `python metrics.py --v4` prints the band
   table of the v4 run from `expected/v4-verdicts.tsv`; diff it against
   `expected/v4-band.tsv` (byte-identical is the determinism check).
3. **Submit your own run.** `python submit.py --todo` sends every fixture
   track to the service (the public API's free anonymous door — 600 credits a
   day — covers the benchmark run; write to info@kmer.bio for a key on larger
   runs) and records the verdicts; then
   `python metrics.py --truth fixtures/truth.tsv --miembros verdicts/qsi_v3.tsv
   --decoys verdicts/decoy_qsi_v3.tsv` recomputes the τ tables.
4. **Compare.** Against `expected/`: the frozen rows are the reference.

## The provenance

Every fixture's sha256 is in `fixtures/truthset.manifiesto`; the expected
files' sha256 are in `expected/PROVENANCE.md`. The library: Swiss-Prot
release 2026_03, 575,748 proteins, 209,017,843 residues, CC-BY-4.0.
