openvax / mhcflurry

Peptide-MHC I binding affinity prediction
http://openvax.github.io/mhcflurry/
Apache License 2.0
193 stars 58 forks source link

Cannot use pan-allele model from command line #159

Closed weitzner closed 4 years ago

weitzner commented 4 years ago

I would like to perform a pan-allele prediction on a peptide of interest, but cannot run mhcflurry-predict with the trained pan-allele model.

After downloading the pan-allele models using mhcflurry-downloads fetch models_class1_pan, I attempt to use them by issuing

$ mhcflurry-predict --peptides PEPTIDE --alleles pan-class1 --models ~/Library/Application\ Support/mhcflurry/4/1.6.0/models_class1_pan/models.combined

In addition to the typical output, I get the following error message:

Traceback (most recent call last):
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/bin/mhcflurry-predict", line 8, in <module>
    sys.exit(run())
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/predict_command.py", line 265, in run
    include_affinity_percentile=not args.no_affinity_percentile)
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_presentation_predictor.py", line 217, in predict_affinity
    throw=throw)
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_affinity_predictor.py", line 982, in predict
    model_kwargs=model_kwargs
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_affinity_predictor.py", line 1051, in predict_to_dataframe
    normalized_allele = mhcnames.normalize_allele_name(allele)
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/normalization.py", line 73, in normalize_allele_name
    raw_allele, infer_pair=infer_class2_pair)
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/class2.py", line 71, in parse_classi_or_classii_allele_name
    alpha = parse_allele_name(alpha_string)
  File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/allele_name.py", line 127, in parse_allele_name
    raise AlleleParseError("Malformed MHC type %s" % original)
mhcnames.allele_parse_error.AlleleParseError: Malformed MHC type pan

The AlleleParser appears to be unable to parse the name "pan-class1". I have repeated this using both zsh and bash with the same result. If this is indeed a bug in the AlleleParser, how should one use the pan-class1 model?

timodonnell commented 4 years ago

Hi Brian,

You need to pass specific alleles to generate predictions for. The pan-class I model can predict for any of about 14,000 MHC I alleles (as opposed to the earlier models that only supported 112 alleles), but it is still is generating predictions for specific alleles. I can see why the nomenclature could be confusing though.

Tim

On Wed, Apr 8, 2020 at 3:09 PM Brian Weitzner notifications@github.com wrote:

I would like to perform a pan-allele prediction on a peptide of interest, but cannot run mhcflurry-predict with the trained pan-allele model.

After downloading the pan-allele models using mhcflurry-downloads fetch models_class1_pan, I attempt to use them by issuing

$ mhcflurry-predict --peptides PEPTIDE --alleles pan-class1 --models ~/Library/Application\ Support/mhcflurry/4/1.6.0/models_class1_pan/models.combined

In addition to the typical output, I get the following error message:

Traceback (most recent call last): File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/bin/mhcflurry-predict", line 8, in sys.exit(run()) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/predict_command.py", line 265, in run include_affinity_percentile=not args.no_affinity_percentile) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_presentation_predictor.py", line 217, in predict_affinity throw=throw) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_affinity_predictor.py", line 982, in predict model_kwargs=model_kwargs File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcflurry/class1_affinity_predictor.py", line 1051, in predict_to_dataframe normalized_allele = mhcnames.normalize_allele_name(allele) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/normalization.py", line 73, in normalize_allele_name raw_allele, infer_pair=infer_class2_pair) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/class2.py", line 71, in parse_classi_or_classii_allele_name alpha = parse_allele_name(alpha_string) File "/Users/bweitzner/miniconda3/envs/mhcflurry-env/lib/python3.6/site-packages/mhcnames/allele_name.py", line 127, in parse_allele_name raise AlleleParseError("Malformed MHC type %s" % original) mhcnames.allele_parse_error.AlleleParseError: Malformed MHC type pan

The AlleleParser appears to be unable to parse the name "pan-class1". I have repeated this using both zsh and bash with the same result. If this is indeed a bug in the AlleleParser, how should one use the pan-class1 model?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/openvax/mhcflurry/issues/159, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSHOGTGOYBTABMJZ2FKZLRLTDVXANCNFSM4MEFJFRA .

weitzner commented 4 years ago

Ah, I see! Makes sense, but I was thinking about it differently. I'll close this issue.