Triangular Spatial Relationship (TSR)
An alignment-free method for comparing 3D protein structures. Every triangle formed by a structure's Cα atoms is encoded as an integer "key", and the structure is represented by its distinct keys and how often each occurs.
Read the paper: Development of a TSR-Based Method for Protein 3-D Structural Comparison With Its Applications to Protein Classification and Motif Discovery (opens in a new tab)Frontiers in Chemistry, 2021

On this page
Overview
The Triangular Spatial Relationship (TSR) method is an approach for comparing 3D protein structures, designed to overcome the limitations of existing structural comparison techniques. Each triangle of Cα atoms receives an integer "key" that encodes its three residue labels and the classes its angle and longest edge fall into, so different triangles can share a key. By representing a protein structure as its distinct keys and their frequencies, TSR provides a comprehensive and efficient way to analyse structural similarities and substructures without needing superimposition or complex alignment.
Key generation process
- Cα atom selection. TSR begins by selecting Cα atoms from the protein's PDB file as vertices for triangle construction.
- Triangle construction. All possible triangles formed by these Cα atoms are generated, with their edge lengths and internal angles calculated.
- Label assignment. Each Cα is assigned an integer identifier (ranging from 4 to 23) which uniquely represents the amino acid. This ensures that identical triangles across different proteins are assigned the same integer identifiers.
- Key calculation. The identifiers for each triangle are transformed to create labels (li1, li2, li3). Using a rule-based formula, distances and specific angles are determined, which are then used in equations to generate an integer key for each triangle. Triangles with the same labels and the same angle and distance classes receive the same key.
A 3D structure
Ubiquitin, PDB entry 1UBQ, chain A, drawn as a flat projection of its backbone.
Selected points
One Cα atom per residue: 76 points. Atomic methods use heavy atoms; cross methods take points from two named sides.
Triangles
Every three points form a triangle: 70,300 here. One is followed: Val70, Ile44, Leu8.
Labels and geometry
The labels order the vertices L1, L2, L3, and θ is measured on the base, L1–L2. maxDist is the longest edge: here L2–L3, not the base.
Classes and one key
θ and maxDist are each binned into a class. The three labels and the two classes are encoded as one integer key.
Count and compare
A structure is described by which keys occur and how often. Structures are compared through the keys they share.
Worked example
The triangle followed in the figure, Val70–Ile44–Leu8 of 1UBQ chain A, as BioTSR 1.0.0 computes it.
- Vertices, in label order
- L1 Val70 (label 20), L2 Ile44 (label 10), L3 Leu8 (label 8)
- Base, L1–L2
- 7.78 Å
- L1–L3
- 6.56 Å
- L2–L3
- 11.96 Å, the longest edge, so maxDist
- θ
- 136.7° measured towards L2, folded to 43.3°
- θ class
- 11 of 29: 42.64° to under 45.17°
- Distance class
- 5 of 35: 11.00 to under 14.00 Å
- Key
- 17,637,781
The base is chosen by the vertex labels, so it need not be the longest edge, and here it is not: the base is 7.78 Å and maxDist is 11.96 Å.
A key records the labels and the two classes, not the whole triangle. 4 triangles in 1UBQ have this one: their θ lies between 43.3° and 44.4° and their longest edges between 11.0 and 13.2 Å, but their bases run from 7.8 to 12.2 Å.
How the key is encoded
The key is one mixed-radix integer. The labels are digits of base 30: 19·30² + 9·30 + 7 = 17,377. That is weighted by the 35 distance classes and the 29 angle classes, and the two classes are added in, each counted from 0: 17,377·35·29 + 4·29 + 10 = 17,637,781.
All 4 triangles with key 17,637,781
| Triangle (L1–L2–L3) | Base, L1–L2 | L1–L3 | L2–L3 | maxDist | θ |
|---|---|---|---|---|---|
| Val70–Ile44–Leu8 | 7.78 Å | 6.56 Å | 11.96 Å | 11.96 Å | 43.3° |
| Val5–Ile61–Leu56 | 12.24 Å | 13.22 Å | 5.60 Å | 13.22 Å | 43.7° |
| Val17–Ile61–Leu15 | 10.63 Å | 6.20 Å | 13.11 Å | 13.11 Å | 44.4° |
| Val70–Ile36–Leu71 | 11.02 Å | 3.83 Å | 8.70 Å | 11.02 Å | 44.0° |
The first row is the triangle in the figure. The longest edge is a different edge in different rows, and the shapes differ; what the four share is their labels, their θ class and their distance class.
See it in 3D: Four triangles, one key lets you rotate ubiquitin and switch between the four triangles of this example.
Distinguishing features
- No structural superimposition. TSR avoids rotation and translation issues, unlike RMSD-based methods, enabling more consistent structural comparison.
- Shape representation. By using triangles — the simplest form to capture shape — TSR effectively identifies local substructures.
- Amino acid integration. The inclusion of amino acid information ensures that triangles with the same geometric properties but different amino acids are assigned different keys.
- Motif discovery. TSR allows for the discovery of shared substructures, from simple triangles to complex motifs, by identifying connected triangles through shared vertices or edges.
Applications
- Structural comparison. TSR quantifies protein similarity based on the number of identical keys, providing insight into protein relationships.
- Motif search. Capable of identifying unique and conserved motifs across protein families.
- Conformational analysis. TSR can capture protein conformational changes and differentiate between homologous and non-homologous structures.
Run it with BioTSR
BioTSR computes protein Cα TSR keys for one chain with one command. To install it, download ubiquitin and compute the keys of its chain A:
python -m pip install "biotsr==1.0.0"
biotsr fetch 1UBQ --pdb-dir structures
biotsr run --method protein --pdb structures/1UBQ.pdb --chain A --output resultsThis writes results/1UBQ_A_protein.keys, with every key of the chain and how
often it occurs, together with the list of triangles and two records of how the
result was computed. Getting started explains each
file and sets up a virtual environment first. New to BioTSR?
Learn BioTSR has an interactive lesson and a guided notebook
built on this example.
Amino acid grouping, mirror images, size filtering and secondary structure
annotation are options of this same command rather than separate programs.
Tutorial 01
shows the first three, and
tutorial 03
the secondary-structure annotation. For many structures, biotsr batch runs a
CSV manifest
(tutorial 05);
for an HPC cluster, the
command-line guide, §12
has example Slurm job scripts.
Residue labels in BioTSR
In the published method, each Cα is labelled with one of 20 codes, 4 to 23, one for each standard amino acid. BioTSR keeps those 20 codes and adds codes 24 to 33 for ten modified residues, such as phosphothreonine (TPO) and phosphoserine (SEP); selenomethionine (MSE) takes methionine's code. The three labels of a triangle are encoded at radix 30, so two different combinations of residue labels never produce the same key. Keys computed under this scheme are compared only with keys computed under the same scheme.
How BioTSR differs from the earlier implementation
BioTSR has no option to reproduce the output of TSR-Package, the method's first implementation. For protein Cα TSR its documentation lists four differences from that program:
- angles are divided by π, where the earlier program used the literal 3.14, which moves some triangles across an angle-class boundary;
- the highest of the 35 distance classes can be reached, where the earlier program had 34 in effect;
- grouped labels are encoded at radix 30 rather than within the 20-label space;
- modified residues written as
HETATMrecords, such as TPO and SEP, are read as points, where the earlier program readATOMrecords only.
The SSE-TSR method record, §7 gives the details, and the known limitations, §1 the general rule.
Source code
BioTSR (opens on GitHub)
Current software
Used by the examples on this page.
Licence Apache License 2.0
TSR-Package (opens on GitHub)
Earlier implementation
The method's first implementation. It is kept unchanged for provenance and for work that depends on it; its README has its own installation instructions.
Licence MIT License