Skip to main content

Build Status Open In Colab

MHCflurry

MHCflurry predicts which peptides are likely to be displayed by MHC class I molecules. It provides pretrained models for three related tasks:

  • Binding affinity: how strongly a peptide binds an MHC allele.
  • Antigen processing: whether cellular processing favors the peptide.
  • Presentation: a combined score using binding and processing predictions.

You can use the released models from the command line or Python, scan proteins for candidate epitopes, or train models on your own data.

Quick start

Install MHCflurry 2.3 and download the pretrained presentation models:

pip install --upgrade "mhcflurry>=2.3,<2.4"
mhcflurry downloads fetch models_class1_presentation

The presentation bundle includes affinity and processing components. Browse current and historical weights with mhcflurry downloads info; select a weight release for prediction with --model-release.

Predict a few peptides:

mhcflurry predict \
    --alleles HLA-A0201 HLA-A0301 \
    --peptides SIINFEKL SIINFEKD SIINFEKQ \
    --out predictions.csv

Or scan a protein sequence for candidate ligands:

mhcflurry predict-scan \
    --sequences MFVFLVLLPLVSSQCVNLTTRTQLPPAYTNSFTRGVYYPDKVFRSSVLHS \
    --alleles 'HLA-A*02:01' \
    --out scan.csv

To try MHCflurry without installing anything, open the Colab notebook.

The historical mhcflurry-* command names remain supported for existing scripts. See the 2.3.0 release notes for details.

Documentation

Please file an issue if you have questions or encounter problems.

Citing MHCflurry

If you use MHCflurry in your research, please cite:

T. O'Donnell, A. Rubinsteyn, U. Laserson. "MHCflurry 2.0: Improved pan-allele prediction of MHC I-presented peptides by incorporating antigen processing," Cell Systems, 2020. https://doi.org/10.1016/j.cels.2020.06.010

T. O'Donnell, A. Rubinsteyn, M. Bonsack, A. B. Riemer, U. Laserson, and J. Hammerbacher, "MHCflurry: Open-Source Class I MHC Binding Affinity Prediction," Cell Systems, 2018. https://doi.org/10.1016/j.cels.2018.05.014

Development

Contributions are welcome. Start with CONTRIBUTING.md; the testing guide describes the fast local checks and full suite.

Docker

Docker images built from version 2.3.6 onward include the full presentation weights, the command-line tools and Jupyter notebooks. They run predictions on the CPU and support Intel/AMD and ARM Linux. Check the published image's version with:

docker pull openvax/mhcflurry:latest
docker run --rm openvax/mhcflurry:latest mhcflurry --version

Stable releases publish a matching version tag and update latest after both architecture builds pass an offline prediction check. Publication status is visible in the Docker workflow; an incomplete publication can leave latest on the previous version.

Run predictions against files in the current directory:

docker run --rm -v "$PWD:/work" openvax/mhcflurry:latest \
    mhcflurry predict input.csv --out predictions.csv

To start Jupyter, run the image without a command:

docker run --rm -p 127.0.0.1:9999:9999 -v "$PWD:/work" openvax/mhcflurry:latest

Open the localhost URL printed in the logs, including its access token. Without the volume mount, the image starts in a directory containing the example notebooks. Mounted directories must be writable by the container's user (UID 1000). To build from a checkout, use docker build -t mhcflurry:local .. For CUDA training, a separate image can be built with docker build -f docker/Dockerfile.train -t mhcflurry:train ..

More resources

Metadata

Release files for mhcflurry 2.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mhcflurry 2.3.6
File Size Uploaded
mhcflurry-2.3.6.tar.gz 759.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mhcflurry 2.3.6
File Interpreter ABI Platform
mhcflurry-2.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / mhcflurry-2.3.6.tar.gz

Download URL mhcflurry-2.3.6.tar.gz
Size 759.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dc2d8d68734648f97a46932d70ac40e08d8cf8f3115f1d376f67e78fa74630f5
BLAKE2b-256 checksum
How to use checksums
84766200ef2333faf25c925340bbe240918e9b8989250364f0630f3da74ef832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / mhcflurry-2.3.6-py3-none-any.whl

Download URL mhcflurry-2.3.6-py3-none-any.whl
Size 557.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1b8bd6867cd59bee8a66f68f5a3343e62170b7605a27c037ff44a340f1568cb
BLAKE2b-256 checksum
How to use checksums
92f677485e09e894616f4d8e60541ed3743c51df806361e8e3e0221dc8d03b44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

2.3.9

2 release files

2.3.8

2 release files

2.3.7

2 release files

This release

2.3.6 This release

2 release files

2.3.5

2 release files

2.3.4

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

1 release file

1.4.0

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.2.0

1 release file

0.0.8

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page