How do I get SeqIO.write() to make a genbank file that includes the REFERENCE field?
1
0
Entering edit mode
5.8 years ago
Tom ▴ 20

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

biopython SeqIO python genbank • 1.6k views
0
Entering edit mode
5.7 years ago
Peter 6.0k

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?