[BioPython] downloading Genbank files continued

Jeffrey Chang jchang at jeffchang.com
Thu May 1 14:29:15 EDT 2003


Hi Ashleigh,

It looks like something has changed with the NCBI's EUtils server.  By 
default, the Biopython Genbank dictionary retrieves sequences from the 
"Sequences" database, which is a virtual database containing 
nucleotides and proteins.  Apparently, that functionality is broken 
now.  The work-around is to specify the database when you create the 
NCBIDictionary.

Replace:
> ncbi_dict=GenBank.NCBIDictionary()

With:
ncbi_dict=GenBank.NCBIDictionary(database="nucleotide")

According to the NCBI docs:
http://www.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html
database can be:
genome, nucleotide, protein, popset

Please let me know if this does not solve your problem.

Jeff



On Wednesday, April 30, 2003, at 09:51  AM, Ashleigh Smythe wrote:

> Thanks for the comments.  To clarify further...
>
> 1.  I have downloaded sequences via the NCBI web interface for the 
> past few years but I'm doing bigger sets of taxa now and trying to 
> learn python/biopython so that's why I'm trying to learn this route 
> rather than my old web route.
>
> 2.  I am trying to download gene sequences, not proteins.
>
> 3.  As for the code I'm using I'm following the Genbank part of the 
> online tutorial from Bioinformatics.org, just trying it with a genus 
> that I know only has a few records:
>
>>>> From Bio import GenBank
>
>>>> gi_list=GenBank.search_for("Cervidellus")
>
> Then to make sure I got something I do
>
>>>> print gi_list
> ['16269590' , '6983954']
>
> Then I create a dictionary
>
>>>> ncbi_dict=GenBank.NCBIDictionary()
>
> Then to fetch the records corresponding to my gi's
>
>>>> gb_record=ncbi_dict[gi_list]
>
> This chugs along fine, indicating what year it is searching, starting 
> in 2003, and then when it hits one of my records it gives me:
>
> File ".../GenBank/__init__.py", line 1560, in __getitem__ raise 
> KeyError, "I unexpectedly got back html-formatted data."
>
> 4.  This has failed each time for me but I've only tried a few taxa - 
> maybe I should try more.
>
>
> I hope this clears things up a bit so maye someone can see what is 
> going on.
>
> Thanks again for the help!
>
> Ashleigh
> ***************************
> Ashleigh B. Smythe
> Graduate Research Assistant
> Department of Nematology
> UC Davis
> One Shield's Ave.
> Davis, CA 95616
> (530)754-4321
> absmythe at ucdavis.edu
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list