This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieve Pubmed Ids

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 acheive this i tried biopython script as follows

from Bio Import Entrez
Entrez.email = "my email"
data = Entrez.esearch(db="pubmed",term = "ASCL1 and glioma", "AEBP1 and glioma")
res=Entrez.read(data)
PMID = res["IdList"]
print PMID

It doesnt work it gives following error SyntaxError: non-keyword arg after keyword arg

As I am new to biopython i am not able to solve this problem..

Can any body please let me know how to parse multiple terms and get pubmed Ids

Thanks Ni

biopython

2 answers

Hi Nitin,

try that code:

from Bio import Entrez
Entrez.email = "mail@mail.com"
for single_term in ["ASCL1", "glioma"]:
    data = Entrez.esearch(db="pubmed",term = single_term)
    res = Entrez.read(data)
    pmids = res["IdList"]
    print 'PMIDs for %s: %s' % (single_term, pmids)

try Entrez.esearch(db="pubmed",term = "ASCL1 and glioma")

Thanks for reply that i tried it works perfectly..but i have mulitple genes ..so i want to get all Pubmed IDs for this genes in glioma..can you please tell me how to do that same Entrez.esearch?

I tried this too it didnt work ..first I stored terms in text 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()

Can you tell where i am going wrong in this code? Thanks

Log in to answer this question.