I have recently tried a few tools (MutationFinder, tmVar, PubTator etc.) that extract mutations from a given text. However, for my work I need something that will take a list of mutations as an input and return a list of pubmed id in which the mutations has been found.

Example input: mut_list = [Y702F, L483Y]

Example output: pub_list = [12215417, 18537569]

Can anyone give any idea?


  • $\begingroup$ Welcome to the site. Could you elaborate more your question? What did you try to solve this problem? $\endgroup$
    – llrs
    May 24, 2018 at 15:25

1 Answer 1


You could use the pubmed API to query it directly. Typically I use Biopython for my pubmed queries. There are some good examples in the cookbook and on other SO posts.

This example from the cookbook link above has the guts of what you need. You will just have to iterate over your list. Depending on the number of queries you want to do you might have issues getting throttled by NCBI

In this example, we will query PubMed for all articles having to do with orchids (see section 2.3 for our motivation). We first check how many of such articles there are:

>>> from Bio import Entrez
>>> Entrez.email = "[email protected]"     # Always tell NCBI who you are
>>> handle = Entrez.egquery(term="orchid")
>>> record = Entrez.read(handle)
>>> for row in record["eGQueryResult"]: ...     
        if row["DbName"]=="pubmed": ...         
            print(row["Count"]) 463 

Now we use the Bio.Entrez.efetch function to download the PubMed IDs of these 463 articles:

>>> from Bio import Entrez
>>> handle = Entrez.esearch(db="pubmed", term="orchid", retmax=463)
>>> record = Entrez.read(handle)
>>> handle.close()
>>> idlist = record["IdList"] 

This returns a Python list containing all of the PubMed IDs of articles related to orchids
  • $\begingroup$ A follow-up question: What will be the value of the db parameter if I want to search all databases? I read through Biopython's Entrez.esearch documentation as well as source code but wasn't able to figure it out. $\endgroup$ May 24, 2018 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.