Skip to main content

Fast and performant TCR representation model

Project description

Latest release Tests Documentation Status License DOI

Check out the documentation page.


Graphical abstract. Traditional protein language models that are trained purely on masked-language modelling underperform sequence alignment models on TCR specificity prediction. In contrast, our model SCEPTR is jointly trained on masked-language modelling and contrastive learning, allowing it to outperform other language models as well as the best sequence alignment models to achieve state-of-the-art performance.

SCEPTR (Simple Contrastive Embedding of the Primary sequence of T cell Receptors) is a small, fast, and informative TCR representation model that can be used for alignment-free TCR analysis, including for TCR-pMHC interaction prediction and TCR clustering (metaclonotype discovery). Our manuscript demonstrates that SCEPTR can be used for few-shot TCR specificity prediction with improved accuracy over previous methods.

SCEPTR is a BERT-like transformer-based neural network implemented in Pytorch. With the default model providing best-in-class performance with only 153,108 parameters (typical protein language models have tens or hundreds of millions), SCEPTR runs fast- even on a CPU! And if your computer does have a CUDA-enabled GPU, the sceptr package will automatically detect and use it, giving you blazingly fast performance without the hassle.

sceptr's API exposes four intuitive functions: calc_cdist_matrix, calc_pdist_vector, calc_vector_representations, and calc_residue_representations -- and it's all you need to make full use of the SCEPTR models. What's even better is that they are fully compliant with pyrepseq's tcr_metric API, so sceptr will fit snugly into the rest of your repertoire analysis workflow.

Installation

pip install sceptr

Citing SCEPTR

Please cite our manuscript.

BibTex

@article{nagano_contrastive_2025,
	title = {Contrastive learning of {T} cell receptor representations},
	volume = {16},
	issn = {2405-4712, 2405-4720},
	url = {https://www.cell.com/cell-systems/abstract/S2405-4712(24)00369-7},
	doi = {10.1016/j.cels.2024.12.006},
	language = {English},
	number = {1},
	urldate = {2025-01-19},
	journal = {Cell Systems},
	author = {Nagano, Yuta and Pyo, Andrew G. T. and Milighetti, Martina and Henderson, James and Shawe-Taylor, John and Chain, Benny and Tiffeau-Mayer, Andreas},
	month = jan,
	year = {2025},
	pmid = {39778580},
	note = {Publisher: Elsevier},
	keywords = {contrastive learning, protein language models, representation learning, T cell receptor, T cell specificity, TCR, TCR repertoire},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sceptr-1.1.1.tar.gz (10.7 MB view details)

Uploaded Source

Built Distribution

sceptr-1.1.1-py3-none-any.whl (10.7 MB view details)

Uploaded Python 3

File details

Details for the file sceptr-1.1.1.tar.gz.

File metadata

  • Download URL: sceptr-1.1.1.tar.gz
  • Upload date:
  • Size: 10.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sceptr-1.1.1.tar.gz
Algorithm Hash digest
SHA256 833fb7d98082c907ae697d0d7e328824f09ebb973434ddad0c0f72d75d4de672
MD5 7f4631eabf11139f59db14259fb1b34c
BLAKE2b-256 c92e87caa1e7a849c1089f632b0f128ec22512387e3c7fa81cdc5a302d1cac5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sceptr-1.1.1.tar.gz:

Publisher: publish_to_pypi.yaml on yutanagano/sceptr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sceptr-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: sceptr-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sceptr-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31de4866aeaa731f996b0931bd0dcd4009adb67419bc56df842440952e643a6c
MD5 a35bd17329f0c54c662c1b807a47af95
BLAKE2b-256 43ca0078c1d8ad3b21c7ce2b9d8817f7ff61b8de236b6bc3fb52971bab3eeb70

See more details on using hashes here.

Provenance

The following attestation bundles were made for sceptr-1.1.1-py3-none-any.whl:

Publisher: publish_to_pypi.yaml on yutanagano/sceptr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page