[bip] Blog post on bioinformatics and Python

Peter biopython at maubp.freeserve.co.uk
Thu Sep 18 09:42:28 PDT 2008


Titus Brown wrote:
>
> Why not:
>
>   data = list(data)
>
> ?  That will take any iterator/generator and turn it into a list.
> There's no real penalty for doing this (if you need a random access
> list, then you need to fully parse the file anyway!), and you can
> convert it into a dictionary pretty easily, too.

We this in the Biopython tutorial in the context of turning a SeqIO
sequence iterator into a list, but perhaps it warrants a mention in
the BLAST parsing section too.

> OTOH, frustration with the opaqueness of BioPython BLAST objects (and
> the use of crmpd 'sbjct' vrbl nms) led me to write my own blastparser
> with objecs that had a useful 'dir', were debuggable by me, had lots of
> automated tests, etc.  You could take a look at that, although it is
> sloooooooooooooooooooooow.
>
>        http://darcs.idyll.org/~t/projects/blastparser/
>        http://darcs.idyll.org/~t/projects/blastparser-latest.tar.gz
>

In order to maintain backwards compatibility, we are unfortunately
stuck with the compressed variable names now (although we could add
aliases).  Having a go at improving the explorablity of the BLAST
object structure at the python prompt is a fairly specific and
concrete target.  Making the __str__ and __repr__ methods here more
helpful is something I'd been meaning to have a go at.

The Biopython BLAST parsers already have plenty of tests - but I'm
sure there is room for more.  What license is your code under, and in
particular could we use any of your test files in Biopython?

Peter



More information about the biology-in-python mailing list