[Biopython-dev] [Biopython] SeqIO.index improvement suggestions

Peter biopython at maubp.freeserve.co.uk
Sun Dec 20 18:06:33 UTC 2009


On Sat, Dec 19, 2009 at 10:42 PM, Eric Talevich wrote:
> On Sat, Dec 19, 2009 at 1:57 AM, Peter wrote:
>>
>> This is a vague idea (which I haven't tried yet), but maybe the
>> Bio.SeqIO.index() function could take an optional argument
>> (gzip=True, or something more general like archive=...) which
>> would cause the file to be opened via the gzip module instead?
>
> Or: open=open -- accept a function that opens the file; by default, the
> built-in open function, but easily replaced by gzip.open, bz2.BZ2File, or a
> user-defined function to open zip files (since that's less straightforward).

That's what I had in mind with the "archive=..." bit (I should have
been clearer), but "open" is probably a better name for it (assuming
it isn't going to become a reserved word in future versions of Python).

> Otherwise, since the variety of archive formats supported by the Python
> standard library is limited, archive='gzip'|'bz2'|'zip' sounds good.

That would work, but as you say, it is rather limited.

Peter



More information about the Biopython-dev mailing list