mhctools
mhctools runs MHC binding, presentation, immunogenicity and antigen-processing
predictors through a single predict() call and returns the same result
objects whichever one you use. Swapping NetMHCpan for MHCflurry is a one-line
change, and comparing them gives you a DataFrame.
Documentation: https://openvax.github.io/mhctools/
Available predictors
| Predict | Predictors |
|---|---|
| Binding affinity | NetMHCpan, NetMHC, NetMHCIIpan, NetMHCcons, MHCflurry, CapHLA, SMM, SMMPMBEC |
| Presentation | NetMHCpan41/42, NetMHCIIpan, MHCflurry, CapHLA, MixMHCpred (I), MixMHC2pred (II), BigMHC |
| Binding stability | NetMHCstabpan |
| Antigen processing | MHCflurry |
| Proteasomal cleavage | Pepsickle, NetChop, NetCleave_I |
| Endolysosomal cleavage | NetCleave_II |
| TAP transport | DeepTAP |
| ERAP1 trimming | ERAMER |
| Immunogenicity | Calis, PRIME, BigMHC_IM, DeepImmuno, TLimmuno2 (II) |
| TCR recognition | NetTCR, Tulip, MixTCRpred |
| Peptide half-life | PeptiVerse, PlifePred2 |
| Per-bond cleavage | cleavage API |
- Predictor matrix: every predictor, class, command-line name, input, install route and license on one page.
- Choosing a predictor and known limits. Several of these models are weaker than their own papers suggest; read the limits before you trust a score.
RandomBindingPredictor is built in and produces random affinities, which is
occasionally useful as a null baseline.
Install and predict
pip install mhctools
mhctools fetch mhcflurry # MHCflurry ships as a dependency; this downloads its weights
from mhctools import MHCflurry
predictor = MHCflurry(alleles=["HLA-A*02:01", "HLA-B*07:02"])
results = predictor.predict(["SIINFEKL", "GILGFVFTL"])
for r in results:
if r.affinity:
print(f"{r.peptide} -> {r.affinity.allele} IC50={r.affinity.value:.1f}nM")
predict() returns one PeptideResult per input
peptide, in input order. Each exposes an accessor per kind of prediction
(r.affinity, r.presentation, r.immunogenicity, ...) that is None when
the predictor does not produce that kind. Scan proteins with
predict_proteins(), and get a pandas DataFrame from any *_dataframe() method.
See results and DataFrames.
Calis needs no download. Most other predictors need model weights or an
external tool first (see below). The command line does the same job:
mhctools --sequence SIINFEKL SIINFEKLQ --mhc-predictor mhcflurry --mhc-alleles A0201
Getting models
Most predictors need something downloaded first, with one command for all of it:
mhctools ls # what exists, where it lives, who manages it
mhctools fetch mhcflurry # get it
mhctools predictors # can it actually run?
fetch is idempotent. Academic-licensed tools need an explicit
--accept-license, and the DTU NetMHC family needs a license you request from
DTU directly. See getting models
and licensing.
Beyond peptide-MHC
- Per-bond peptidase evidence, including contextual batches for epitopes with flanks and complete vaccine constructs under tumor, APC and extracellular scenarios.
- Route-aware vaccine reports:
mhctools vaccine-reportwrites a sequence-centered PDF with route policies and checksums. - Assay-aware benchmarks:
mhctools benchmarkevaluates source-linked observations with training-overlap reporting. - Peptide PK, uptake and exposure result kinds.
Documentation
| Start here | |
|---|---|
| Command line | Every mhctools subcommand |
| Results and DataFrames | PeptideResult, Prediction, columns |
| Recipes | Scan proteins, many genotypes, annotate a table |
| Allele names | Accepted spellings and errors |
| Troubleshooting | Common failures |
| Migration guide | Old names and what replaced them |
Development
./develop.sh # editable install
./lint.sh # ruff
./test.sh # pytest
See the testing guide for a complete run with no skipped tests. Releases are described in RELEASING.md.
Metadata
Release files for mhctools 3.46.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mhctools-3.46.5.tar.gz | 541.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mhctools-3.46.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 855.3 kB
Release files / mhctools-3.46.5.tar.gz
| Download URL | mhctools-3.46.5.tar.gz |
|---|---|
| Size | 541.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7eed7efe036d8bce40053cef03c5a61860f69d0105df6b0c4430c87b4fccc972
|
|
BLAKE2b-256 checksum How to use checksums |
b0ab9782b323212cc1e29be8500cb72aecaa06ec08281ec60e12bbbc18ca1033
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / mhctools-3.46.5-py3-none-any.whl
| Download URL | mhctools-3.46.5-py3-none-any.whl |
|---|---|
| Size | 314.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c15fc9978be9c26ea113dbaa1f9fbc0adc2971e6ba04271d31d097b844f86f84
|
|
BLAKE2b-256 checksum How to use checksums |
43f8cc86c2b2b4b78f38239754f6be04e020a4a93c93a12c98d8126016f97e9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|