]> git.donarmstrong.com Git - org-ref.git/blobdiff - pubmed.org
fix typo
[org-ref.git] / pubmed.org
index e7905b76fb658ac23688fcdda68e4ad37f8468f7..7febb4a4565ddde08eacd4def3377ad15c7822a2 100644 (file)
@@ -1,4 +1,6 @@
 #+TITLE: Links and functions for Pubmed and NIH databases
+#+AUTHOR: John Kitchin
+#+DATE: January 5, 2015
 
 * Introduction
 
@@ -14,10 +16,12 @@ and nihmsid:NIHMS395714
 
 See http://www.ncbi.nlm.nih.gov/pmc/about/public-access-info/#p3 for details of these identifiers.
 
+For PMID there is one interactive function that inserts a bibtex entry: pubmed-insert-bibtex-from-pmid.
 
+This library is complementary to [[./doi-utils.org]].
 
 * Header
-#+BEGIN_SRC emacs-lisp :tangle org-ref.el
+#+BEGIN_SRC emacs-lisp :tangle pubmed.el
 ;;; pubmed.el --- Links and functions to interact with pubmed databases.
 
 ;; Copyright(C) 2015 John Kitchin
@@ -42,18 +46,28 @@ See http://www.ncbi.nlm.nih.gov/pmc/about/public-access-info/#p3 for details of
 
 ;;; Commentary:
 ;;
-;; Lisp code to setup bibliography cite, ref and label org-mode links.
-;; also sets up reftex for org-mode. The links are clickable and do
-;; things that are useful. You should really read org-ref.org for details.
+;; Lisp code to interact with pubmed databases, links to pubmed
+;; identifiers. See pubmed.org.
+;;;
+;; This library provides links that go to pubmed resources, e.g.
+;;
+;; pmcid:PMC3498956
+;;
+;; pmid:23162369
+;;
+;; and nihmsid:NIHMS395714
+;;
+;; See http://www.ncbi.nlm.nih.gov/pmc/about/public-access-info/#p3 for details of these identifiers.
 ;;
-;; Package-Requires: ((dash))
+;; For PMID there is one interactive function that inserts a bibtex
+;; entry: `pubmed-insert-bibtex-from-pmid`.
 #+END_SRC
 
 * PMID (from PubMed) link and functions
 A PMID is a number that identifies an entry in the Pubmed database.  The PMID is a unique reference number for PubMed citations. The PMID is a distinctly different number from the PMCID and is used only for PubMed records.
 
 
-#+BEGIN_SRC emacs-lisp :tangle pubmed.el
+#+BEGIN_SRC emacs-lisp :tangle pubmed.el :results silent
 (org-add-link-type
  "pmid"
  ;; clicking
@@ -61,12 +75,15 @@ A PMID is a number that identifies an entry in the Pubmed database.  The PMID is
  ;; formatting
 (lambda (keyword desc format)
    (cond
-    ((eq format 'html) (format "")); no output for html
+    ((eq format 'html)
+     (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s\">pmid:%s</a>" keyword keyword)); no output for html
     ((eq format 'latex)
      ;; write out the latex command
      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}" keyword)))))
 #+END_SRC
 
+
+
 ** Get MEDLINE metadata
 We can get bibliographic metadata from a pmid. Here we get the MEDLINE text. The website wraps the data in <pre></pre> tags.
 
@@ -227,14 +244,10 @@ We can parse this into a data structure
 ** PMID to bibtex entry
 The point of parsing the MEDLINE text is so we can make bibtex entries. We only support Journal articles for now.
 
-Issues:
-1. The year is not quite right, it has the month in it.
-2. I do not use all the fields.
-
 #+BEGIN_SRC emacs-lisp
 (defun pubmed-pmid-to-bibtex (pmid)
   "Convert a PMID to a bibtex entry."
-  (let* ((data (org-ref-parse-medline pmid))
+  (let* ((data (pubmed-parse-medline pmid))
         (type (cdr (assoc "PT" data)))
         (title (cdr (assoc "TI" data)))
         (authors (mapconcat 'cdr
@@ -525,7 +538,7 @@ A PMCID starts with PMC and is followed by numbers. The PMCID is a unique refere
 
 Here we define a new link. Clicking on it simply opens a webpage to the article.
 
-#+BEGIN_SRC emacs-lisp :tangle pubmed.el
+#+BEGIN_SRC emacs-lisp :tangle pubmed.el :results silent
 (org-add-link-type
  "pmcid"
  ;; clicking
@@ -534,16 +547,15 @@ Here we define a new link. Clicking on it simply opens a webpage to the article.
 (lambda (keyword desc format)
    (cond
     ((eq format 'html)
-     (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">" keyword))
+     (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">pmcid:%s</a>" keyword keyword))
     ((eq format 'latex)
      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/%s}" keyword)))))
 #+END_SRC
 
-
 * NIHMSID 
 The NIHMSID is a preliminary article identifier that applies only to manuscripts deposited through the NIHMS system. The NIHMSID is only valid for compliance reporting for 90 days after the publication date of an article. Once the Web version of the NIHMS submission is approved for inclusion in PMC and the corresponding citation is in PubMed, the article will also be assigned a PMCID.
 
-#+BEGIN_SRC emacs-lisp :tangle pubmed.el
+#+BEGIN_SRC emacs-lisp :tangle pubmed.el :results silent
 (org-add-link-type
  "nihmsid"
  ;; clicking
@@ -551,24 +563,21 @@ The NIHMSID is a preliminary article identifier that applies only to manuscripts
  ;; formatting
 (lambda (keyword desc format)
    (cond
-    ((eq format 'html) (format "")); no output for html
+    ((eq format 'html)
+     (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s\">nihmsid:%s</a>" keyword keyword))
     ((eq format 'latex)
      ;; write out the latex command
-     (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s}" keyword)))))
+     (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}" keyword)))))
 #+END_SRC
 
-#+RESULTS:
-| lambda | (link-string)         | (browse-url (format http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s link-string))                                                               |
-| lambda | (keyword desc format) | (cond ((eq format (quote html)) (format )) ((eq format (quote latex)) (format \url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s} keyword))) |
 
 
 
 * End of code
-#+BEGIN_SRC emacs-lisp :tangle org-ref.el
+#+BEGIN_SRC emacs-lisp :tangle pubmed.el
 (provide 'pubmed)
 #+END_SRC
 
-
 * Build                                                                   :noexport:
 This code will tangle the elisp code out to pubmed.el and load it.