[Biopython-dev] Bio.SeqIO.convert function?

Brad Chapman chapmanb at 50mail.com
Tue Jul 28 22:09:43 UTC 2009


Hi Peter;

> As a possible enhancement to Bio.SeqIO, I've been toying with
> the idea of introducing another function, essentially to provide
> the following functionality:
> 
> def convert(in_handle, in_format, out_handle, out_format, alphabet=None) :
>     """Converts between two file formats, returns number of records."""
>     records = parse(in_handle, in_format, alphabet)
>     return write(records, out_handle, out_format)
[...]
> However, that isn't the real aim here. Having a function like this
> would allow a number of file format specific optimisations -
> instead of using SeqIO.parse to create SeqRecord objects
> which get converted by SeqIO.write as shown above.

I like this idea. To the extent in which we can optimize popular
conversions, this gives us a standard place to put it. There is
going to be lots of fastq to fasta conversion and being as fast as
possible is good (notice my avoidance of any more potentially
misconstrued jokes).

Conversion lately seems to be getting worse, not better, with all of
the alignment and annotation formats springing up. Extending this to
AlignIO and TreeIO as Eric suggested is also great.

So +1 from me,
Brad



More information about the Biopython-dev mailing list