[Biopython] Entrez.efetch from gene

Edith Schlagenhauf ediths at botinst.uzh.ch
Wed Jan 26 06:05:35 EST 2011


Using retmode='xml' returns the data in XML format, ie.

handle = Entrez.efetch(db=search_database, id =reclist[0], retmode='xml')

# the Bio.Entrez.read()The Bio.Entrez.read() function can parse most (if 
# not all) XML output returned by Entrez.

record = Entrez.read(handle)
handle.close()

print record[0].keys()                 # prints list of available keys
print record[0]["Entrezgene_rna"]      # example key



HTH,
Edith


******************************************
Dr Edith Schlagenhauf
University of Zurich
SWITZERLAND

e-mail: ediths AT botinst DOT uzh DOT ch
******************************************


On Tue, 25 Jan 2011, Michael Fahy wrote:

> Trying to use Entrez.efetch() to query the gene database.
>
> The efetch help at
> http://www.ncbi.nlm.nih.gov/entrez/query/static/efetchseq_help.html says
> there are no retrieval types supported by the gene database.  If I do an
> efetch query without specifying a value for rettype, it returns html.  Is
> there a way in Biopython to parse this html?  Or is there another way to
> query the gene database so it will return data that can be parsed?
>
> Sample code:
>
> from Bio import Entrez
> Entrez.email = 'email at chapman.edu'
>
> search_database = 'gene'
> search_term = 'YIL065C'
>
> handle = Entrez.esearch(db='gene',term=search_term)
> record = Entrez.read(handle)
> reclist = record['IdList']
>
> handle = Entrez.efetch(db=search_database,  id =reclist[0])
>
> myrecord = handle.read()
> print myrecord
>
> ----------------------------------------------------------
> Michael A. Fahy
> fahy at chapman.edu
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>


More information about the Biopython mailing list