[BioPython] SeqRecord to Genbank: use SeqIO?

Cedar McKay cmckay at u.washington.edu
Fri Aug 1 01:45:15 UTC 2008


Hello, I have SeqRecord objects that I'd like to convert to a string  
that is in Genbank format. That way I can do whatever with it,  
including write it to a file. The only way I can see to do anything  
similar is using SeqIO and doing something like:

SeqIO.write(my_records, out_file_handle, "genbank")
which I found here:
http://biopython.org/DIST/docs/tutorial/Tutorial.html#chapter:Bio.SeqIO

The problem is, it doesn't support something like:
SeqIO.write(seq_record, out_file_handle, "genbank")
Because it requires an iterable object I guess? And it has to write to  
a file handle for some reason, and won't just give me the string to do  
whatever I want with.

I've done a lot of searching and mailing lists, and googling, and  
surely I must be missing something? What is the simplest way to get a  
string representing a genbank file, starting with a SeqRecord?

I'm sort of shocked that there isn't some sort of  
SeqRecord.to_genbank() method.

Hope someone can point me in the right direction!

best,
Cedar





More information about the Biopython mailing list