TCR clustering tools compared: GLIPH2, tcrdist3 and ClusTCR

How three open tools group T cell receptor sequences, compared from their papers and documentation. Plus what is left to do once you have clusters.

Three open tools dominate the conversation about grouping T-cell receptor (TCR) sequences: GLIPH2, tcrdist3 and ClusTCR. They all take TCR repertoire data and return groups of similar receptors, but they define "similar" differently and fit different workflows. This page describes each tool from its published paper and documentation, compares them side by side, and explains what is still left to do once you have clusters.

Full disclosure up front: our team contributed to earlier versions of ClusTCR, and we develop our own derivative, ImmuneWatch ClusTCR, which runs inside the ImmuneWatch Analyser. The descriptions of the three open tools below stick to what their papers and documentation state.

What TCR sequence clustering is used for

A T cell recognises its target through the TCR, and the CDR3 region of that receptor is the part that varies most between clones. TCRs that recognise the same epitope often have similar CDR3 sequences. Clustering exploits this: it groups similar CDR3 sequences so that you can analyse groups of receptors that probably share a target, instead of thousands of individual sequences.

In repertoire data analysis, clustering is typically used to:

  • Find signal that single clonotypes hide. A response spread over many related clones is easier to see as one cluster.
  • Look for shared specificity across donors. Similar TCRs in different people can point at a common antigen.
  • Reduce a repertoire to a manageable number of units before annotation, comparison between conditions or biomarker work.

Every clustering tool has to decide what counts as similar, which sequences are compared, and how groups are drawn from the similarities.

The tools, one by one

GLIPH2

Approach. GLIPH2 (Grouping of Lymphocyte Interactions by Paratope Hotspots) builds on the original GLIPH algorithm. It groups TCRs into specificity groups using two kinds of similarity: local, based on CDR3 motifs that are enriched compared with a reference repertoire, and global, based on CDR3 sequences that differ by a limited number of amino acids. It scores each group and can test it for enrichment of shared HLA alleles among donors, which supports HLA restriction inference. The GLIPH2 paper describes it as an improved algorithm that can process millions of TCR sequences.

Inputs and outputs. TCR beta-chain CDR3 amino acid sequences, with optional V gene, donor, HLA and clone count information. Output is a set of convergence (specificity) groups with scores and member sequences.

Runtime and availability. The authors provided compiled standalone versions for macOS and Linux with the paper, and a web tool has been associated with it. immGLIPH is an independent R implementation of GLIPH and GLIPH2 (MIT licence).

tcrdist3

Approach. tcrdist3 is a Python toolkit built around TCRdist, a biochemically informed distance between TCRs that compares the CDR regions of the receptor rather than the CDR3 alone. It computes pairwise distances for alpha, beta, paired alpha/beta and gamma/delta receptors. The tcrdist3 paper builds on these distances to define meta-clonotypes: groups of biochemically similar TCRs defined by a centroid TCR and a distance radius.

Inputs and outputs. A table of clonotypes with CDR3 sequences, V and J genes, counts and subject identifiers (a pandas DataFrame). Output is distance matrices and radius-based neighbours that you can feed into your own clustering or classification steps. It is a toolkit, so the grouping step is yours to build.

Runtime and availability. Python, installable with pip or Docker, MIT licence. The README describes numba-accelerated code and a sparse-matrix mode that computes distances within a chosen radius in chunks, to keep memory use manageable on large data.

ClusTCR

Approach. ClusTCR is a two-step clustering approach. A fast first step (the Faiss library) groups sequences into broad superclusters based on physicochemical properties. A second step (Markov Clustering, MCL) then refines each supercluster using a graph in which two CDR3 sequences are connected when they differ by at most one amino acid. The paper reports benchmark accuracy similar to other TCR clustering methods, measured by cluster retention, purity and consistency, with much higher speed.

Inputs and outputs. CDR3 amino acid sequences as a pandas Series, with optional alpha-chain and V gene information. Output is cluster assignments, plus functions for exploring and visualising the clusters.

Runtime and availability. Python 3, installed through conda (Linux and macOS; a GPU build is available). Published by the University of Antwerp group that ImmuneWatch was spun out of (Valkiers et al., 2021). Licence terms are in the repository.

Comparison table

