[Biopython] losing information

Peter biopython at maubp.freeserve.co.uk
Thu Oct 29 12:15:36 UTC 2009


On Thu, Oct 29, 2009 at 11:48 AM, Liam Thompson <dejmail at gmail.com> wrote:
> Hi Peter
>
> There are 2000 records, but they all behave the same way
>
> I have attached 2 files, to show just 2 of them change.
>
> Thanks
> Liam

The mailing list doesn't like attachments, but I got them and
had a look. This is odd. I just tied a conversion using 1.52+
(i.e. the latest code in the repository) with:

from Bio import SeqIO
count = SeqIO.convert("original.txt", "gb", "new.txt", "gb")
print "Converted %i records" % count

or, equivalently for pre-Biopython 1.52 you can use:

from Bio import SeqIO
records = SeqIO.parse(open("original.txt"), "gb")
handle = open("new.txt", "w")
count = SeqIO.write(records, handle,  "gb")
handle.close()
print "Converted %i records" % count

See this blog post introducing the convert function:
http://news.open-bio.org/news/2009/09/biopython-convert-function/

Either way, I am seeing the features preserved (although
some of the qualifiers are in a different order). As I said
before, I thought this would work on 1.51 too - but maybe
I was wrong. Could you upgrade to 1.52 and retry?

Peter



More information about the Biopython mailing list