ANARCII: A Generalised Language Model for Antigen Receptor Numbering

Alexander Greenshields‐Watson, Parth Agarwal, Sarah A. Robinson, Ben H. Williams, G. Gordon, Henriette Capel, Yushi Li, Fabian C. Spoendlin, Broncio Aguilar-Sanjuan, Fergus Boyles, Charlotte M. DeanebioRxiv 2025

TL;DR

This paper introduces ANARCII, a novel Seq2Seq language model for numbering antigen receptors (like antibodies and TCRs) that bypasses traditional alignment methods. ANARCII achieves high accuracy and speed, even on challenging and novel sequence types, offering a more robust and generalizable solution for analyzing immune receptor diversity.

What Problem Does This Paper Address?

Antibodies and T cell receptors (TCRs) are crucial for the immune system, and understanding their structure and function often relies on numbering their amino acid sequences according to standardized schemes like IMGT. This numbering helps delineate functionally important regions, such as the Complementarity-Determining Regions (CDRs), which are critical for antigen binding. Current numbering methods typically rely on aligning query sequences to a reference set of known sequences. However, this approach faces several challenges:

  • Reference Set Dependence: The numbering can vary depending on the specific reference set used, and as new species, genes, and alleles are discovered, reference sets need constant updating, making the "ground truth" dynamic.
  • Failure on Novelty: These methods struggle with sequences from new species or rare sequence types that are significantly different from the training data, leading to alignment failures or inaccurate numbering.
  • Complexity of Data: Experimentally derived sequencing data can be noisy and contain extra content, further complicating alignment-based approaches.

The authors aim to overcome these limitations by developing a method that doesn't require explicit alignment and can generalize better to diverse and novel sequences.

Methods

The core of ANARCII is a Seq2Seq language model, specifically a transformer architecture, adapted for the task of "translating" amino acid sequences into their corresponding IMGT numbering labels.

  • Seq2Seq Architecture: The model takes an amino acid sequence as input and outputs a sequence of numerical labels representing the IMGT numbering, along with a predicted chain identity (heavy, kappa, or lambda).
  • Training Task: The model is trained to predict the chain type and IMGT numbers (1-128) along with special tokens like [<SKIP>] for non-antibody content and [<EOS>] for the end of the sequence.
  • Handling Junk Data: To mimic real-world sequencing data, random amino acids were added to the beginning and end of training sequences. The model learns to identify and [<SKIP>] this "junk" content.
  • Model Variants: Two main model variants were developed:
  • ANARCII-accuracy: A 2-layer model optimized for maximum numbering accuracy.
  • ANARCII-speed: A 1-layer model optimized for faster inference, with a slight trade-off in accuracy.
  • Conditioning and Fine-tuning: For challenging or rare sequence types (like VNARs), ANARCII can be "conditioned" by providing specific IMGT labels for known patterns. This conditioned output can then be used to fine-tune the model, creating specialized versions that can number these novel sequences accurately without explicit conditioning.

Datasets

  • Observed Antibody Space (OAS): A large dataset of non-redundant antibody heavy and light chain sequences was used for training and testing. This dataset was enriched for rare insertions and non-human/mouse species.
  • Observed TCR Space (OTS) and iReceptor: Data from these sources were used to generate training data for TCR sequences.
  • PDB (Protein Data Bank): Used to identify antibody sequences and test the model's ability to process long sequences and discriminate between antibody and non-antibody content.
  • PLAbDab-nano: A database of camelid and shark nanobodies (VNARs) was used to evaluate ANARCII's performance on novel and challenging sequence types.

The paper also implicitly introduces a "no-truth" dataset, which consists of sequences where different versions of the ANARCI tool produced conflicting numbering, highlighting ambiguities in existing methods.

Key Insights and Ideas

  • Language Models for Numbering: The paper demonstrates that Seq2Seq language models can effectively learn the complex patterns of antigen receptor sequences to predict IMGT numbering, offering a powerful alternative to alignment-based methods.
  • No Alignment Needed: ANARCII's ability to number sequences without explicit alignment is a significant advantage, as it bypasses the limitations and potential errors associated with sequence alignment, especially for divergent sequences.
  • Generalization Power: The model shows remarkable generalization capabilities, accurately numbering sequences that are highly dissimilar to those in its training set, including novel species and types like VNARs.
  • Conditioning for Rare Types: The concept of "conditioning" the model with known IMGT labels for specific rare sequence features (like VNAR CDR2 deletions) is a clever way to guide the model and create specialized versions.
  • Speed and Scalability: ANARCII-speed achieves impressive throughput (over 90,000 sequences per minute on an A100 GPU), making it suitable for high-throughput analysis of next-generation sequencing data.

