Predictors¶
mhctools provides a common Python interface to MHC binding, presentation, antigen-processing, immunogenicity, TCR recognition, and peptide half-life predictors. Each family guide explains the inputs, installation, and output for its models.
Start with choosing a predictor if you need help selecting a model. For exact Python classes, command-line names, and installation routes, see the predictor matrix.
Available predictors¶
| Predict | Predictors |
|---|---|
| Binding affinity | NetMHCpan, NetMHC, NetMHCIIpan, NetMHCcons, MHCflurry, CapHLA, SMM, SMM-PMBEC |
| Presentation | NetMHCpan 4.1/4.2, NetMHCIIpan, MHCflurry, CapHLA, MixMHCpred (I), MixMHC2pred (II), BigMHC |
| Binding stability | NetMHCstabpan |
| Combined processing score | MHCflurry |
| Proteasomal cleavage | Pepsickle, NetChop, NetCleave (class I) |
| Endolysosomal cleavage | NetCleave (class 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 |
| Peptidase activity | peptidase activity API |
Read the known limits before interpreting a score.
RandomBindingPredictor is built in and produces random affinities, which is
occasionally useful as a null baseline.
Input shapes¶
The prediction method and its inputs depend on the family:
| Shape | You pass | Predictors |
|---|---|---|
| Peptides + alleles | predict(peptides) on a predictor built with alleles= |
NetMHCpan, NetMHC, NetMHCcons, NetMHCIIpan, NetMHCstabpan, MHCflurry, BigMHC, CapHLA, MixMHCpred, MixMHC2pred, SMM, PRIME, DeepImmuno, TLimmuno2 |
| Peptides + flanks | predict(peptides, n_flanks=..., c_flanks=...) |
Pepsickle, NetChop, NetCleave (class II needs a C-terminal flank of at least 3 residues) |
| Peptides only | predict(peptides) |
Calis, DeepTAP, ERAMER, PeptiVerse, PlifePred2 |
| Peptides + TCR | predict_pairs([(peptide, tcr)]) or predict(peptides, tcrs) |
NetTCR, Tulip (also mhc=) |
| TCRs against a fixed target | predict_tcrs(tcrs) on a model chosen for one pMHC |
MixTCRpred |
| Exact chemical form | predict([PeptideInput(...)]) |
PeptiVerse (strings still work) |
Every predictor also has predict_proteins() to scan protein sequences and
predict_dataframe() / predict_proteins_dataframe(). See results and
DataFrames.
Peptide lengths¶
Protein scans use default window lengths unless you specify them. These defaults are usually narrower than the model's supported range:
| Predictors | Default lengths |
|---|---|
| NetMHCpan, NetMHC, NetMHCcons, MHCflurry, MixMHCpred, SMM, PRIME, Pepsickle, NetChop | 9 |
| NetMHCIIpan | 15-20 |
| MixMHC2pred | 15 |
| NetCleave | 9 (class I), 15 (class II) |
Historical Iedb* names |
8-11 (class I), 15-20 (class II) |
| NetMHCstabpan | none; pass peptide_lengths= |
Override per call or per predictor:
predictor.predict_proteins(proteins, peptide_lengths=[8, 9, 10, 11])
NetMHCpan42(alleles=["HLA-A*02:01"], default_peptide_lengths=[8, 9, 10, 11])
On the command line use --mhc-peptide-lengths 8-11. Passing explicit peptides
to predict() is not limited by these defaults, but each model still has its
own supported range (for example MixMHCpred 8-14, CapHLA 7-25, DeepImmuno
9-10 only, PlifePred2 12-100, ERAMER 9-16).