Proto is not affiliated with DTU Health Tech, Section of Bioinformatics and Technical University of Denmark. This toolkit is open source and builds on the implementations produced by these organizations. Product names, logos, and trademarks are the property of their respective owners.
Background
MHC class I molecules bind short peptides produced by cytosolic protein degradation and display them at the cell surface, where CD8+ T cells inspect them. Which peptides are displayed is decided largely by the MHC binding groove, whose anchor-residue preferences differ from allele to allele, and the human HLA loci are among the most polymorphic in the genome. The question “is this peptide presented?” therefore has thousands of allele-specific answers, and for most alleles there is little or no direct experimental data. The “pan” in netMHCpan is the response to that: rather than fitting one model per allele, the network takes a pseudo-sequence encoding of the MHC molecule itself - the polymorphic groove positions that contact the peptide - alongside the peptide, so a single model generalizes to alleles it was never trained on (Nielsen et al., 2007). NetMHCpan-4.2 (Nilsson et al., 2025) is trained with an updated NNAlign_MA framework on more than 1,000,000 peptides drawn from two kinds of measurement: quantitative binding affinity (BA) and mass-spectrometry eluted ligands (EL). The BA data covers 171 MHC molecules spanning human HLA-A, -B, -C and -E, mouse H-2, cattle BoLA, the primate Patr, Mamu and Gogo loci, swine SLA and equine Eqca; the EL data covers 201, spanning human HLA-A, -B, -C and -G, mouse H-2, cattle BoLA, the primate Mamu locus and dog DLA. Eluted-ligand data mostly comes from multi-allelic cell lines, where the allele responsible for each observed peptide is unknown; NNAlign_MA resolves that by deconvolving the binding motifs concurrently with training, and adds features for amino-acid deletions. The two measurement types become two prediction heads: an EL score, read as the likelihood that a peptide is a naturally presented ligand, and a BA score with a predicted affinity in nM. EL is the default, and the EL likelihood is what the authors use for their epitope benchmark. Three changes in 4.2 matter when reading its output. The first is not configurable and is simply how 4.2 scores: the network takes input features encoding the structural constraints of the peptide-binding cleft, which the authors report improves both predictive power and the identification of the peptide residues that contact the MHC. The second is that the method is fine-tuned by transfer learning on experimentally validated epitopes - roughly 43,000 pathogen-derived epitopes from IEDB and 5,200 neoepitopes from CEDAR - whichinclude_pathogen and include_neoepitope surface as extra score and %rank columns. The authors are explicit that this fine-tuning yields only a minor accuracy boost, and that transferability between cancer- and pathogen-derived epitopes is limited, so the two heads are best read as task-specific second opinions rather than replacements for the EL score. The third is that 4.2 can encode each peptide’s flanking residues (use_context on the protein scan), which affects the ligand likelihood through the processing signal that the flanks carry.
Each raw score is accompanied by a %rank: the percentile of that score against a large background set of random natural peptides scored on the same allele. This matters in practice, because raw scores sit on different per-allele background distributions and are not comparable across alleles, whereas a %rank is. The conventional thresholds are 0.5% for a strong binder and 2% for a weak one, and they are what this toolkit’s strong_rank and weak_rank default to. Finally, a presented peptide is not necessarily an immunogenic one: proteasomal processing, TAP transport, TCR repertoire and self-tolerance all sit between presentation and a T-cell response, so these predictions bound the space of candidate epitopes rather than identifying immunogenic ones.
Learning Resources
- NetMHCpan-4.2 service page (DTU Health Tech) - the canonical home: usage instructions, the output-column description, the supported-allele list, the changelog, and the gated academic download.
- IEDB (NIAID / La Jolla Institute for Immunology) - a major public source of the curated binding measurements these methods are trained on, and the place to check whether a candidate peptide already has experimental support. Its companion CEDAR covers cancer epitopes and is the source of the neoepitopes 4.2 is fine-tuned on.
Tools
netMHCpan Peptides (netmhcpan-peptides)
Scores explicit 8-14mer peptides against a panel of MHC class I alleles, returning one prediction per peptide per allele with the EL score, the EL %rank, a binder class, and - with include_binding_affinity, include_pathogen or include_neoepitope - the binding-affinity, pathogen-epitope and neoepitope scores and %ranks.API Reference
Input: NetMHCpanPeptidesInput
Input: NetMHCpanPeptidesInput
Config: NetMHCpanPeptidesConfig
Config: NetMHCpanPeptidesConfig
True is coerced to 1 and False to 0.None waits indefinitely.BaseToolOutput.approx_equal), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.HLA-A02:01, HLA-A*02:01 and A*02:01 spellings. Defaults to the netMHCpan default allele.-BA), adding BA score, BA %rank and nM affinity alongside the eluted-ligand columns.-pathogen), fine-tuned on IEDB epitopes.-neo), fine-tuned on CEDAR neoepitopes.Applications
Use this when the peptides already exist: a list of candidate vaccine epitopes to rank, mutation-derived neoantigens enumerated upstream from variant calls, peptides identified by immunopeptidomics, or a set of designed sequences you want checked against a population-representative allele panel. The whole panel is scored in a single netMHCpan invocation, so adding alleles costs rows rather than runs.Usage Tips
- Threshold and compare on
rank_el, notscore_el. Raw EL scores sit on different per-allele background distributions, so a score of 0.3 does not mean the same thing forHLA-A02:01as forHLA-B07:02. The %rank is a percentile against random natural peptides scored on the same allele and is the quantity that is comparable across alleles;strong_rank(default0.5) andweak_rank(default2.0) are applied to it. include_binding_affinityadds the BA columns, it does not swap the mode. netMHCpan’s-BAflag is additive: with it set,score_ba,rank_baandaffinity_nmare populated alongside the EL fields, which stay the default and stay populated. Two summary metrics,best_rank_baandbest_affinity_nm, appear with it as well, and are absent rather than zero without it, so a stored result never implies an affinity that was never predicted. Leave it off unless you specifically need a nM number; the EL likelihood is what netMHCpan reports by default and what its authors benchmark epitope prediction on.include_pathogenandinclude_neoepitopeare additive too, and are second opinions rather than upgrades. Each adds its own score and %rank from a head fine-tuned by transfer learning on experimentally validated epitopes: IEDB pathogen epitopes for-pathogen, CEDAR neoepitopes for-neo. They leave the EL fields untouched, and bringbest_rank_pathogenandbest_rank_neowith them. The authors report that this fine-tuning gives only a minor accuracy gain and that pathogen and cancer epitopes transfer poorly to each other, so match the head to the task -include_neoepitopefor tumour neoantigens,include_pathogenfor infectious-disease epitopes - and keep ranking onrank_elunless you have a reason not to. Requesting both is fine and costs one run.binder_classis always derived fromrank_el, including when BA is requested. TheBindLevelcolumn netMHCpan prints is computed from the EL %rank even under-BA, which makes it ambiguous about which rank produced it. This wrapper classifies explicitly fromrank_elso the reported class and the reported rank always agree.- There is deliberately no peptide-length setting on this tool. netMHCpan silently ignores
-lin peptide mode and scores every peptide at its own length, so a length config field here would be a lie. Lengths are validated instead (8-14, the class I range the netMHCpan server accepts), and k-mer enumeration lives innetmhcpan-protein, which is the reason the two input granularities are separate tools. - Allele spellings are normalized, and unknown alleles fail loudly.
HLA-A02:01,HLA-A*02:01andA*02:01are all accepted and converge on the unstarredHLA-A02:01form, which is the only spelling the binary itself accepts. Names are then checked against the allele list in the install before the binary is spawned, so a typo raises an error naming the offending allele with near-miss suggestions rather than surfacing as a tool crash. - Peptides must use the 20 standard uppercase amino acids. netMHCpan silently rewrites anything else to
X, which would mean scoring a peptide you did not ask about, so off-alphabet input is rejected up front.
netMHCpan Protein Scan (netmhcpan-protein)
Enumerates every k-mer window of each protein sequence, scores all of them against the configured allele panel, and returns the per-window predictions together with summary metrics and epitope density for the sequence.API Reference
Input: NetMHCpanProteinInput
Input: NetMHCpanProteinInput
Config: NetMHCpanProteinConfig
Config: NetMHCpanProteinConfig
-l). Defaults to the 8-11 class I screening range, which is wider than 4.2’s own -l default of 9.-context), read off the supplied protein. Changes every reported score.X (-termAcon). Requires use_context.True is coerced to 1 and False to 0.None waits indefinitely.BaseToolOutput.approx_equal), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.HLA-A02:01, HLA-A*02:01 and A*02:01 spellings. Defaults to the netMHCpan default allele.-BA), adding BA score, BA %rank and nM affinity alongside the eluted-ligand columns.-pathogen).-neo).Applications
Use this to screen whole sequences rather than peptide lists: scanning a designed protein, antibody or other biologic for class I epitopes before deimmunization, surveying a pathogen antigen for vaccine epitope candidates, or scoring a round of designs so that predicted immunogenicity can be traded off against the rest of an objective. Windowing happens inside the tool, andposition is reported 1-indexed against the sequence you supplied.Usage Tips
peptide_lengths(default[8, 9, 10, 11]) is the one setting the peptides tool does not have. It is netMHCpan’s-lflag, which is honoured only in FASTA mode. The default is the full class I screening range, which is deliberately wider than netMHCpan’s own-ldefault of9;[9]alone is a reasonable, much cheaper restriction when only the dominant class I length matters. Lengths are de-duplicated, sorted, and bounded to 8-14.use_contextis the 4.2 feature this tool can offer and the peptides tool cannot. netMHCpan’s-contextencodes the residues flanking each window, which carry a processing signal the peptide alone does not, and it changes every reported score - a context run and a plain run are not comparable, so pick one per experiment. It is free here because the flanks are read off the protein you supplied, whereas peptide mode would need you to hand over each peptide’s flanks in netMHCpan’s PEPTIDECONT format.terminal_context_as_alanine(-termAcon) only changes how context that runs off either terminus is padded, fromXto alanine, and is rejected unlessuse_contextis also set rather than being silently ignored.binding_propensityis the primary metric and the one to optimize against. A strong-binder count is piecewise-constant in the underlying sequence, so a sampler gets no gradient signal from it until a window crosses a threshold.binding_propensityis a logistic in log-rank space, centred so that it is exactly 0.5 atweak_rankand strictly decreasing in %rank, which gives a smooth 0-1 objective. The counts,strong_binder_fractionandbest_rankare reported alongside it for the reading immunologists actually do.strong_binders_per_100_residuesis the metric to compare across sequences of different length. Raw counts grow with sequence length and with panel size; this normalizes by both, so a 90-residue domain and a 500-residue scaffold can be ranked against each other. It does not normalize bypeptide_lengths, since more lengths mean more windows over the same residues, so compare it only across runs that used the same lengths.strong_binder_fractionnormalizes by window count as well and is the one to reach for when the lengths differ.- Cost scales as windows times alleles, not as sequences. One scan produces one row per window per allele, so a 300-residue protein at four lengths against six alleles is already around 7,000 predictions. Trim
peptide_lengthsor the allele panel before trimming the sequence set. - Sequences must use the 20 standard uppercase amino acids and be at least 8 residues long. As in the peptides tool, off-alphabet residues are rejected rather than silently rewritten to
Xby the binary.
Toolkit Notes
These apply to every netMHCpan tool in this toolkit (netmhcpan-peptides, netmhcpan-protein).
- CPU-only, and parallelised by fan-out rather than by threads. netMHCpan is a single-threaded precompiled binary with no CUDA path, so both tools declare
cpus_per_instance = 1and opt into ToolPool CPU fan-out: throughput comes from running many one-core instances over chunks of the input. Per-call cost is dominated by process startup, which is why the peptides tool chunks generously and the protein tool, whose rows multiply by window and allele, chunks much smaller. - Gated software, and local-only by license. DTU gates the netMHCpan download behind per-user registration, so the install is provisioned by hand once; the archive bundles the networks and threshold tables, so nothing is fetched at run time. The DTU academic license is non-transferable and forbids giving the software to third parties, alone or integrated into other software, so both tools are registered
local_onlyand can never run on a remote or hosted worker. Run them locally withdevice='cpu'. Place the install in the managed cache so it is found with no environment variable, or pointNETMHCPAN_HOME(orNMHOME, orPROTO_NETMHCPAN_WEIGHTS_DIR) or thenetmhcpan_dirconfig field at thenetMHCpan-4.2root. See SETUP.md for copy-paste steps. A missing install skips cleanly on an unconfigured host; a path that is set but wrong or incomplete fails fast with an actionable message. - No file in the install needs editing. The netMHCpan install instructions have you edit the shipped
netMHCpantcsh launcher to hardcodeNMHOMEandTMPDIR. proto-tools does not: it invokes the platform binary directly with-rdirand-tdirand exports theNETMHCpanvariable the launcher would have set. That keeps the install byte-identical to what DTU shipped - the license forbids modifying the source without written consent - and means tcsh need not be installed at all. - 4.2e is the version this toolkit was developed and verified against. An install that does not provide
<Platform>_<arch>/bin/netMHCpan-4.2fails the setup precheck with an actionable message rather than running. Scores are version-specific, and output columns have differed across netMHCpan releases, so the parser keys on the result table’s header row rather than fixed column offsets - which is also what absorbs the extra columns-BA,-pathogenand-neoadd. The version the binary reported is returned asnetmhcpan_versionand recorded in the output metadata; check it before comparing runs. - Deterministic and cacheable. The networks are fixed and no sampling is involved, so the same peptides, alleles and thresholds always give the same scores; both tools are registered
cacheable=Trueand declare no seed.

