From 55c8a420b53302f9cc4c5a35047821891215e77f Mon Sep 17 00:00:00 2001 From: Tim O'Donnell <timodonnell@gmail.com> Date: Fri, 17 Mar 2017 01:00:02 -0400 Subject: [PATCH] fixes --- mhcflurry/class1_allele_specific_ensemble/__init__.py | 2 ++ .../class1_ensemble_multi_allele_predictor.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mhcflurry/class1_allele_specific_ensemble/__init__.py b/mhcflurry/class1_allele_specific_ensemble/__init__.py index c9dd8949..4bc67405 100644 --- a/mhcflurry/class1_allele_specific_ensemble/__init__.py +++ b/mhcflurry/class1_allele_specific_ensemble/__init__.py @@ -1,10 +1,12 @@ from .class1_ensemble_multi_allele_predictor import ( Class1EnsembleMultiAllelePredictor, get_downloaded_predictor, + supported_alleles, HYPERPARAMETER_DEFAULTS) __all__ = [ "Class1EnsembleMultiAllelePredictor", "get_downloaded_predictor", + "supported_alleles", "HYPERPARAMETER_DEFAULTS", ] diff --git a/mhcflurry/class1_allele_specific_ensemble/class1_ensemble_multi_allele_predictor.py b/mhcflurry/class1_allele_specific_ensemble/class1_ensemble_multi_allele_predictor.py index 3192fbd1..4c4d207f 100644 --- a/mhcflurry/class1_allele_specific_ensemble/class1_ensemble_multi_allele_predictor.py +++ b/mhcflurry/class1_allele_specific_ensemble/class1_ensemble_multi_allele_predictor.py @@ -58,6 +58,7 @@ HYPERPARAMETER_DEFAULTS = ( CACHED_PREDICTOR = None +CACHED_PREDICTOR_PATH = None def supported_alleles(): @@ -72,14 +73,15 @@ def get_downloaded_predictor(): """ Return a Class1AlleleSpecificPredictorLoader that uses downloaded models. """ - global CACHED_PREDICTOR + global CACHED_PREDICTOR, CACHED_PREDICTOR_PATH # Some of the unit tests manipulate the downloads directory configuration # so get_path here may return different results in the same Python process. # For this reason we check the path and invalidate the loader if it's # different. path = get_path("models_class1_allele_specific_ensemble") - if CACHED_PREDICTOR is None or path != CACHED_PREDICTOR.path: + if CACHED_PREDICTOR_PATH != path: + CACHED_PREDICTOR_PATH = path CACHED_PREDICTOR = ( Class1EnsembleMultiAllelePredictor .load_from_download_directory(path)) -- GitLab