[Biopython] Querying NCBI

Peter biopython at maubp.freeserve.co.uk
Fri Oct 23 14:43:40 UTC 2009


On Fri, Oct 23, 2009 at 3:35 PM, Michael S. Koeris
<michael.koeris at gmail.com> wrote:
>
> That's a good idea how do I do that though?

Something like this:

from Bio import Entrez
Entrez.email = "michael.koeris at gmail.com"
gi = "12345678"
out_handle = open("%s.gbk" % gi, "w")
network_handle = Entrez.efetch(db="nucleotide", id=gi, rettype="gb")
for line in network_handle : out_handle.write(line)
out_handle.close()
network_handle.close()

Stick that in a for loop if you want a separate file for each record.

Is the Biopython tutorial not clear enough on this?

Peter



More information about the Biopython mailing list