This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to connect to PubMed database?

Hi all!

I would like to write a program in python which will connect to PubMed database and according to rs number or nucleotide change find all PubMed Ids. In addition I would like to have PubMed ID only for polish population - publications where polish population is mentioned.

Could you please give me some suggestion? Maybe there is a python library which could make everything easier?

Best,

Agata

ncbi pubmed

1 answer

Entrez package from BioPython will help you to achieve your goal and also here is a full documentation of BioPython

example to get article Id about Polish

from Bio import Entrez
def search(query):
    Entrez.email = 'yourEmail@example.com'
    handle = Entrez.esearch(db='pubmed', 
                            sort='relevance', 
                            retmax='20',
                            retmode='xml', 
                            term=query)
    results = Entrez.read(handle)
    return results

my_id_list = search("poland")["IdList"]

Good luck.

That is great! Thank you a lot!

Log in to answer this question.