Convert Pmids To Nihmsid And Pmcid Using Eutils
1
0
Entering edit mode
9.2 years ago
Smandape ▴ 110

I would like to know if I can convert PMID to NIHMSID, if there is no PMCID associated with that PMID and retrieve both of them if PMCID exists. I want to do this programmatically may be using eutils if possible. I know about this link http://www.ncbi.nlm.nih.gov/pmc/pmctopmid/ that will do the work but its not programmatically. I also tried the services by PMC http://www.ncbi.nlm.nih.gov/pmc/tools/oai/#examples but not much of success.

So my questions, again, is I have PMIDs and want to find it there exists a NIHMSID and PMCID for it and retrieve them. If PMCID has not yet been assigned then there should be a NIHMSID, retrieve it. For example I have the following two ids:

21707345
23482678


Has anyone tried anything similar to this before?

eutils webservice • 4.2k views
1
Entering edit mode
9.2 years ago
Neilfws 49k

If no web service exists for this purpose, the next best solution is to interact programmatically with the PMCID/PMID/NIHMSID Converter web page. Of course, the downside is that your code breaks when the web page HTML is altered.

Several languages (Perl, Python, Ruby) provide a library named Mechanize for this purpose.

Here is some example code using the Ruby Mechanize library.

require 'mechanize'

agent = Mechanize.new
page  = agent.get("http://www.ncbi.nlm.nih.gov/pmc/pmctopmid/")
form  = page.forms[1]  # the second form on the page

# now fill in the form
form.radiobutton_with(:value => "from_pmid").check  # from PMID
form["PAFAppLayout.AppController.Page.PMCToPmidC.MainPortlet.Ids"] = "21707345\n23482678"  # the PMID(s)
form.checkbox_with(:name => "PAFAppLayout.AppController.Page.PMCToPmidC.MainPortlet.ToFile").check  # send to CSV file

# submit
f = agent.submit(form, form.buttons[1])  # second button on the form
f.save "ids.txt"


Result: a file named ids.txt in the directory from where you ran the code.

PMID,PMCID,NIHMSID
21707345,-,NIHMSID331689
23482678,PMC3592971,NIHMSID392341

0
Entering edit mode

@Neilfws: Thank you so much for this direction. I didn't know how to move forward with my question. I also tried to put this question in Stackoverflow with possibility of webscraping but, no one replied and I was clueless how to do it with scrappy and other libraries in python. I was trying to get the query link to convert these ids, but not much of success.

Atleast in this direction I can start working. Thanks, again, a ton for giving me this direction.

0
Entering edit mode

Happy to help. Someone from NCBI commented on my blog post to say that in fact there is an undocumented web service for this task. I think you will find their comment helpful.

0
Entering edit mode

I think perhaps you should look at the Public Access Compliance Monitor for what you are trying to do. You can get more information about it on the NIH Public Access page.

As I commented on Neilfws' blog, we are coming out with a new web service for ID conversions - it should be deployed in a couple of weeks, and when it is released, you'll be able to find a link to it from the pmctopmid page.