Skip to main content

A Deep Learning Framework for TCR-Peptide Recognition Prediction

Project description

PepTCR-Net: Deep Learning for TCR-Peptide Recognition Prediction

PyPI version Python 3.8–3.12 License: MIT Checkpoints on Zenodo

PepTCR-Net predicts T-cell receptor (TCR) recognition of peptide antigens using deep learning with uncertainty quantification.

Quick Start

pip install -U peptcrnet
peptcrnet-download-models
peptcrnet-demo

For notebooks: pip install peptcrnet[notebooks]

Requirements: Python 3.8–3.12 (not 3.13).

Installation

From PyPI (recommended)

pip install -U peptcrnet
peptcrnet-download-models   # downloads ~283 MB from Zenodo to ~/.peptcrnet/

From source

git clone https://github.com/mlizhangx/Pep-TCRNet.git
cd Pep-TCRNet
pip install -e ".[notebooks]"
peptcrnet-download-models

Pretrained model checkpoints (required for prediction)

Checkpoints are not included in the pip package. Download them once from Zenodo:

Automatic (recommended):

peptcrnet-download-models

Manual:

curl -LO "https://zenodo.org/records/14194846/files/peptcrnet-pretrained-checkpoints-v1.zip?download=1"
unzip peptcrnet-pretrained-checkpoints-v1.zip -d ~/.peptcrnet/

Files are cached under ~/.peptcrnet/checkpoints/ and ~/.peptcrnet/datasets/atchley.txt.

If a previous download failed, delete the bad file first:

rm -f ~/.peptcrnet/peptcrnet-pretrained-checkpoints-v1.zip
rm -rf ~/.peptcrnet/checkpoints ~/.peptcrnet/datasets

Basic Usage

One-line prediction

from peptcrnet import quick_predict

results = quick_predict(
    tcr_sequences=["CASSLAPGATNEKLFF", "CASSLKPSYNEQFF"],
    mhc_alleles=["HLA-A*02:01", "HLA-A*02:01"],
    v_genes=["TRBV19", "TRBV7-9"],
    j_genes=["TRBJ1-4", "TRBJ2-3"],
    scenario=16,
)
print(results)

Predict from CSV

from peptcrnet import predict_from_file

results = predict_from_file("my_data.csv", scenario=16)
results.to_csv("predictions.csv", index=False)

See USAGE_EXAMPLES.md and documentation for more.

Training pipeline (advanced)

from peptcrnet import PepTCRNetPipeline

pipeline = PepTCRNetPipeline(data_path="your_data.csv")
pipeline.load_data()
pipeline.split_data(test_size=0.2, val_size=0.1)
pipeline.prepare_features(feature_types=["sequences", "categorical"])
history = pipeline.train(epochs=100, batch_size=128)

Data Format

Input CSV for predict_from_file and the predictor API:

Column Required Description Example
CDR3 Yes TCR CDR3β sequence CASSRGQGNEQFF
MHC Scenario-dependent HLA allele (single column) HLA-A*02:01
V Scenario-dependent V gene segment TRBV7-2
J Scenario-dependent J gene segment TRBJ2-1
Peptide Optional True peptide (evaluation only) GILGFVFTL

Note: The prediction API uses a single MHC column. Some training notebooks split HLA into HLA-A, HLA-B, HLA-C; merge to MHC for prediction or use the Zenodo CSV format.

Default scenario 16 uses ED + HLA + VJ features — provide CDR3, MHC, V, and J.

Demo notebook (source install)

pip install peptcrnet[notebooks]
jupyter notebook DEMO_Complete_Pipeline.ipynb

Citation

@article{le2025peptcrnet,
  title={PepTCR-Net: prediction of multi-class antigen peptides by T-cell receptor sequences with deep learning},
  author={Le, Phi and Ung, Leah and Yang, Hai and Huang, Anwen and He, Tao and Bruno, Peter and Oh, David Y and Keenan, Bridget P and Zhang, Li},
  journal={Briefings in Bioinformatics},
  volume={26},
  number={4},
  pages={bbaf351},
  year={2025},
  doi={10.1093/bib/bbaf351}
}

License

MIT — see LICENSE.

Contact

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

peptcrnet-1.1.1.tar.gz (774.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peptcrnet-1.1.1-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peptcrnet-1.1.1.tar.gz
  • Upload date:
  • Size: 774.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for peptcrnet-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e1ec6948a381746b75bbb7b43c9abc3691b8be5e755e7435cd90b9adbada7f61
MD5 670362ab0bc6a8667de7a8cb17063690
BLAKE2b-256 8528bee53d5cca59e5c7e5e1016c7e44d76fee4e4a8ce4c9bf897d36e27049e3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: peptcrnet-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for peptcrnet-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad74570ac90d2b4c9fb28ef639004878f9373b23bed198d4f6c45aabf66bb05d
MD5 41f8f39f4d5eb8bbd09a6322a6c09d4d
BLAKE2b-256 77df7db3d0e15be91115260a06bfa10dc11a62cce076a86fe1e213230b0fddb8

See more details on using hashes here.

Supported by

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