Skip to content
Snippets Groups Projects
Commit e48e9387 authored by Tim O'Donnell's avatar Tim O'Donnell
Browse files

test fixes

parent a61ae05c
No related branches found
No related tags found
No related merge requests found
......@@ -87,7 +87,8 @@ def get_default_class1_models_dir(test_exists=True):
if test_exists and not exists(result):
raise IOError("No such directory: %s" % result)
return result
return get_path("models_class1", "models", test_exists=test_exists)
return get_path(
"models_class1_pan", "models.combined", test_exists=test_exists)
def get_default_class1_presentation_models_dir(test_exists=True):
......
......@@ -139,7 +139,7 @@ def test_large(sample_rate=1.0):
pan_train_df = pandas.read_csv(
get_path(
"models_class1_pan", "models.with_mass_spec/train_data.csv.bz2"))
"models_class1_pan", "models.combined/train_data.csv.bz2"))
pan_sub_train_df = pan_train_df
pan_sub_train_df["label"] = pan_sub_train_df["measurement_value"]
del pan_sub_train_df["measurement_value"]
......@@ -149,7 +149,7 @@ def test_large(sample_rate=1.0):
multi_train_df = multi_train_df.sample(frac=sample_rate)
pan_predictor = Class1AffinityPredictor.load(
get_path("models_class1_pan", "models.with_mass_spec"),
get_path("models_class1_pan", "models.combined"),
optimization_level=0,
max_models=1)
......
......@@ -20,7 +20,7 @@ setup = startup
def run_and_check(n_jobs=0, delete=True, additional_args=[]):
source_models_dir = get_path("models_class1_pan", "models.with_mass_spec")
source_models_dir = get_path("models_class1_pan", "models.combined")
dest_models_dir = tempfile.mkdtemp(prefix="mhcflurry-test-models")
# Save a new predictor that has no percent rank calibration data.
......@@ -40,7 +40,7 @@ def run_and_check(n_jobs=0, delete=True, additional_args=[]):
"mhcflurry-calibrate-percentile-ranks",
"--models-dir", dest_models_dir,
"--match-amino-acid-distribution-data", get_path(
"data_curated", "curated_training_data.no_mass_spec.csv.bz2"),
"data_curated", "curated_training_data.affinity.csv.bz2"),
"--motif-summary",
"--num-peptides-per-length", "1000",
"--allele", "HLA-A*02:01", "HLA-B*07:02",
......
......@@ -44,7 +44,7 @@ def test_class1_neural_network_a0205_training_accuracy():
df = pandas.read_csv(
get_path(
"data_curated", "curated_training_data.no_mass_spec.csv.bz2"))
"data_curated", "curated_training_data.affinity.csv.bz2"))
df = df.loc[
df.allele == allele
]
......
......@@ -2,6 +2,10 @@
Profile prediction speed
"""
import logging
logging.getLogger('tensorflow').disabled = True
logging.getLogger('matplotlib').disabled = True
import numpy
numpy.random.seed(0)
import time
......@@ -32,7 +36,7 @@ def setup():
get_path("models_class1", "models"))
PAN_ALLELE_PREDICTOR = Class1AffinityPredictor.load(
get_path("models_class1_pan", "models.with_mass_spec"))
get_path("models_class1_pan", "models.combined"))
def teardown():
......
......@@ -65,7 +65,7 @@ def run_and_check(n_jobs=0):
args = [
"mhcflurry-class1-train-allele-specific-models",
"--data", get_path("data_curated", "curated_training_data.no_mass_spec.csv.bz2"),
"--data", get_path("data_curated", "curated_training_data.affinity.csv.bz2"),
"--hyperparameters", hyperparameters_filename,
"--allele", "HLA-A*02:01", "HLA-A*03:01",
"--out-models-dir", models_dir,
......@@ -117,7 +117,7 @@ def run_and_check_with_model_selection(n_jobs=1):
args = [
"mhcflurry-class1-train-allele-specific-models",
"--data", get_path("data_curated", "curated_training_data.no_mass_spec.csv.bz2"),
"--data", get_path("data_curated", "curated_training_data.affinity.csv.bz2"),
"--hyperparameters", hyperparameters_filename,
"--allele", "HLA-A*02:01", "HLA-A*03:01",
"--out-models-dir", models_dir1,
......@@ -135,7 +135,7 @@ def run_and_check_with_model_selection(n_jobs=1):
args = [
"mhcflurry-class1-select-allele-specific-models",
"--data",
get_path("data_curated", "curated_training_data.no_mass_spec.csv.bz2"),
get_path("data_curated", "curated_training_data.affinity.csv.bz2"),
"--exclude-data", models_dir1 + "/train_data.csv.bz2",
"--out-models-dir", models_dir2,
"--models-dir", models_dir1,
......
......@@ -116,7 +116,7 @@ def run_and_check(n_jobs=0, delete=True, additional_args=[]):
json.dump(HYPERPARAMETERS_LIST, fd)
data_df = pandas.read_csv(
get_path("data_curated", "curated_training_data.no_mass_spec.csv.bz2"))
get_path("data_curated", "curated_training_data.affinity.csv.bz2"))
selected_data_df = data_df.loc[data_df.allele.str.startswith("HLA-A")]
selected_data_df.to_csv(
os.path.join(models_dir, "_train_data.csv"), index=False)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment