From 337b1039ef21decdb71026d5dedfd4005ba64cac Mon Sep 17 00:00:00 2001
From: Tim O'Donnell <timodonnell@gmail.com>
Date: Sat, 11 Feb 2017 16:23:45 -0500
Subject: [PATCH] More test output

---
 mhcflurry/antigen_presentation/percent_rank_transform.py | 2 +-
 test/test_antigen_presentation.py                        | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mhcflurry/antigen_presentation/percent_rank_transform.py b/mhcflurry/antigen_presentation/percent_rank_transform.py
index 5d729f1c..1895635c 100644
--- a/mhcflurry/antigen_presentation/percent_rank_transform.py
+++ b/mhcflurry/antigen_presentation/percent_rank_transform.py
@@ -24,7 +24,7 @@ class PercentRankTransform(object):
         self.cdf[0] = 0.0
         self.cdf[1] = 0.0
         self.cdf[-1] = 100.0
-        numpy.cumsum(hist / numpy.sum(hist) * 100.0, out=self.cdf[2:-1])
+        numpy.cumsum(hist * 100.0 / numpy.sum(hist), out=self.cdf[2:-1])
         assert not numpy.isnan(self.cdf).any()
 
     def transform(self, values):
diff --git a/test/test_antigen_presentation.py b/test/test_antigen_presentation.py
index 16d31bc0..d46d0f8b 100644
--- a/test/test_antigen_presentation.py
+++ b/test/test_antigen_presentation.py
@@ -1,7 +1,7 @@
 from nose.tools import eq_, assert_less
 
 import numpy
-from numpy.testing import assert_almost_equal
+from numpy.testing import assert_allclose
 import pandas
 from mhcflurry import amino_acid
 from mhcflurry.antigen_presentation import (
@@ -76,9 +76,10 @@ del HITS_DF["hit"]
 def test_percent_rank_transform():
     model = percent_rank_transform.PercentRankTransform()
     model.fit(numpy.arange(1000))
-    assert_almost_equal(
+    assert_allclose(
         model.transform([-2, 0, 50, 100, 2000]),
-        [0.0, 0.0, 5.0, 10.0, 100.0])
+        [0.0, 0.0, 5.0, 10.0, 100.0],
+        err_msg=str(model.__dict__))
 
 
 def test_mhcflurry_trained_on_hits():
-- 
GitLab