This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description


Open source neural network models for peptide-MHC binding affinity prediction

The adaptive immune system depends on the presentation of protein fragments by MHC molecules. Machine learning models of this interaction are used in studies of infectious diseases, autoimmune diseases, vaccine development, and cancer immunotherapy.

MHCflurry currently supports peptide / MHC class I affinity prediction using one model per MHC allele. The predictors may be trained on data that has been augmented with data imputed based on other alleles (see Rubinsteyn 2016). We anticipate adding additional models, including pan-allele and class II predictors.

You can fit MHCflurry models to your own data or download trained models that we provide. Our models are trained on data from IEDB and Kim 2014. See here for details on the training data preparation. The steps we use to train predictors on this data, including hyperparameter selection using cross validation, are here.

The MHCflurry predictors are implemented in Python using keras.


Install the package:

pip install mhcflurry

Then download our datasets and trained models:

mhcflurry-downloads fetch

From a checkout you can run the unit tests with:

nosetests .

Making predictions

from mhcflurry import predict
predict(alleles=['A0201'], peptides=['SIINFEKL'])
  Allele   Peptide  Prediction
0  A0201  SIINFEKL  10672.347656

Training your own models

This unit test gives a simple example of how to train a predictor in Python. There is also a script called mhcflurry-class1-allele-specific-cv-and-train that will perform cross validation and model selection given a CSV file of training data. Try mhcflurry-class1-allele-specific-cv-and-train --help for details.

Details on the downloaded class I allele-specific models

Besides the actual model weights, the data downloaded with mhcflurry-downloads fetch also includes a CSV file giving the hyperparameters used for each predictor. Another CSV gives the cross validation results used to select these hyperparameters.

To see the hyperparameters for the production models, run:

open "$(mhcflurry-downloads path models_class1_allele_specific_single)/production.csv"

To see the cross validation results:

open "$(mhcflurry-downloads path models_class1_allele_specific_single)/cv.csv"

Environment variables

The path where MHCflurry looks for model weights and data can be set with the MHCFLURRY_DOWNLOADS_DIR environment variable. This directory should contain subdirectories like “models_class1_allele_specific_single”. Setting this variable overrides the other environment variables described below.

If you only want to change the version of the released data used, you can set MHCFLURRY_DOWNLOADS_CURRENT_RELEASE. If you want to change the base directory used for all releases, set MHCFLURRY_DATA_DIR.


Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mhcflurry-0.0.8.tar.gz (48.4 kB) Copy SHA256 Checksum SHA256 Source Sep 17, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting