Question: How to get the corresponding PMCID from PMID with python?
0
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:

output:

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

input:

cat pmid.txt 
29900339
29897644
ADD REPLYlink modified 2.4 years ago • written 2.4 years ago by cpad011214k
2
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 PMIDtoPMCID.py

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()

Entrez.email = arguments.EmailAddress

SearchTerm = arguments.SearchTerm

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

print(handle.read())

handle.close()

Now try it:

python PMIDtoPMCID.py -e MyWine@chardonnay.com -i 21990379


https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20101123/elink.dtd">
<eLinkResult>

  <LinkSet>
    <DbFrom>pubmed</DbFrom>
    <IdList>
      <Id>21990379</Id>
    </IdList>
    <LinkSetDb>
      <DbTo>pmc</DbTo>
      <LinkName>pubmed_pmc</LinkName>

        <Link>
                <Id>3266030</Id>
            </Link>

    </LinkSetDb>
  </LinkSet>
</eLinkResult>

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

Kevin

ADD COMMENTlink modified 2.2 years ago • written 2.4 years ago by Kevin Blighe66k
1
gravatar for Maria_Levchenko
2.2 years ago by
EMBL-EBI
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: ftp://ftp.ebi.ac.uk/pub/databases/pmc/DOI/ Disclaimer: I work for Europe PMC

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

Help
Access

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