This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I get SeqIO.write() to make a genbank file that includes the REFERENCE field?

As I have it set up right now, Seq.IO.write(mygenbankObject, outfileHandle, genbank) seems to just write the LOCUS field, and the FEATURES field, but leaves everything else blank. It doesn't include the REFERENCE, which is what I need my final .gb file to have.

(Additionally, I don't even know what to call the titles that are in big capital letters in a genbank file. What's the technical term for the category that is: LOCUS, ORGANISM, REFERENCE, AUTHORS, FEATURES, etc...?)

Edit: I just found out those fields are called keys:

>>> record.annotations.keys()
['comment', 'sequence_version', 'source', 'taxonomy', 'keywords', 'references',
'accessions', 'data_file_division', 'date', 'organism', 'gi']

Now if only I can get the reference region

genbank python seqio biopython

1 answer

If you are creating the SeqRecord object yourself in code (rather than using the Biopython parser), you will need to create a list of Bio.SeqFeature.Reference objects as the record.annotations["references"] entry.

Or, rather than using the SeqRecord approach and Bio.SeqIO, you could use the simpler GenBank specific code in Bio.GenBank which you may find easier?

Log in to answer this question.