I really appreciate the (post martel) biopython parsing abilities of SeqIO.
Question: is the circular vs linear info from first line (LOCUS) tossed when parsing a genbank genome (complete sequence) file?
eg.
LOCUS NC_001337 11014 bp DNA circular BCT 18-JUL-2008
DEFINITION Methanothermobacter thermautotrophicus Z-245 plasmid pFZ1, complete sequence.
It seems strange, but I can't find it anywhere in the SeqRecord. Not a big deal of course because I can parse it myself, but curious why I can't find it. Maybe not always present?
2 answers
The GenBank specific record contains this information as residue_type:
from Bio.GenBank import RecordParser
parser = RecordParser()
gb_rec = parser.parse(open("sequence.gb"))
gb_rec.residue_type
'DNA circular'
It would be nice if this were also available as an annotation of the more general SeqRecords from SeqIO. There has been some recent discussion and this just needs a push to get included in the next release. Your input on the best place to store it would definitely be appreciated:
SeqIO still loses it as of 2015 at least on my version. Another thing it does is make the version the same as the accession. I end up using this function:
def botchjob(filepath, acc, v):
f = open(filepath, "rU")
txt = f.read()
txt=txt.replace("VERSION "+acc, "VERSION " + str(v)).replace("DNA ", "DNA circular ")
f.close()
open(filepath, "w").write(txt)
Log in to answer this question.
OMG! I think you could be right! GenBank only stores genomic topology in the LOCUS line! I've just checked with a real sequence. No sign of LOCUS anywhere. It seems that write_first_line uses record.name, too! So, if SeqIO you gbfile you'll lose that informatio! WOW!