tcren documentation#
tcren is a Python re-implementation (and extension) of the TCRen method for structure-based
prediction of T-cell-receptor recognition of epitopes. From one TCR–peptide–MHC structure
(experimental or modelled) it parses and annotates the complex — TCR chains via
arda, MHC chains mapped against a curated reference and
the groove partitioned — orients it into a canonical frame, computes residue contacts, and scores
every candidate epitope with a residue-level statistical potential derived from TCR:pMHC crystal
structures.
Where the original TCRen scored only TCR↔peptide contacts, this version scores all three interfaces (TCR↔peptide with TCRen, TCR↔MHC and peptide↔MHC with Miyazawa–Jernigan) for the full binding picture, and adds mutation ΔΔG, binder ranking for AI-generated models, pose refinement, and interface mechanics.
What tcren does#
Assess a modelled complex –
assess: is the pose real, is it a binder, and which part of the structure says so? Five read-outs of one frozen object, every one defined for a single structure (tcren.score, see Assessing a modelled complex).Score & rank epitopes –
score/rank/scoring: TCRen energy per candidate, a percentile rank against a random background, and the three-interface breakdown plus total.Mutation ΔΔG –
ddg: alanine scans and neoantigen substitutions on the native contact map (virtual-matrix, no re-docking).Interface descriptors –
features: one flat per-structure table of 164 catalogued descriptors in six families, four of them computed by default (see Interface feature reference).The fit-free predecessor tier –
recognize:Q(interface geometry),T(footprint shape) and their composition with the contact energy,S(see A kit for AI-generated TCR–pMHC structures). None of them is fitted, and each is defined for a single structure.Annotation & contacts –
annotate/contacts: TCR CDR/FR, MHC groove helices/floor and peptide markup; multi-layer (5/8/12 Å) contact tables.Canonical orientation –
orient/superimpose: one common MHC frame, docking angles, reverse-dock detection.Peptide substitution & refinement –
refine: backbone-preserving substitution plus a DOPE-scored Monte-Carlo pose refinement (with CCD/OpenMM/ProMod3/FlexPepDock engines), and--repackto place every side chain in the χ rotamer DOPE prefers.Surface topology –
surface: the pMHC face a TCR meets before it binds, as a height field over the groove with hydropathy and charge painted on, plus the scalars that make “featureless” a number (relief,peak_to_valley,frac_above_ridge) and a map distance that clusters epitopes;--side tcrrasters the receptor underside in the same frame, andsurface_complementarityscores shape, charge and hydropathy agreement between the two faces (tcren.topology.surface).Backbone dynamics –
tcren.peptide_stability(): flexible-backbone Metropolis Monte Carlo of the peptide’s φ/ψ against DOPE, reporting how far the peptide wanders rather than a better pose – whether its own side chains hold the TCR-facing conformation, which a contact potential scoring a single handed-in pose cannot see (tcren.mechanics.dynamics).Potential derivation –
derive-potential: re-derive the TCRen potential (classic/AM/LOO, with non-redundancy filtering) from a structure set.Contact-map Potts model –
potts fit/score/contacts: a Boltzmann distribution over the contact map itself, whose sites are the residue pairs that could have contacted. Gives a structure’s map an energy (neg_energy, the termSreads), a partition function and a likelihood, and every residue pair a contact probability (tcren.potts, see Contact-map Potts model).QC, mechanics & maps – steric-clash and register checks, an interface spring-network / rupture model, and 2D complementarity maps + 3D pocket/CDR views.
Note
Ranking, not affinity. TCRen ranks peptide/TCR specificity for a given receptor; it is not a
binding-affinity model. On the ATLAS SPR benchmark neither the raw contact energy nor its
poly-alanine difference (tcren.energetics.mutation.reference_delta()) predicts Kd/ΔG/koff/kon (ρ ≤ 0.3 in
magnitude). The
one affinity-adjacent quantity a static structure predicts is the off-rate koff, via interface
mechanics (tcren.mechanics) — not the contact sum.
Contents
- Getting started
- Assessing a modelled complex
- Interface feature reference
- Metadata that ships with a structure set
- Options
- Columns the reliability score reads
- Families, and which descriptors involve the receptor
- The gap between the two faces
- Two views of the same descriptors
- The alanine scan, on both sides
- Core recognition descriptors (40)
- Interface quality — clashes & contact stability
- CDR3-frame descriptors (18) —
--full - The intra-peptide term (
--full) - Scores
- Every descriptor, with its units
- Structure summary (oracle)
- Potentials
- Contact-map Potts model
- Why a reference state of available pairs
- Why the couplings
- Fitting needs no partition function
- Scoring does, and it is exact at the reference
- Bound versus unbound, for the whole interface
- Constraining a statistic of the whole configuration
- Shipped models
- Which potential belongs on which interface
- Three limits of one free energy
- Reproducing a referenced score
- Command line
- Substituting a residue: the free energy, not the frequency
- API
- Beyond the contact sum
- What a contact potential can and cannot express
- Peptide conformational stability: what a contact model cannot see
- Side-chain repack: what a local minimiser cannot do
- Footprint shape: what the contacts say before they are scored
- Surface topology: what a TCR meets before it binds
- Ring stacking: the geometry an identity cannot carry
- Reliability: scoring one modelled structure
- A kit for AI-generated TCR–pMHC structures
- Figure gallery
- Performance
- API reference
Tutorials
- Ranking receptors for a fixed epitope — the 22-cohort VDJdb panel
- Ranking peptides for a fixed receptor — combinatorial peptide libraries
- 2D complementarity maps
- 3D peptide-binding pocket with CDR overlay
- The canonical TCR-pMHC frame — figures & summary
- PyMOL renders of canonically-oriented TCR–pMHC complexes
- Contact thresholds & bond types across all region pairs
- MHC pseudosequence (MPS) vs. peptide contacts
- Example — GILGFVFTL / HLA-A*02:01 and the CDR3β Arg–Ser motif
- tcren · pMHC surface topography
- TCRen potential & contact-statistics analysis