[Biopython-dev] SeqIO Abi Parser
Peter Cock
p.j.a.cock at googlemail.com
Thu Aug 4 11:03:27 UTC 2011
On Wed, Aug 3, 2011 at 4:11 PM, Wibowo Arindrarto
<w.arindrarto at gmail.com> wrote:
> On Wed, Aug 3, 2011 at 16:04, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>> ...
>> Congratulations, your code will be in the next Biopython release.
>> ...
>
> This really made my day :)! You're welcome and thank you reviewing my code,
> too!
I found something else to work on (sorry!). You're using seek and tell, which
may not exist. Network handles are a good example of this situation. Try:
from urllib import urlopen
from Bio import SeqIO
handle = urlopen("http://biopython.org/SRC/biopython/Tests/Abi/310.ab1")
record = SeqIO.read(handle, "abi")
handle.close()
I've added some code to test_SeqIO.py to simulate this, which revealed that
the SFF parser was also using the tell method. In that case we must track the
offset explicitly (it is needed for handling SFF index blocks). You can see how
I did this here - note I avoid the overhead of tracking the offset in general:
https://github.com/biopython/biopython/commit/9a3c44b28aae256b8da825c3c1553d71dbe329cc
I've tried the same trick in the ABI parser, but this reveals your code likes to
seek backwards. Try the attached patch against this revision to confirm this.
Having looked over your code, I don't believe you need to use seek and tell
at all. This isn't critical to fix right now, but I would like us to
solve it. Would
you like to try? Make a new branch from the current master for this please.
Regards,
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tell_hack.patch
Type: application/octet-stream
Size: 1466 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/biopython-dev/attachments/20110804/bd28e873/attachment.obj>
More information about the Biopython-dev
mailing list