Commits

Daniel Blankenberg committed c39a398

Remove recursive call from interval.io.BitsetSafeReaderWrapper.next().

  • Participants
  • Parent commits 39187da

Comments (0)

Files changed (1)

lib/bx/intervals/io.py

         NiceReaderWrapper.__init__( self, reader.input )
         self.lens = lens
     def next( self ):
-        rval = NiceReaderWrapper.next( self )
-        if type( rval ) == GenomicInterval:
-            if rval.end > self.lens.get( rval.chrom, MAX ): # MAX_INT is defined in bx.bitset
+        while True:
+            rval = NiceReaderWrapper.next( self )
+            if type( rval ) == GenomicInterval and rval.end > self.lens.get( rval.chrom, MAX ): # MAX_INT is defined in bx.bitset
                 try:
                     # This will only work if reader is a NiceReaderWrapper
                     self.skipped += 1
                         self.skipped_lines.append( ( self.linenum, self.current_line, str( e ) ) )
                 except:
                     pass
-                return self.next()
-        return rval
+            else:
+                return rval