[Biopython] Issue in retrieving Pubmed Ids

sai nitin sainitin7 at gmail.com
Fri Aug 9 19:12:39 UTC 2013


Hi all,

I have set of genes ( ASCL1, AEBP1, MLF1) i want to search PUBMED for
literature in glioma. Means i want to get Pubmed Ids for these genes in
glioma. To achieve this i tried biopython script as follows. First i stored
this terms in file as follows

ASCL1 and glioma

AEBP1 and glioma

.....

infile = "file.txt"

for line in infile.readlines():

  single_id = line

  #Retreiving information

  data = Entrez.esearch(db="pubmed",term = single_id)

  res=Entrez.read(data)

  PMID = res["IdList"]

  print "%s" %(PMID)

  out_put.write("%s\n" %(PMID))

out_put.close()

It reads only first line ASCL1 and glioma ... and gives result as follows

['22859994', '18796682', '18636433', '17146289', '17124508', '16103883',
'11433425']

Traceback (most recent call last):

  File "PUBMED.py", line 13, in <module>

    res=Entrez.read(data)

  File "/Library/Python/2.7/site-packages/Bio/Entrez/__init__.py", line
367, in read

    record = handler.read(handle)

  File "/Library/Python/2.7/site-packages/Bio/Entrez/Parser.py", line 184,
in read

    self.parser.ParseFile(handle)

  File "/Library/Python/2.7/site-packages/Bio/Entrez/Parser.py", line 322,
in endElementHandler

    raise RuntimeError(value)

RuntimeError: Empty term and query_key - nothing todo


It looks like it does not read second line..in file.txt..Can any body tell
how to solve this issue..


Thanks,

-- 

Sainitin D



More information about the Biopython mailing list