Question: How to get the corresponding PMCID from PMID with python?
gravatar for flaviellebm
2.4 years ago by
flaviellebm0 wrote:

Hi, I'm new here and I need help.

I have an array with all the PMIDs I get as my query in pubmed using Entrez.esearch, but I need the PMCID to after then access the full article. Can someone help me?

pubmed pmid pmcid • 1.7k views
ADD COMMENTlink modified 2.2 years ago by Maria_Levchenko60 • written 2.4 years ago by flaviellebm0

it would help if you post example PMIDs. Try NCBI eutils and here is a shell solution:


while read line; do efetch -db pubmed -id $line -format xml | xtract -pattern ArticleIdList -element ArticleId ; done   < pmid.txt 

29900339    10.1016/j.dib.2018.05.056   S2352-3409(18)30562-6   PMC5997901
29897644    10.1002/anie.201805074


cat pmid.txt 
ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by cpad011214k
gravatar for Kevin Blighe
2.4 years ago by
Kevin Blighe66k
Kevin Blighe66k wrote:

You'll need to use eUtils, specifically eLink. You can re-use this Python script that I've written (tested in Python 2.7), called

import sys    
import argparse
from Bio import Entrez

parser = argparse.ArgumentParser(description="Looks up PMCID with OMID")
parser.add_argument("-e", action="store", dest="EmailAddress", required=True, help="Entrez requires your email address.")
parser.add_argument("-i", action="store", dest="SearchTerm", required=True, help="PMID.")

arguments = parser.parse_args() = arguments.EmailAddress

SearchTerm = arguments.SearchTerm

handle = Entrez.elink(dbfrom="pubmed", db="pmc", linkname="pubmed_pmc", id=SearchTerm, retmode="text")



Now try it:

python -e -i 21990379">




I'll have to leave it to you to parse the output. The PMCID is 3266030


ADD COMMENTlink modified 2.2 years ago • written 2.4 years ago by Kevin Blighe66k
gravatar for Maria_Levchenko
2.2 years ago by
Maria_Levchenko60 wrote:

In case this is useful, Europe PMC (PubMed Central partner) provides a file with PMID-PMCID-DOI mappings that you can download via FTP: Disclaimer: I work for Europe PMC

ADD COMMENTlink written 2.2 years ago by Maria_Levchenko60
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1028 users visited in the last hour