GLIPH2tcrdist3ClusTCR
MethodLocal (CDR3 motif) and global (sequence) similarity, with group scoringBiochemically weighted distance across CDRs; meta-clonotypes from centroid and radiusTwo steps: Faiss superclusters, then MCL graph clustering
ChainsTCR beta (per the paper and immGLIPH)Alpha, beta, paired, gamma/deltaCDR3 beta by default, optional alpha and V gene
Typical inputCDR3b, optional V gene, donor, HLA, countsTable of CDR3, V/J genes, counts, subjectsSeries of CDR3 sequences
OutputScored specificity groups, optional HLA enrichmentDistance matrices, neighbours, meta-clonotypesCluster assignments, cluster exploration functions
Language and runtimeStandalone executables (macOS, Linux); R via immGLIPHPython (pip, Docker)Python 3 (conda, GPU build)
Scalability, as stated by the authorsPaper: processes millions of TCR sequencesREADME: numba acceleration, sparse chunked distance modeREADME: 1 million CDR3 sequences in under 5 minutes on a standard 8-CPU machine
AvailabilityPaper supplement; immGLIPH (R)Open on GitHubOpen on GitHub
Primary referenceHuang et al., Nat Biotechnol 2020Mayer-Blackwell et al., eLife 2021Valkiers et al., Bioinformatics 2021

Scalability figures come from each tool's own paper or documentation and were measured on different hardware and data. This page does not rank the tools on speed or accuracy.

Which tool fits which situation

  • You want specificity groups with HLA hints from beta-chain data across donors. GLIPH2 was designed for this, with motif-based and global similarity plus HLA enrichment scoring.
  • You want a flexible distance measure to build your own analysis. tcrdist3 gives you biochemically informed distances for alpha, beta, paired and gamma/delta data, and a Python API to build on, for example meta-clonotypes or nearest-neighbour classification.
  • You need to cluster very large CDR3 sets quickly. ClusTCR was built for speed at the million-sequence scale, with benchmark accuracy reported as comparable to other methods.
  • You are working with paired single-cell data. tcrdist3 handles paired chains natively; ClusTCR accepts an alpha chain alongside the beta chain.
  • You work in R. immGLIPH offers an R route to GLIPH2.
  • Your project is commercial. Check each tool's licence terms in its repository before you build on it.

Your own data, chain type and downstream question matter more than any general ranking, and each paper is worth reading before you commit.

What clustering output alone leaves to you

All three tools return groups, distances or scores. That is the first half of a TCR analysis. The second half is work you do around the tool:

  1. Labelling clusters. A cluster tells you that sequences look alike, not what they recognise. To label it, you match it against a database of known TCR-epitope pairs.
  2. Choosing cut-offs. Distance radii, minimum cluster sizes and score thresholds all shape what you see, and the sensible values depend on your data.
  3. Tracking across time points. In immunomonitoring you want to know which clusters appear or expand after therapy. Clustering tools work on the sequences you give them; the longitudinal logic (pre versus post, patient by patient) is yours to script.
  4. Combining with expansion data and producing figures. Turning cluster tables into plots a team can read is usually a notebook project.

None of this is a shortcoming of the tools. GLIPH2, tcrdist3 and ClusTCR are clustering tools, not annotation tools, and they are built to be steps in a pipeline.

The ImmuneWatch Analyser: clustering, annotation and tracking in one run

The ImmuneWatch Analyser packages the second half of that pipeline for scientists who would rather not build it. You add your repertoire files and a simple metadata sheet (patient, time point, sample type) to your organisation's private, encrypted workspace, and it runs, in one go:

  • ImmuneWatch ClusTCR clustering. ImmuneWatch's own derivative of ClusTCR. TCRs share a cluster when they have the same V gene and differ by at most one amino acid in the CDR3 relative to a central CDR3.
  • ImmuneWatch DETECT annotation. DETECT annotates antigen specificity against IMWdb, ImmuneWatch's curated TCR-epitope database (more than 2,400 epitopes and more than 200,000 TCRs), and shows the reference TCRs behind each prediction. DETECT ranked first in the independent IMMREP23 benchmark.
  • Post-therapy cluster detection. An ImmuneWatch ClusTCR variant that uses your pre/post design to find clusters that only appear after treatment or vaccination.
  • Expansion analysis. Pinpoints the individual clonotypes that expanded over time.

All of it sits in a no-code web interface with interactive plots and shareable reports. If you want full control over clustering parameters in your own scripts, the tools above remain the right choice. If you want to see which T cells respond to a therapy without building the pipeline, this is what the Analyser is for. The demo workspace comes loaded with a synthetic cancer vaccine dataset.

