From 97322cb723a662465db932da8446afb5a2d81a99 Mon Sep 17 00:00:00 2001
From: Tim O'Donnell <timodonnell@gmail.com>
Date: Thu, 26 Sep 2019 16:20:49 -0400
Subject: [PATCH] fix

---
 mhcflurry/random_negative_peptides.py        | 9 ++++++++-
 test/test_changing_allele_representations.py | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/mhcflurry/random_negative_peptides.py b/mhcflurry/random_negative_peptides.py
index 1afa3045..96f48665 100644
--- a/mhcflurry/random_negative_peptides.py
+++ b/mhcflurry/random_negative_peptides.py
@@ -14,7 +14,7 @@ class RandomNegativePeptides(object):
         random_negative_constant=25,
         random_negative_match_distribution=True,
         random_negative_distribution_smoothing=0.0,
-        random_negative_method="by_length",
+        random_negative_method="recommended",
         random_negative_binder_threshold=None,
         random_negative_lengths=[8,9,10,11,12,13,14,15])
 
@@ -63,6 +63,13 @@ class RandomNegativePeptides(object):
             ]
 
         method = self.hyperparameters['random_negative_method']
+        if method == 'recommended':
+            # by_length for allele-specific prediction and by_allele for pan.
+            method = (
+                "by_length"
+                if alleles is None else
+                "by_allele")
+
         function = {
             'by_length': self.plan_by_length,
             'by_allele': self.plan_by_allele,
diff --git a/test/test_changing_allele_representations.py b/test/test_changing_allele_representations.py
index 271cb3d9..cafeac16 100644
--- a/test/test_changing_allele_representations.py
+++ b/test/test_changing_allele_representations.py
@@ -1,3 +1,7 @@
+import logging
+logging.getLogger('matplotlib').disabled = True
+logging.getLogger('tensorflow').disabled = True
+
 import time
 import pandas
 
-- 
GitLab