Issue #2 resolved

bug in bx.intervals.io

James Taylor
repo owner created an issue

(originally from martin.goodson@dpag.ox.ac.uk)

there is a bug in the function bx.intervals.io.binned_bitsets the 'size' variable is only set when the condition (chrom not in bitsets) on line 140 is true. Therefore if the file is not in chromosome order the size variable will be inappropriately set to the previous 'newly formed' chromosome rather than the current chromosome. This causes problems on line 152.

this is from the latest build today. Checkedout like this: svn co http://www.bx.psu.edu/svn/bx-python/trunk/ bx-python-trunk

Possible patch

{{{ --- /net/cpp-group/martin/python/bx-python-trunk/lib/bx/intervals/io.py 2008-08-19 17:54:35.000000000 +0100 +++ /net/cpp-group/martin/python/bx-python-trunk/build/lib.linux-x86_64-2.5/bx/intervals/io.py 2008-08-19 17:54:07.000000000 +0100 @@ -146,8 +146,9 @@

bitsets[chrom] = bbs

last_chrom = chrom last_bitset = bitsets[chrom]

  • last_size=last_bitset.size

start = max( int( interval[self.start_col] ), 0 )

  • end = min( int( interval[self.end_col] ), size) + end = min( int( interval[self.end_col] ), last_size)

last_bitset.set_range( start, end-start )

return bitsets }}}

Comments (1)

  1. Log in to comment