From 1cae85f6d29595ca2d34660b126247219587b989 Mon Sep 17 00:00:00 2001
From: Tim O'Donnell <timodonnell@gmail.com>
Date: Sun, 28 Jan 2018 15:17:51 -0500
Subject: [PATCH] cache peptide encoding in percentile rank calibration

---
 mhcflurry/class1_affinity_predictor.py            | 2 +-
 mhcflurry/train_allele_specific_models_command.py | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mhcflurry/class1_affinity_predictor.py b/mhcflurry/class1_affinity_predictor.py
index 1bbefd41..fa2023eb 100644
--- a/mhcflurry/class1_affinity_predictor.py
+++ b/mhcflurry/class1_affinity_predictor.py
@@ -933,7 +933,7 @@ class Class1AffinityPredictor(object):
         encoded_peptides = EncodableSequences.create(peptides)
 
         for (i, allele) in enumerate(alleles):
-            predictions = self.predict(peptides, allele=allele)
+            predictions = self.predict(encoded_peptides, allele=allele)
             transform = PercentRankTransform()
             transform.fit(predictions, bins=bins)
             self.allele_to_percent_rank_transform[allele] = transform
diff --git a/mhcflurry/train_allele_specific_models_command.py b/mhcflurry/train_allele_specific_models_command.py
index 87fe6b01..3d72b32a 100644
--- a/mhcflurry/train_allele_specific_models_command.py
+++ b/mhcflurry/train_allele_specific_models_command.py
@@ -9,6 +9,7 @@ import time
 import traceback
 from multiprocessing import Pool
 from functools import partial
+from pprint import pprint
 
 import pandas
 import yaml
@@ -363,7 +364,7 @@ def train_model(
         # For the first model for the first allele, print the architecture.
         print("*** HYPERPARAMETER SET %d***" %
               (hyperparameter_set_num + 1))
-        print(hyperparameters)
+        pprint(hyperparameters)
         print("*** ARCHITECTURE FOR HYPERPARAMETER SET %d***" %
               (hyperparameter_set_num + 1))
         model.network(borrow=True).summary()
-- 
GitLab