Monday, March 23, 2015

bpy11. Using Entrez EUtils in Biopython

We can use Bio.Entrez to use the different EUtils at NCBI Entrez.


There are 9 utilities, and currently 8 of them can be accessed using Bio.Entrez. The 9th is the most recent, ECitMatch. Other than using Biopython, you can also use HTML requests with appropriate query term, name of EUtil, etc. It can return data as XML, Python object, etc.


Before going into details of the different EUtils, this program just lists some documentation. You can get complete documentation by removing 2 from docL term, in which case it will print all the lines.

# bpy11.py

from __future__ import print_function, division
from Bio import Entrez

eUtils = [e for e in Entrez.__dict__ if e[0]=='e' and e != 'email']
for i,eUtil in enumerate(eUtils):
    print('%d.%s' % (i+1,eUtil))
    exec('doc=Entrez.%s.__doc__' % eUtil)
    docL = doc.split('\n')
    print(''.join(docL[:2]))
    print('')

#1.espell
#ESpell retrieves spelling suggestions, returned in a results handle.
#
#2.egquery
#EGQuery provides Entrez database counts for a global search.
#
#3.esummary
#ESummary retrieves document summaries as a results handle.
#
#4.efetch
#Fetches Entrez results which are returned as a handle.
#
#5.esearch
#ESearch runs an Entrez search and returns a handle to the results.
#
#6.elink
#ELink checks for linked external articles and returns a handle.
#
#7.einfo
#EInfo returns a summary of the Entez databases as a results handle.
#
#8.epost
#Post a file of identifiers for future use.

No comments:

Post a Comment