[Biopython] Fwd: Bug in bgzf module
Petra Kubincová
petra.kubincova at gmail.com
Thu Jan 31 22:57:29 UTC 2013
Hi Peter,
well, I don't have much experience with unit tests but I will try to come
up with something. :)
I'll let you know if I won't succeed.
And yes, recording an index is exactly the thing I need to do. (I am
currently working on interval mapping tool for multiple whole-genome
alignments, where I need to read .maf file, write preprocessed data into a
compressed file and then work just with index for the compressed file and
the compressed file itself to do the mapping.)
Have a nice day,
Petra
On Wed, Jan 30, 2013 at 11:12 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:
> On Wed, Jan 30, 2013 at 9:50 PM, Petra Kubincová
> <petra.kubincova at gmail.com> wrote:
> > Hello,
> >
> > recently I have installed and tried out biopython 1.60, especially bgzf
> > module. I have discovered that calling method "tell()" of object of
> > bgzf.BgzfWriter type raises this error:
> >
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File "/usr/local/lib/python2.6/dist-packages/Bio/bgzf.py", line 743, in
> > tell
> > return make_virtual_offset(self.handle.tell(), len(self._buffer))
> > AttributeError: 'BgzfWriter' object has no attribute 'handle'
> >
> > I've checked out source code of bgzf module. Source code of error-raising
> > method "tell()" looks like this:
> >
> > def tell(self):
> > """Returns a BGZF 64-bit virtual offset."""
> > return make_virtual_offset(self.handle.tell(), len(self._buffer))
> >
> > The problem is that BgzfWriter does not have variable called "handle",
> only
> > "_handle". So (IMHO) all that needs to be done to fix this bug is change
> > "self.handle.tell()" to "self._handle.tell()".
> >
> > Cheers,
> > Petra Kubincova
>
> Hi Petra,
>
> It is nice to know people are using this relatively new code :)
>
> Thank you for pointing that out, that is the correct fix:
>
> https://github.com/biopython/biopython/commit/2a1be2f3e9b731fa05cc4ad7a01a67866155827c
>
> We should add a unit test for this too, in Tests/test_bgzf.py -
> is that something you'd like to try and do? If not I'll try to
> remember to add something myself.
>
> The reason I implemented the BgzfWriter tell method was for
> the use-case of writing a BGZF compressed file while also
> recording an index. I'm curious if that's what you are doing,
> or if you had another purpose?
>
> Thanks,
>
> Peter
>
More information about the Biopython
mailing list