[Biopython-dev] About a new GenBankWriter class with SeqIO interface

Peter biopython-dev at maubp.freeserve.co.uk
Tue May 15 20:59:55 UTC 2007


Howard Salis wrote:
> Hello everyone,
> 
>    I started using Biopython in my research and I needed a way to
> write GenBank files from a SeqRecord (which was parsed from other
> GenBank/etc files). So I wrote something up. It uses the SeqIO
> interface and behaves like the fasta writer.

Sounds nice - its something I've been thinking about doing myself, but I 
wanted to do both both GenBank and EMBL, sharing the feature table 
writing code.

Something else to keep in mind is writing any SeqRecord to a GenBank (or 
EMBL) file, even if it did not get created from a GenBank or EMBL file 
and is therefore lacking lots of annotation.

> The changes are: a new file called GenBankWriter.py in Bio/GenBank.
> Small changes to the __init__.py of Bio/GenBank. Changes to the
> _feed_first_line function of Scanner.py of Bio/GenBank.
> 
> I had to change the way Bio/GenBank/Scanner.py reads the Locus line of
> a GenBank file in order to handle missing data and newer molecule
> types (e.g. ss-RNA, ds-DNA, mt-DNA, etc).

That was recently fixed on Bug 2289
http://bugzilla.open-bio.org/show_bug.cgi?id=2289

 > I also add/change a couple
> of lines in __init__.py to store whether a sequence was linear or
> circular and to store the string that encodes its molecule type
> (ss-RNA, etc). 

I thought we already stored this information - but I'm not sure off hand.

 > The output of SeqIO.write(record,handle,"genbank") is
> functionally identical to a GenBank file from NCBI except for some
> spacing and word wrap issues.

Good :)

> What is the best way to submit new code for review? Whom do I send it
> to and should I send only the modified files?

You could email it directly to me, but it would be better to create a 
bug (an "enhancement") and then attached the changes to the bug. Edited 
versions of files will do, but patch files are best.

You should use the unix "diff" command line tool to create a patch file. 
  One way to do this on Windows is to install cygwin...

> I've included one of my test scripts below just to show how it works.
> (Does anyone suggest any changes in the interface?)

Looking at the code, at first glance it looks like you are hooking into 
the existing Bio.SeqIO interface nicely.

I look forward to seeing your code Howard.

Peter




More information about the Biopython-dev mailing list