diff genetrack_util.py @ 4:b41a4bb828a3 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/genetrack commit 2772547f531819d3f6d892ed041fa39b82e3550f
author iuc
date Wed, 05 Jul 2017 11:56:54 -0400
parents 41887967ef14
children
line wrap: on
line diff
--- a/genetrack_util.py	Sat Jan 21 14:41:43 2017 -0500
+++ b/genetrack_util.py	Wed Jul 05 11:56:54 2017 -0400
@@ -6,6 +6,7 @@
 import tempfile
 
 import numpy
+from six import Iterator
 
 GFF_EXT = 'gff'
 SCIDX_EXT = 'scidx'
@@ -41,7 +42,7 @@
     return data
 
 
-class ChromosomeManager(object):
+class ChromosomeManager(Iterator):
     """
     Manages a CSV reader of an index file to only load one chrom at a time
     """
@@ -53,8 +54,8 @@
         self.current_index = 0
         self.next_valid()
 
-    def next(self):
-        self.line = self.reader.next()
+    def __next__(self):
+        self.line = next(self.reader)
 
     def is_valid(self, line):
         if len(line) not in [4, 5, 9]:
@@ -77,10 +78,10 @@
         """
         Advance to the next valid line in the reader
         """
-        self.line = self.reader.next()
+        self.line = next(self.reader)
         s = 0
         while not self.is_valid(self.line):
-            self.line = self.reader.next()
+            self.line = next(self.reader)
             s += 1
         if s > 0:
             # Skip initial line(s) of file
@@ -115,7 +116,7 @@
                 self.current_index = read[0]
                 self.add_read(read)
             try:
-                self.next()
+                next(self)
             except StopIteration:
                 self.done = True
                 break
@@ -271,7 +272,7 @@
         return math.exp(-x * x / (2 * sigma2))
 
     # width is the half of the distribution
-    values = map(normal_func, range(-width, width))
+    values = list(map(normal_func, range(-width, width)))
     values = numpy.array(values, numpy.float)
     # normalization
     if normalize: