[Biopython] Issues parsing genbank files

David Martin (Staff) d.m.a.martin at dundee.ac.uk
Tue Oct 3 09:39:11 UTC 2017


Hi folks,

I'm trying to parse some bacterial genomes. I've lifted the following code from the biopython tutorial but it seems to be giving issues.

from Bio import Entrez
from Bio import SeqIO
Entrez.email = "A.N.Other at example.com"
with Entrez.efetch(db="nucleotide", rettype="gb", retmode="text", id="nc_003197") as handle:
    seq_record = SeqIO.read(handle, "gb") #using "gb" as an alias for "genbank"
print("%s with %i features" % (seq_record.id, len(seq_record.features)))

I get one feature instead of the thousands expected.

Trying to extract a single gene I get a run of NN instead of sequence.

Thoughts: This is initially retrieved as a set of annotations but no sequence. Is there a way to ensure entrez retrieves the full data?

..d
<//sig/>


[University of Dundee shield logo]<http://uod.ac.uk/sig-home>





Dr David M A Martin PhD FRSB
Senior Lecturer in Bioinformatics
School of Life Sciences, University of Dundee
+44(0)1382 388704 | d.m.a.martin at dundee.ac.uk<mailto:d.m.a.martin at dundee.ac.uk@dundee.ac.uk>


[University of Dundee Facebook]<http://uod.ac.uk/sig-fb>[University of Dundee Twitter]<http://uod.ac.uk/sig-tw>[University of Dundee LinkedIn]<http://uod.ac.uk/sig-li>[University of Dundee YouTube]<http://uod.ac.uk/sig-yt>[University of Dundee Instagram]<http://uod.ac.uk/sig-ig>[University of Dundee Snapchat]<http://uod.ac.uk/sig-sc>

We're Scottish University of the Year again!<http://uod.ac.uk/sig-strapline>
The Times / Sunday Times Good University Guide 2016 and 2017



The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20171003/1a393c2c/attachment.html>


More information about the Biopython mailing list