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 DOI

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

Quick Start

pip install 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 peptcrnet
peptcrnet-download-models   # downloads ~270 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/14194728/files/peptcrnet-pretrained-checkpoints-v1.zip"
unzip peptcrnet-pretrained-checkpoints-v1.zip -d ~/.peptcrnet/

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

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.0.tar.gz (773.8 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.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peptcrnet-1.1.0.tar.gz
  • Upload date:
  • Size: 773.8 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.0.tar.gz
Algorithm Hash digest
SHA256 db9c9371b825c35f0eadee9b448282e06a87b79efef0f3b9bffdf6f53666d567
MD5 a7e954b84f506ed18faf50b601d02159
BLAKE2b-256 f15e38be303cf1c5b9fc8b123fa6889b37e60d0a8556dc90e57b7926bb151ba4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: peptcrnet-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 37.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 abe9a5e069c1efb7950c075276a50b0ab70e61b7e53489b25750b2fc6f1f1fc1
MD5 7ed1ad88a402e2c2976ea0884d59b291
BLAKE2b-256 61c3b9fd4afdadf26c33ecebacde55b03c4baeac8c30dbd43117311efc050cb9

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