How VDJmatch scores a receptor#
All routes start with anchored junctions, chain identities and V genes. They retain reference peptide–MHC labels and query identity. Ordinary annotation keeps exact evidence; a benchmark filters exact query hits while keeping the reference model fixed.
Fast reference classification#
Index preparation classifies reference structure, separately by species/chain and pooled epitope or observed full pMHC. It uses reference labels, never query assay outcomes. Eligibility is at least 30 valid source observations; counts of distinct junction/V keys remain separate. All observations and pair links stay in the saved model. These descriptive classes do not establish binding or select a scoring default.
Let the population contain \(K\) distinct full-junction/allele-pooled-V keys. Each key retains its complete binary target-membership vector, including shared labels. For a target with \(N\) keys, let \(n_v\) count its V-gene keys and \(q_v=K_v/K\) be the population V distribution. The gene statistic, in bits per target key, is
The background includes the target, as in the fixed-cohort label-shuffle comparison. Every observed category consequently has population support; no pseudocount or zero-frequency extrapolation is needed. Unresolved V calls retain their mass and prevent a biological class assignment.
Tokenize the junction after trimming three residues at each end, retaining each exact amino-acid 3-mer once per key. For motif \(t\) within V gene \(v\), let \(a_{vt}\) count target presence and \(A_{vt}\) population presence. Write \(p_{vt}=a_{vt}/n_v\) and \(q_{vt}=A_{vt}/K_v\). The sequence statistic is the strongest enriched binary projection:
An empty maximum is zero; \(0\log 0=0\). Motif depletion does not supply positive motif evidence. The V weight expresses one projection in bits per target key; it does not sum correlated, overlapping motifs. Stable lexical V/motif order resolves exact ties. The selected motif and its four presence counts remain visible.
Two independent fixed random streams (seed 0) generate 199 shuffles. For \(G\), permute complete membership vectors over population keys. For \(M\), permute those vectors only within V genes. Target sizes and all shared-membership relationships remain fixed; the latter null also fixes every target’s V composition. Recompute the same maximum over motifs in each replicate, so choosing the best motif is part of the null statistic.
For either observed statistic \(S\) and shuffled values \(S_b\), report
Support requires \(\Delta S>0\) and \(p_S\le0.005\); with 199 draws, this requires exceeding every shuffled value. Ties count against support. Under the respective exchangeability nulls these Monte Carlo tails are conservative; allocating 0.005 to each of two axes bounds the per-profile probability of falsely supporting either true-null axis by 0.01, without an independence assumption. This does not control errors across every database profile, remove study/ascertainment bias or calibrate selected query calls. Effects and null maxima are shown even when support is absent.
The two support flags define V-and-motif, V-only, motif-only and no-supported-axis leaves. Missing V is assigned reproducibly from the same population’s resolved gene frequencies before label shuffling, independently of target membership; original key identities and missingness counts remain fixed. With no resolved V, one neutral missing category carries no V-usage signal. Missing background and inadequate distinct support remain unclassified. A small effect measured precisely can pass its noise test while remaining weak for prediction. Neighbour coverage and edit-one pair-density enrichment are separate structural descriptors; pair counts share vertices and are not independent binomial observations.
Implementation reuses the core tokenizer, fixed sparse key/target membership and key/V-motif presence matrices. Identical target memberships are reduced once. Shuffles perform count reductions only; no sequence search, SW, Pgen calculation or reference-model refitting occurs inside them. The completed class table and native search index are durable prepared-reference assets; query predictions are not reused.
Current kernel evidence#
Larger kernel_score means stronger evidence. A linked score compares both
chains against the same linked reference receptor. Separate alpha and beta
scores also use unlinked reference observations. The score is not itself a
P-value. Score definitions gives the mathematical definitions of retained variants.
Conditional-rank evidence#
This retained alternative measures distance ranks relative to the declared background. Component probability bounds belong to their original statistics; they do not calibrate the conditional refinement or a selected antigen label.
Legacy scoring routes#
historical-density reproduces the retained density model. match is a
separate older annotation interface. Neither should be described as the current
annotate default, and their probability fields cannot be transferred to the
kernel score.
From ranking to a match decision#
The null asks whether an unrelated query would achieve at least this selected score. All searched labels, ties and unsupported null queries belong in that calculation. Paired any-axis calls require a null for the maximum over linked, alpha and beta evidence. See Read scores and decide whether to call a match for the output fields.
Reference structure for scoring weights#
reference-structure exports morphology and exact exclusion effects;
combine-evidence --three-channel normalizes the components and applies explicit
weights. Solid stages are implemented. Dashed stages remain the scoring
investigation: the reference-to-weight rule and final selection calibration need
verification before adoption. Neither command reads query binding labels.
Database presence and a label-independent P-value#
database-evidence tests unusual junction resemblance to any database entry
under the supplied null law. It retains exact matches and includes the full
database search in the null statistic. Its P-value ignores V/J and cannot be
transferred to epitope or paired recognition; the exact gene-clonotype flag is a
separate lookup. The chosen scoring pipeline’s p_null answers a different
question about its selected evidence score.
Single-control directional calibration#
The preceding --null-sample graph describes the legacy diagnostic.
The on-demand --control workflow computes both conditional directions:
The scoped nearest/count adapter and independent-chain paired sampler are implemented. Full VDJmatch-score, selected-label and paired search adapters must repeat their complete statistic, including reference-derived weights, inside the null calculation. See Two directions of control calibration for the equations, event/unique-key distinction and dependence-safe maximum proof.