I'm trying to download CDS sequences for a given genome using Biopython. My script looks like this:
from Bio import Entrez from Bio import SeqIO Entrez.email = "c...@gmail.com" genomeAccessions = ['NC_021353.1', 'NC_020913.1'] handle = Entrez.efetch(db="nucleotide", id=genomeAccessions, rettype="gb") records = SeqIO.parse(handle, "gb") for i,record in enumerate(records): print(len(record.features)) for feature in record.features: if feature.type == "CDS": print feature.location print feature.qualifiers["protein_id"] print feature.location.extract(record).seq
But using this code I get only one feature (for example for genome NC_021353) even though there are many features http://www.ncbi.nlm.nih.gov/nuccore/NC_021353.
I would be grateful for any suggestion what I'm doing wrong.