Key Results

  • High Accuracy: ANARCII-accuracy achieved over 99.99% agreement with ANARCI for conserved residues and over 99.94% for complete CDR regions on challenging test sets.
  • Speed: ANARCII-speed can process over 90,000 sequences per minute on an A100 GPU, significantly faster than previous methods.
  • VNAR Numbering: ANARCII-accuracy correctly numbered all 28 VNAR structures tested, identifying conserved residues like Cys23 and Cys104, whereas AntPack misidentified them in 16 out of 28 cases.
  • TCR Numbering: Fine-tuned ANARCII models achieved high accuracy in numbering TCR sequences, even though the original antibody models had incompatible chain token assignments.
  • Robustness to Truncations: While truncations in sequences did lead to some disagreements, ANARCII generally performed well, with most disagreements occurring at the ends of sequences.

Limitations and Future Work

  • CDR2/DE-loop Ambiguity: The paper notes that the CDR2 to DE-loop region remains a challenging area for numbering, with some ambiguity even between ANARCI and ANARCII-accuracy. Structural exploration did not reveal a consistent numbering choice for this region.
  • Long Sequence Processing: While strategies were developed to handle long sequences (e.g., from the PDB), the model's internal context window is limited, requiring chunking and scoring, which could potentially miss subtle long-range interactions.
  • "No-truth" Dataset: The creation of the "no-truth" dataset highlights that even existing tools can have disagreements, suggesting that a definitive "ground truth" for all sequences might be elusive.
  • Future Work: The authors suggest that ANARCII's success as a proof-of-concept for language models in sequence alignment tasks opens doors for further exploration of LLMs in this domain. The ability to condition and fine-tune models also presents opportunities for creating highly specialized tools for various antibody and immune receptor research needs.

Summary updated

Abstract

ABSTRACT Antigen receptor numbering allows the rapid delineation of the antigen-binding regions of antibody and T cell receptor (TCR) sequences, from sequence alone. It also allows the comparison of the vast diversity of antigen receptors in a consistent frame of reference. Numbering of antigen receptors is currently achieved by aligning sequences to a reference set. This approach may result in different numbering, depending on the reference set used or may fail to number query sequences derived from new species or rare sequence types. To address this problem, we have built a new numbering method (ANARCII) which requires no alignment step and is based on a Seq2Seq language model. Our results show that ANARCII can deal with the complexity that arises in experimentally collected sequencing data and generalise to sequences which are highly dissimilar to those in training. In test sets designed to contain challenging and ambiguous sequence patterns ANARCII numbering was identical to existing methods for over 99.99% of conserved residues and over 99.94% for complete CDR regions. The lightweight architecture allows numbering of over 90,000 sequences per minute on a single A100 GPU. Furthermore, the ANARCII package can be conditioned to fit rare sequence types and provide new training data for fine-tuning. We demonstrate that fine-tuned versions of ANARCII can correctly number other immunoglobulin domains such as TCRs and VNARs. Our model is freely available as a web tool ( https://github.com/oxpig/ANARCII ), as well as a package for high throughput numbering of next generation sequencing data ( https://opig.stats.ox.ac.uk/webapps/sabdab-sabpred/sabpred/anarcii/ ).
BibTeX
@misc{greenshieldswatson2025anarcii,
  author = {Alexander Greenshields‐Watson and Parth Agarwal and Sarah A. Robinson and Ben H. Williams and G. Gordon and Henriette Capel and Yushi Li and Fabian C. Spoendlin and Broncio Aguilar-Sanjuan and Fergus Boyles and Charlotte M. Deane},
  title = {{ANARCII: A Generalised Language Model for Antigen Receptor Numbering}},
  year = {2025},
  doi = {10.1101/2025.04.16.648720},
  howpublished = {bioRxiv},
}

Loading related content...

Figure