From 763931b82fad005837eb5cbf81d00d9961339c1b Mon Sep 17 00:00:00 2001
From: Venkat Malladi <venkat.malladi@utsouthwestern.edu>
Date: Sun, 19 Nov 2017 10:50:22 -0600
Subject: [PATCH] Remove extra sort from rescaling causing issues.

---
 workflow/scripts/utils.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/workflow/scripts/utils.py b/workflow/scripts/utils.py
index e9f4a77..a501673 100644
--- a/workflow/scripts/utils.py
+++ b/workflow/scripts/utils.py
@@ -7,6 +7,7 @@ import shlex
 import logging
 import subprocess
 import sys
+import os
 
 
 logger = logging.getLogger(__name__)
@@ -109,10 +110,12 @@ def rescale_scores(filename, scores_col, new_min=10, new_max=1000):
     b = max_score
     x = new_min
     y = new_max
+
     if min_score == max_score:  # give all peaks new_min
         rescale_formula = "x"
     else:  # n is the unscaled score from scores_col
         rescale_formula = "((n-a)*(y-x)/(b-a))+x"
+
     out, err = run_pipe(
         [
             'cat %s' % (sorted_fn),
@@ -122,4 +125,7 @@ def rescale_scores(filename, scores_col, new_min=10, new_max=1000):
             % (scores_col, rescale_formula)
         ],
         rescaled_fn)
+
+    os.remove(sorted_fn)
+
     return rescaled_fn
-- 
GitLab