Prefer the command line? Add annotation with ImmuneWatch DETECT

If you already have a clustering pipeline and want to keep it, you do not need the Analyser. ImmuneWatch DETECT is the annotation step on its own, as a command line tool that slots in after GLIPH2, tcrdist3 or ClusTCR:

  • Annotates antigen specificity of your TCRs against IMWdb, our curated database of TCR-epitope pairs. DETECT ranked first in the independent IMMREP23 benchmark.
  • Shows its evidence. Every prediction lists the reference TCRs it is based on, so you can check the match yourself.
  • Runs locally. Install it with Docker on your own machine or server; your data never leaves your infrastructure.
  • Works on alpha and beta chains, and on gamma and delta chains too.

Academic users get 10 free credits per month. Read the documentation or see DETECT.

Related tools: repertoire processing and analysis packages

Clustering is one step in a larger toolchain. These packages come up in the same searches and do different jobs:

  • MiXCR processes raw sequencing reads into clonotypes. The Analyser reads MiXCR output files.
  • immunarch is an R package for repertoire analysis and visualisation.
  • scirpy is a Python package for single-cell TCR and BCR data, built around the scverse ecosystem.
  • VDJtools is a Java framework for post-analysis of repertoire data.

They are data-processing and analysis packages, not annotation tools, and they can sit before or alongside a clustering tool.

References

  1. Huang H, Wang C, Rubelt F, Scriba TJ, Davis MM. Analyzing the Mycobacterium tuberculosis immune response by T-cell receptor clustering with GLIPH2 and genome-wide antigen screening. Nat Biotechnol. 2020;38(10):1194-1202. doi:10.1038/s41587-020-0505-4
  2. Glanville J, Huang H, Nau A, et al. Identifying specificity groups in the T cell receptor repertoire. Nature. 2017;547:94-98. doi:10.1038/nature22976
  3. Borcherding N. immGLIPH: an R implementation of the GLIPH and GLIPH2 algorithms. GitHub
  4. Mayer-Blackwell K, Schattgen S, Cohen-Lavi L, et al. TCR meta-clonotypes for biomarker discovery with tcrdist3 enabled identification of public, HLA-restricted clusters of SARS-CoV-2 TCRs. eLife. 2021;10:e68605. eLife
  5. Dash P, Fiore-Gartland AJ, Hertz T, et al. Quantifiable predictive features define epitope-specific T cell receptor repertoires. Nature. 2017;547:89-93. doi:10.1038/nature22383
  6. tcrdist3 repository and documentation. GitHub · Read the Docs
  7. Valkiers S, Van Houcke M, Laukens K, Meysman P. ClusTCR: a Python interface for rapid clustering of large sets of CDR3 sequences with unknown antigen specificity. Bioinformatics. 2021;37(24). doi:10.1093/bioinformatics/btab446
  8. ClusTCR repository and documentation. GitHub · Docs
  9. IMMREP23 benchmark of TCR-epitope specificity prediction (2024). doi:10.1016/j.immuno.2024.100045
  10. Related packages: MiXCR · immunarch · scirpy · VDJtools

Common questions
about outsourcing TCR analysis

FAQ

They define similarity differently. GLIPH2 combines CDR3 motif enrichment and global sequence similarity and scores each group. tcrdist3 computes a biochemically weighted distance between TCRs across their CDR regions and leaves the grouping to you. ClusTCR groups CDR3 sequences in two steps, a fast Faiss step followed by MCL graph clustering on sequences one amino acid apart.

Each tool reports scalability in its own way, on different data and hardware. The GLIPH2 paper states it can process millions of sequences, the tcrdist3 README describes a sparse chunked mode for large data, and the ClusTCR README reports 1 million CDR3 sequences in under 5 minutes on an 8-CPU machine. No independent ranking is cited here, so test on your own data.

No. GLIPH2, tcrdist3 and ClusTCR group similar receptors. You still need to match clusters to a database of known TCR-epitope pairs and decide on cut-offs. Annotation tools such as ImmuneWatch DETECT, which has its own database (IMWdb), do the matching.

The demo workspace at try.app.immunewatch.ai is free and comes with a synthetic cancer vaccine dataset so you can explore every feature. To analyse your own data, choose a plan on the Analyser page.

Go from clusters to the T cells that respond

Explore clustering, DETECT annotation, post-therapy clusters and expansion analysis on a synthetic cancer vaccine demo dataset. Free, and ready in a minute.

Prefer the command line? See ImmuneWatch DETECT