Franck Dernoncourt
Franck Dernoncourt

Reputation: 83397

How can I programmatically get the PMID from the DOI of a paper that isn't in PMC (i.e., that doesn't have a PMCID)?

How can I programmatically get the PMID from the DOI of a paper that isn't in PMC (i.e., that doesn't have a PMCID)?

The DOI->PMID conversion tools mentioned on https://www.ncbi.nlm.nih.gov/pmc/pmctopmid/ only works when the paper has a PMCID.


Upvotes: 2

Views: 1307

Answers (2)

basesorbytes
basesorbytes

Reputation: 125

You can use the E-utilities API to get PMID from DOI for items not in the PMC.

Using this paper as an example: https://pubmed.ncbi.nlm.nih.gov/19139763/. It does not have a PMCID so using the ID converter gets an error:

curl 'https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/?tool=my_tool&[email protected]&ids=10.1038/nrg2509&format=json' | jq
{
 "status": "ok",
 "responseDate": "2023-03-11 13:59:00",
 "request": "tool=my_tool;email=my_email%40example.org;ids=10.1038%2Fnrg2509;format=json",
 "records": [
   {
    "doi": "10.1038/nrg2509",
    "live": "false",
    "status": "error",
    "errmsg": "invalid article id"
   }
 ]
}

Using the E-utilities API with the DOI as the search term returns the PMID in the idlist object.

curl https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=10.1038/nrg2509&format=json | jq
{
  "header": {
    "type": "esearch",
    "version": "0.3"
  },
  "esearchresult": {
    "count": "1",
    "retmax": "1",
    "retstart": "0",
    "idlist": [
      "19139763"
    ],
    "translationset": [],
    "querytranslation": "\"10 1038 nrg2509\"[All Fields]"
  }
}

To get just the ID:

curl https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=10.1038/nrg2509&format=json |\
jq '.esearchresult.idlist[]' | tr -d '"'

19139763

Upvotes: 1

anpami
anpami

Reputation: 888

Use https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/?tool=my_tool&[email protected]&ids=[DOI], as in: https://www.ncbi.nlm.nih.gov/pmc/utils/idconv/v1.0/?tool=my_tool&[email protected]&ids=10.1111/head.13856 (but please change the [email protected] in the address).

Upvotes: 0

Related Questions