diff extract_genomic_dna_utils.py @ 7:3088e7e70888 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/extract_genomic_dna commit 4a3c9f195ba5d899b1a1ce5e80281cdf230f456a
author iuc
date Mon, 23 Oct 2017 13:26:18 -0400
parents b71579ad576c
children
line wrap: on
line diff
--- a/extract_genomic_dna_utils.py	Mon Jul 03 07:19:41 2017 -0400
+++ b/extract_genomic_dna_utils.py	Mon Oct 23 13:26:18 2017 -0400
@@ -6,6 +6,7 @@
 
 from bx.intervals.io import Comment, GenomicInterval, Header
 from bx.intervals.io import GenomicIntervalReader, NiceReaderWrapper, ParseError
+from six import Iterator
 
 # Default chrom, start, end, strand cols for a bed file
 BED_DEFAULT_COLS = 0, 1, 2, 5
@@ -99,7 +100,7 @@
         return lines
 
 
-class GFFReaderWrapper(NiceReaderWrapper):
+class GFFReaderWrapper(Iterator, NiceReaderWrapper):
     """
     Reader wrapper for GFF files which has two major functions:
     1. group entries for GFF file (via group column), GFF3 (via id attribute),
@@ -128,12 +129,12 @@
                                fix_strand=self.fix_strand)
         return interval
 
-    def next(self):
+    def __next__(self):
         """
         Returns next GFFFeature.
         """
 
-        def handle_parse_error(parse_error):
+        def handle_parse_error(e):
             """
             Actions to take when ParseError found.
             """
@@ -367,7 +368,7 @@
         # looks something like 1,2,3,
         if cols.endswith(','):
             cols += '0'
-        col_list = map(lambda x: int(x) - 1, cols.split(","))
+        col_list = [int(x) - 1 for x in cols.split(",")]
         return col_list
     else:
         return BED_DEFAULT_COLS