Wednesday, March 25, 2015

bpy14. Using esummary EUtil in Biopython

We can use Bio.Entrez.esummary to find summary (not details) of records in a database. The parameter are the ids of records we want to retrieve as well as the database name. If we want information from more than one ID, we can pass the ids as a comma delimited string.


You should give your email for Entrez.email. Biopython returns a list of length corresponding to the number of ids that are provided in the id string.


For the 2 ids, we get title of article, the authors, and journal name. We will have to find ids by using other Entrez eUtils.

# bpy14.py
from __future__ import print_function
from Bio import Entrez
Entrez.email = "Your.Name.Here@example.org"
handle = Entrez.esummary(db="pubmed", id="25741283,25798216")
record = Entrez.read(handle)
handle.close()
print('type(record) =',type(record))
print('len(record) =',len(record))
for i in range(len(record)):
    print("record:",i)
    print("title:",record[i]["Title"])
    for author in record[i]["AuthorList"]:
        print("author:",author)
    print("journal:",record[i]["FullJournalName"])
    print("")

#type(record) = <class 'Bio.Entrez.Parser.ListElement'>
#len(record) = 2
#record: 0
#title: Nitric oxide and mitochondria in metabolic syndrome.
#author: Litvinova L
#author: Atochin DN
#author: Fattakhov N
#author: Vasilenko M
#author: Zatolokin P
#author: Kirienkova E
#journal: Frontiers in physiology
#
#record: 1
#title: Maternal ancestry and population history from whole
# mitochondrial genomes.
#author: Kivisild T
#journal: Investigative genetics

No comments:

Post a Comment