28 Oct 2012
I've recently picked up some research I'd let sit idle. While gathering data to analyze, I realized there's no link to the PubMed citation page when I pull PubMed citations into EndNote. Why would this URL be useful? Having this link in EndNote makes it easy to toggle between articles and EndNote (where my research data lives). Plus, with a LibX toolbar installed in Firefox, the PMID (PubMed ID) number on the PubMed citation page magically (i.e. via link resolver) turns into a link to the article. This is a HUGE timesaver.
There are a variety of ways to get data from PubMed into EndNote, and the instructions on EndNote's support page are as good as any, so I began with those and added a few extra steps to grab the URL. What follows would occur after you download the data from PubMed and before you open EndNote. To do this, you'll need a text editor that can perform regular expressions - I used BBEdit although most editors will work (MS Word, Notepad++, and so forth).
As you can see, there's no URL, so we have to create one. Thankfully, there's a simple formula for this: 'http://www.ncbi.nlm.nih.gov/pubmed/' + 'PMID' = URL. For example, http://www.ncbi.nlm.nih.gov/pubmed/15063148 is the link for the article with PMID of 15063148.
So, all we need to do is copy the PMID and paste it into a new line with the 'http://www.ncbi.nlm.nih.gov/pubmed/' prefix. This can be accomplished using some regex and the find and replace feature. First, make sure your find and replace function is ready to parse regex - in BBEdit this means check the 'Grep' box. (quick BBEdit grep primer)
Here's a quick breakdown of what's going on: this is searching for the string 'PMID- ' and anything that comes after that string. The '.*' matches any character for zero or more occurences - this is what finds the PMID number.
In regex, you can create a pattern using parenthesis. Since we've used two sets of parenthesis, we have two patterns that we can call in the replace string.
'\1' is calling the first pattern from the Find command - we're putting back the entire line because we still want the PMID. '\r' is a line break. 'URL - http://www.ncbi.nlm.nih.gov/' is the text we want the new line to begin with. '\2' is the second pattern, the PMID.
Epilogue: Why does the new line have to begin with 'URL -'? This is how it's pulled into EndNote's PubMed filter. You can see this by going in EndNote to Edit > Import Filters > Open Filter Manager, go to PubMed (NLM) and click edit, then choose Templates. You'll notice these fields are very similar to the ones in the text file we were just editing.
blog comments powered by Disqus