openvax / mhcflurry

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

Structure of downloads for Class1ProcessingPredictor #181

Closed kevinkovalchik closed 3 years ago

kevinkovalchik commented 3 years ago

Hello!

I am using version 2.0.1 in Python 3.8.5 on an Ubuntu system.

I think I found a bug with the Class1ProcessingPredictor class. When I try to load it, I get this error:

>>> process_pred = mhcflurry.Class1ProcessingPredictor.load()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Data/Development/PercMhc/venv/lib/python3.8/site-packages/mhcflurry/class1_processing_predictor.py", line 381, in load
    models_dir = get_default_class1_processing_models_dir()
  File "/Data/Development/PercMhc/venv/lib/python3.8/site-packages/mhcflurry/downloads.py", line 154, in get_default_class1_processing_models_dir
    return get_path(
  File "/Data/Development/PercMhc/venv/lib/python3.8/site-packages/mhcflurry/downloads.py", line 221, in get_path
    raise RuntimeError(
RuntimeError: Missing MHCflurry downloadable file: /home/labcaron/.local/share/mhcflurry/4/2.0.0/models_class1_processing/models. To download this data, run:
    mhcflurry-downloads fetch models_class1_processing
in a shell.

but I have already downloaded the models for class1 processing. I tried deleting the download folder and downloading again, but the same error occurs.

Digging into the exception message, from line 154-155 of downloads.py it looks like it is looking for a folder in the models_class1_processing directory called "models":

    return get_path(
        "models_class1_processing", "models", test_exists=test_exists)

but no such folder exists after running the download command: image

If I explicitly tell it which model folder to load then it works fine:

process_pred = mhcflurry.Class1ProcessingPredictor.load(models_dir='/home/labcaron/.local/share/mhcflurry/4/2.0.0/models_class1_processing/models.selected.no_flank')

Perhaps it would be good to have an argument to specify which model to use (i.e. no_flanks, short_flanks, or with_flanks) and use that to construct the correct path? Or at least the default value should point to a folder that exists. :)

Best wishes, Kevin

timodonnell commented 3 years ago

Good catch, thanks Kevin. That is indeed a bug. We'll get a fix in for the next release.

kevinkovalchik commented 3 years ago

Okay! Thanks.