]> git.donarmstrong.com Git - org-ref.git/blob - pubmed.org
f7f5456b1cffd4ef21c0aa3f8b4bf93d8bfaaff9
[org-ref.git] / pubmed.org
1 #+TITLE: Links and functions for Pubmed and NIH databases
2 #+AUTHOR: John Kitchin
3 #+DATE: January 5, 2015
4
5 * Introduction
6
7 This document is an experiment at creating a literate program to provide functions for interacting with pubmed databases.
8
9 This library provides links that go to pubmed resources, e.g.
10
11 pmcid:PMC3498956
12
13 pmid:23162369
14
15 and nihmsid:NIHMS395714
16
17 See http://www.ncbi.nlm.nih.gov/pmc/about/public-access-info/#p3 for details of these identifiers.
18
19
20
21 * Header
22 #+BEGIN_SRC emacs-lisp :tangle org-ref.el
23 ;;; pubmed.el --- Links and functions to interact with pubmed databases.
24
25 ;; Copyright(C) 2015 John Kitchin
26
27 ;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
28 ;; This file is not currently part of GNU Emacs.
29
30 ;; This program is free software; you can redistribute it and/or
31 ;; modify it under the terms of the GNU General Public License as
32 ;; published by the Free Software Foundation; either version 2, or (at
33 ;; your option) any later version.
34
35 ;; This program is distributed in the hope that it will be useful, but
36 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
37 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
38 ;; General Public License for more details.
39
40 ;; You should have received a copy of the GNU General Public License
41 ;; along with this program ; see the file COPYING.  If not, write to
42 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
43 ;; Boston, MA 02111-1307, USA.
44
45 ;;; Commentary:
46 ;;
47 ;; Lisp code to setup bibliography cite, ref and label org-mode links.
48 ;; also sets up reftex for org-mode. The links are clickable and do
49 ;; things that are useful. You should really read org-ref.org for details.
50 ;;
51 ;; Package-Requires: ((dash))
52 #+END_SRC
53
54 * PMID (from PubMed) link and functions
55 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.
56
57
58 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
59 (org-add-link-type
60  "pmid"
61  ;; clicking
62  (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pubmed/%s" link-string)))
63  ;; formatting
64 (lambda (keyword desc format)
65    (cond
66     ((eq format 'html) (format "")); no output for html
67     ((eq format 'latex)
68      ;; write out the latex command
69      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s}" keyword)))))
70 #+END_SRC
71
72 ** Get MEDLINE metadata
73 We can get bibliographic metadata from a pmid. Here we get the MEDLINE text. The website wraps the data in <pre></pre> tags.
74
75
76 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
77 (defun pubmed-get-medline (pmid)
78   "Get MEDLINE text for PMID as a string."
79   (with-current-buffer
80     (url-retrieve-synchronously
81      (format "http://www.ncbi.nlm.nih.gov/pubmed/%s/?report=medline&format=text" pmid))
82     (goto-char (point-min))
83     (let ((p1 (search-forward "<pre>"))
84           (p2 (search-forward "</pre>")))
85       (buffer-substring (+ 1 p1) (- p2 6)))))
86 #+END_SRC
87
88 #+RESULTS:
89 : pubmed-get-medline
90
91 Here is sample output:
92 #+BEGIN_SRC emacs-lisp
93 (pubmed-get-medline "23162369")
94 #+END_SRC
95
96 #+RESULTS:
97 #+begin_example
98 PMID- 23162369
99 OWN - NLM
100 STAT- Publisher
101 DA  - 20121119
102 IS  - 1040-726X (Print)
103 IS  - 1040-726X (Linking)
104 VI  - 24
105 IP  - 4
106 DP  - 2012 Dec
107 TI  - Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core 
108       Methods.
109 PG  - 569-608
110 AB  - Approaches to classroom instruction have evolved considerably over the past 50
111       years. This progress has been spurred by the development of several learning
112       principles and methods of instruction, including active learning,
113       student-centered learning, collaborative learning, experiential learning, and
114       problem-based learning. In the present paper, we suggest that these seemingly
115       different strategies share important underlying characteristics and can be viewed
116       as complimentary components of a broader approach to classroom instruction called
117       transformational teaching. Transformational teaching involves creating dynamic
118       relationships between teachers, students, and a shared body of knowledge to
119       promote student learning and personal growth. From this perspective, instructors 
120       are intellectual coaches who create teams of students who collaborate with each
121       other and with their teacher to master bodies of information. Teachers assume the
122       traditional role of facilitating students' acquisition of key course concepts,
123       but do so while enhancing students' personal development and attitudes toward
124       learning. They accomplish these goals by establishing a shared vision for a
125       course, providing modeling and mastery experiences, challenging and encouraging
126       students, personalizing attention and feedback, creating experiential lessons
127       that transcend the boundaries of the classroom, and promoting ample opportunities
128       for preflection and reflection. We propose that these methods are synergistically
129       related and, when used together, maximize students' potential for intellectual
130       and personal growth.
131 FAU - Slavich, George M
132 AU  - Slavich GM
133 AD  - Cousins Center for Psychoneuroimmunology and Department of Psychiatry and
134       Biobehavioral Sciences, University of California, Los Angeles, UCLA Medical Plaza
135       300, Room 3156, Los Angeles, CA 90095-7076, USA.
136 FAU - Zimbardo, Philip G
137 AU  - Zimbardo PG
138 LA  - ENG
139 GR  - R01 AG026364/AG/NIA NIH HHS/United States
140 GR  - T32 MH019925/MH/NIMH NIH HHS/United States
141 PT  - JOURNAL ARTICLE
142 DEP - 20120724
143 TA  - Educ Psychol Rev
144 JT  - Educational psychology review
145 JID - 9885342
146 PMC - PMC3498956
147 MID - NIHMS395714
148 EDAT- 2012/11/20 06:00
149 MHDA- 2012/11/20 06:00
150 CRDT- 2012/11/20 06:00
151 PHST- 2012/07/24 [epublish]
152 AID - 10.1007/s10648-012-9199-6 [doi]
153 PST - ppublish
154 SO  - Educ Psychol Rev. 2012 Dec;24(4):569-608. Epub 2012 Jul 24.
155 #+end_example
156
157 ** Parse the PMID MEDLINE data
158 We can parse this into a data structure
159
160 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
161 (defun pubmed-parse-medline (pmid)
162   "Parse the medline text for PMID and return a list of cons cells."
163   (let ((data '())
164         (p1)
165         (p2)
166         (tag)
167         (value))
168     (with-temp-buffer (insert (pubmed-get-medline pmid))
169                       (goto-char (point-min))
170                       (while (re-search-forward "\\(^[A-Z]\\{2,4\\}\\)\\s-*- " nil t)
171                         (setq tag (match-string 1))
172                         ;; point is at end of the search
173                         (setq p1 (point))
174                         ;; now go to next tag
175                         (re-search-forward "\\(^[A-Z]\\{2,4\\}\\)\\s-*- " nil t)
176                         (setq p2 (- (match-beginning 1) 1))
177                         (setq value (buffer-substring p1 p2))
178                         (setq data (append data (list (cons tag value))))
179                         ;; now go back to last tag to get the next one
180                         (goto-char p1)))
181     data))
182 #+END_SRC
183
184 #+RESULTS:
185 : pubmed-parse-medline
186
187 #+BEGIN_SRC emacs-lisp :results code
188 (pubmed-parse-medline "23162369")
189 #+END_SRC
190
191 #+RESULTS:
192 #+BEGIN_SRC emacs-lisp
193 (("PMID" . "23162369")
194  ("OWN" . "NLM")
195  ("STAT" . "Publisher")
196  ("DA" . "20121119")
197  ("IS" . "1040-726X (Print)")
198  ("IS" . "1040-726X (Linking)")
199  ("VI" . "24")
200  ("IP" . "4")
201  ("DP" . "2012 Dec")
202  ("TI" . "Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core \n      Methods.")
203  ("PG" . "569-608")
204  ("AB" . "Approaches to classroom instruction have evolved considerably over the past 50\n      years. This progress has been spurred by the development of several learning\n      principles and methods of instruction, including active learning,\n      student-centered learning, collaborative learning, experiential learning, and\n      problem-based learning. In the present paper, we suggest that these seemingly\n      different strategies share important underlying characteristics and can be viewed\n      as complimentary components of a broader approach to classroom instruction called\n      transformational teaching. Transformational teaching involves creating dynamic\n      relationships between teachers, students, and a shared body of knowledge to\n      promote student learning and personal growth. From this perspective, instructors \n      are intellectual coaches who create teams of students who collaborate with each\n      other and with their teacher to master bodies of information. Teachers assume the\n      traditional role of facilitating students' acquisition of key course concepts,\n      but do so while enhancing students' personal development and attitudes toward\n      learning. They accomplish these goals by establishing a shared vision for a\n      course, providing modeling and mastery experiences, challenging and encouraging\n      students, personalizing attention and feedback, creating experiential lessons\n      that transcend the boundaries of the classroom, and promoting ample opportunities\n      for preflection and reflection. We propose that these methods are synergistically\n      related and, when used together, maximize students' potential for intellectual\n      and personal growth.")
205  ("FAU" . "Slavich, George M")
206  ("AU" . "Slavich GM")
207  ("AD" . "Cousins Center for Psychoneuroimmunology and Department of Psychiatry and\n      Biobehavioral Sciences, University of California, Los Angeles, UCLA Medical Plaza\n      300, Room 3156, Los Angeles, CA 90095-7076, USA.")
208  ("FAU" . "Zimbardo, Philip G")
209  ("AU" . "Zimbardo PG")
210  ("LA" . "ENG")
211  ("GR" . "R01 AG026364/AG/NIA NIH HHS/United States")
212  ("GR" . "T32 MH019925/MH/NIMH NIH HHS/United States")
213  ("PT" . "JOURNAL ARTICLE")
214  ("DEP" . "20120724")
215  ("TA" . "Educ Psychol Rev")
216  ("JT" . "Educational psychology review")
217  ("JID" . "9885342")
218  ("PMC" . "PMC3498956")
219  ("MID" . "NIHMS395714")
220  ("EDAT" . "2012/11/20 06:00")
221  ("MHDA" . "2012/11/20 06:00")
222  ("CRDT" . "2012/11/20 06:00")
223  ("PHST" . "2012/07/24 [epublish]")
224  ("AID" . "10.1007/s10648-012-9199-6 [doi]")
225  ("PST" . "ppublish")
226  ("SO" . "\nSO  - "))
227 #+END_SRC
228
229 ** PMID to bibtex entry
230 The point of parsing the MEDLINE text is so we can make bibtex entries. We only support Journal articles for now.
231
232 Issues:
233 1. The year is not quite right, it has the month in it.
234 2. I do not use all the fields.
235
236 #+BEGIN_SRC emacs-lisp
237 (defun pubmed-pmid-to-bibtex (pmid)
238   "Convert a PMID to a bibtex entry."
239   (let* ((data (org-ref-parse-medline pmid))
240          (type (cdr (assoc "PT" data)))
241          (title (cdr (assoc "TI" data)))
242          (authors (mapconcat 'cdr
243                              (-filter (lambda (x)
244                                         (string= (car x) "FAU"))
245                                       data)
246                              " and "))
247          (abstract (cdr (assoc "AB" data)))
248          (volume (cdr (assoc "VI" data)))
249          (issue (cdr (assoc "IP" data)))
250          (journal (cdr (assoc "JT" data)))
251          (year (cdr (assoc "DP" data)))
252          (pages (cdr (assoc "PG" data)))
253          (aid (cdr (assoc "AID" data))))
254
255     (cond
256      ((string= type "JOURNAL ARTICLE")
257       (concat "@article{,
258  author = {" authors "},
259  title = {" title "},
260  abstract = {" abstract "},
261  journal = {" journal "},
262  volume = {" volume "},
263  number = {" issue "},
264  year = {" (car (split-string year)) "},
265  pages = {" pages "},
266  doi = {" (replace-regexp-in-string " \\[doi\\]" "" aid) "},
267 }"))
268     (t
269      (message "No conversion for type: %s" type)))))
270 #+END_SRC
271
272 #+RESULTS:
273 : pubmed-pmid-to-bibtex
274
275 #+BEGIN_SRC emacs-lisp :tangle no
276 (pubmed-pmid-to-bibtex "23162369")
277 #+END_SRC
278
279 #+RESULTS:
280 #+begin_example
281 @article{,
282  author = {Slavich, George M and Zimbardo, Philip G},
283  title = {Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core 
284       Methods.},
285  abstract = {Approaches to classroom instruction have evolved considerably over the past 50
286       years. This progress has been spurred by the development of several learning
287       principles and methods of instruction, including active learning,
288       student-centered learning, collaborative learning, experiential learning, and
289       problem-based learning. In the present paper, we suggest that these seemingly
290       different strategies share important underlying characteristics and can be viewed
291       as complimentary components of a broader approach to classroom instruction called
292       transformational teaching. Transformational teaching involves creating dynamic
293       relationships between teachers, students, and a shared body of knowledge to
294       promote student learning and personal growth. From this perspective, instructors 
295       are intellectual coaches who create teams of students who collaborate with each
296       other and with their teacher to master bodies of information. Teachers assume the
297       traditional role of facilitating students' acquisition of key course concepts,
298       but do so while enhancing students' personal development and attitudes toward
299       learning. They accomplish these goals by establishing a shared vision for a
300       course, providing modeling and mastery experiences, challenging and encouraging
301       students, personalizing attention and feedback, creating experiential lessons
302       that transcend the boundaries of the classroom, and promoting ample opportunities
303       for preflection and reflection. We propose that these methods are synergistically
304       related and, when used together, maximize students' potential for intellectual
305       and personal growth.},
306  journal = {Educational psychology review},
307  volume = {24},
308  number = {4},
309  year = {2012},
310  pages = {569-608},
311  doi = {10.1007/s10648-012-9199-6},
312 }
313 #+end_example
314
315 And we probably want to be able to insert a bibtex entry
316
317 #+BEGIN_SRC emacs-lisp
318 (defun pubmed-insert-bibtex-from-pmid (pmid)
319  "Insert a bibtex entry at point derived from PMID.
320 You must clean the entry after insertion."
321  (interactive "sPMID: ")
322  (insert (pubmed-pmid-to-bibtex pmid)))
323 #+END_SRC
324
325 #+RESULTS:
326 : pubmed-insert-bibtex-from-pmid
327
328 Here is an example of a cleaned entry:
329 #+BEGIN_SRC bibtex :tangle no
330 @article{slavich-2012-trans-teach,
331   author =       {Slavich, George M and Zimbardo, Philip G},
332   title =        {Transformational Teaching: Theoretical
333                   Underpinnings, Basic Principles, and Core Methods.},
334   journal =      {Educational psychology review},
335   volume =       24,
336   number =       4,
337   pages =        {569-608},
338   year =         2012,
339   doi =          {10.1007/s10648-012-9199-6},
340   abstract =     {Approaches to classroom instruction have evolved
341                   considerably over the past 50 years. This progress
342                   has been spurred by the development of several
343                   learning principles and methods of instruction,
344                   including active learning, student-centered
345                   learning, collaborative learning, experiential
346                   learning, and problem-based learning. In the present
347                   paper, we suggest that these seemingly different
348                   strategies share important underlying
349                   characteristics and can be viewed as complimentary
350                   components of a broader approach to classroom
351                   instruction called transformational
352                   teaching. Transformational teaching involves
353                   creating dynamic relationships between teachers,
354                   students, and a shared body of knowledge to promote
355                   student learning and personal growth. From this
356                   perspective, instructors are intellectual coaches
357                   who create teams of students who collaborate with
358                   each other and with their teacher to master bodies
359                   of information. Teachers assume the traditional role
360                   of facilitating students' acquisition of key course
361                   concepts, but do so while enhancing students'
362                   personal development and attitudes toward
363                   learning. They accomplish these goals by
364                   establishing a shared vision for a course, providing
365                   modeling and mastery experiences, challenging and
366                   encouraging students, personalizing attention and
367                   feedback, creating experiential lessons that
368                   transcend the boundaries of the classroom, and
369                   promoting ample opportunities for preflection and
370                   reflection. We propose that these methods are
371                   synergistically related and, when used together,
372                   maximize students' potential for intellectual and
373                   personal growth.},
374 }
375 #+END_SRC
376
377 ** PMID to xml
378 We can also get xml of the MEDLINE data. The web page here also wraps the xml in a <pre> block and escapes the <> with &lt; and &gt;, which we have to undo. I have not used this code for anything, so I am not sure how good the xml code is.
379
380 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
381 (defun pubmed-get-medline-xml (pmid)
382   "Get MEDLINE xml for PMID as a string."
383   (interactive)
384   (with-current-buffer
385     (url-retrieve-synchronously
386      (format "http://www.ncbi.nlm.nih.gov/pubmed/%s/?report=xml&format=text" pmid))
387     (goto-char (point-min))
388     (while (search-forward "&lt;" nil t)
389       (replace-match "<"))
390     (goto-char (point-min))
391     (while (search-forward "&gt;" nil t)
392       (replace-match ">"))
393     (goto-char (point-min))   
394                            
395     (let ((p1 (search-forward "<pre>"))
396           (p2 (search-forward "</pre>")))
397       (buffer-substring (+ 1 p1) (- p2 6)))))
398 #+END_SRC
399
400 #+RESULTS:
401 : pubmed-get-medline-xml
402
403 #+BEGIN_SRC emacs-lisp :tangle no
404 (pubmed-get-medline-xml "23162369")
405 #+END_SRC
406
407 #+RESULTS:
408 #+begin_example
409 <PubmedArticle>
410     <MedlineCitation Status="Publisher" Owner="NLM">
411         <PMID Version="1">23162369</PMID>
412         <DateCreated>
413             <Year>2012</Year>
414             <Month>11</Month>
415             <Day>19</Day>
416         </DateCreated>
417         <Article PubModel="Print-Electronic">
418             <Journal>
419                 <ISSN IssnType="Print">1040-726X</ISSN>
420                 <JournalIssue CitedMedium="Print">
421                     <Volume>24</Volume>
422                     <Issue>4</Issue>
423                     <PubDate>
424                         <Year>2012</Year>
425                         <Month>Dec</Month>
426                     </PubDate>
427                 </JournalIssue>
428                 <Title>Educational psychology review</Title>
429                 <ISOAbbreviation>Educ Psychol Rev</ISOAbbreviation>
430             </Journal>
431             <ArticleTitle>Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core Methods.</ArticleTitle>
432             <Pagination>
433                 <MedlinePgn>569-608</MedlinePgn>
434             </Pagination>
435             <Abstract>
436                 <AbstractText>Approaches to classroom instruction have evolved considerably over the past 50 years. This progress has been spurred by the development of several learning principles and methods of instruction, including active learning, student-centered learning, collaborative learning, experiential learning, and problem-based learning. In the present paper, we suggest that these seemingly different strategies share important underlying characteristics and can be viewed as complimentary components of a broader approach to classroom instruction called transformational teaching. Transformational teaching involves creating dynamic relationships between teachers, students, and a shared body of knowledge to promote student learning and personal growth. From this perspective, instructors are intellectual coaches who create teams of students who collaborate with each other and with their teacher to master bodies of information. Teachers assume the traditional role of facilitating students' acquisition of key course concepts, but do so while enhancing students' personal development and attitudes toward learning. They accomplish these goals by establishing a shared vision for a course, providing modeling and mastery experiences, challenging and encouraging students, personalizing attention and feedback, creating experiential lessons that transcend the boundaries of the classroom, and promoting ample opportunities for preflection and reflection. We propose that these methods are synergistically related and, when used together, maximize students' potential for intellectual and personal growth.</AbstractText>
437             </Abstract>
438             <AuthorList>
439                 <Author>
440                     <LastName>Slavich</LastName>
441                     <ForeName>George M</ForeName>
442                     <Initials>GM</Initials>
443                     <AffiliationInfo>
444                         <Affiliation>Cousins Center for Psychoneuroimmunology and Department of Psychiatry and Biobehavioral Sciences, University of California, Los Angeles, UCLA Medical Plaza 300, Room 3156, Los Angeles, CA 90095-7076, USA.</Affiliation>
445                     </AffiliationInfo>
446                 </Author>
447                 <Author>
448                     <LastName>Zimbardo</LastName>
449                     <ForeName>Philip G</ForeName>
450                     <Initials>PG</Initials>
451                 </Author>
452             </AuthorList>
453             <Language>ENG</Language>
454             <GrantList>
455                 <Grant>
456                     <GrantID>R01 AG026364</GrantID>
457                     <Acronym>AG</Acronym>
458                     <Agency>NIA NIH HHS</Agency>
459                     <Country>United States</Country>
460                 </Grant>
461                 <Grant>
462                     <GrantID>T32 MH019925</GrantID>
463                     <Acronym>MH</Acronym>
464                     <Agency>NIMH NIH HHS</Agency>
465                     <Country>United States</Country>
466                 </Grant>
467             </GrantList>
468             <PublicationTypeList>
469                 <PublicationType UI="">JOURNAL ARTICLE</PublicationType>
470             </PublicationTypeList>
471             <ArticleDate DateType="Electronic">
472                 <Year>2012</Year>
473                 <Month>7</Month>
474                 <Day>24</Day>
475             </ArticleDate>
476         </Article>
477         <MedlineJournalInfo>
478             <MedlineTA>Educ Psychol Rev</MedlineTA>
479             <NlmUniqueID>9885342</NlmUniqueID>
480             <ISSNLinking>1040-726X</ISSNLinking>
481         </MedlineJournalInfo>
482     </MedlineCitation>
483     <PubmedData>
484         <History>
485             <PubMedPubDate PubStatus="epublish">
486                 <Year>2012</Year>
487                 <Month>7</Month>
488                 <Day>24</Day>
489             </PubMedPubDate>
490             <PubMedPubDate PubStatus="entrez">
491                 <Year>2012</Year>
492                 <Month>11</Month>
493                 <Day>20</Day>
494                 <Hour>6</Hour>
495                 <Minute>0</Minute>
496             </PubMedPubDate>
497             <PubMedPubDate PubStatus="pubmed">
498                 <Year>2012</Year>
499                 <Month>11</Month>
500                 <Day>20</Day>
501                 <Hour>6</Hour>
502                 <Minute>0</Minute>
503             </PubMedPubDate>
504             <PubMedPubDate PubStatus="medline">
505                 <Year>2012</Year>
506                 <Month>11</Month>
507                 <Day>20</Day>
508                 <Hour>6</Hour>
509                 <Minute>0</Minute>
510             </PubMedPubDate>
511         </History>
512         <PublicationStatus>ppublish</PublicationStatus>
513         <ArticleIdList>
514             <ArticleId IdType="doi">10.1007/s10648-012-9199-6</ArticleId>
515             <ArticleId IdType="pubmed">23162369</ArticleId>
516             <ArticleId IdType="pmc">PMC3498956</ArticleId>
517             <ArticleId IdType="mid">NIHMS395714</ArticleId>
518         </ArticleIdList>
519         <?nihms?>
520     </PubmedData>
521 </PubmedArticle>
522
523 #+end_example
524
525 * Pubmed Central (PMC) link
526 A PMCID starts with PMC and is followed by numbers. The PMCID is a unique reference number or identifier that is assigned to every article that is accepted into PMC. The PMCID is also used by recipients of NIH funding to demonstrate compliance with the NIH Public Access policy. The PMCID can be found in both PMC and PubMed.
527
528 Here we define a new link. Clicking on it simply opens a webpage to the article.
529
530 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
531 (org-add-link-type
532  "pmcid"
533  ;; clicking
534  (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/%s" link-string)))
535  ;; formatting
536 (lambda (keyword desc format)
537    (cond
538     ((eq format 'html)
539      (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">" keyword))
540     ((eq format 'latex)
541      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/%s}" keyword)))))
542 #+END_SRC
543
544
545 * NIHMSID 
546 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.
547
548 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
549 (org-add-link-type
550  "nihmsid"
551  ;; clicking
552  (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s" link-string)))
553  ;; formatting
554 (lambda (keyword desc format)
555    (cond
556     ((eq format 'html) (format "")); no output for html
557     ((eq format 'latex)
558      ;; write out the latex command
559      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s}" keyword)))))
560 #+END_SRC
561
562 #+RESULTS:
563 | lambda | (link-string)         | (browse-url (format http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s link-string))                                                               |
564 | 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))) |
565
566
567
568 * End of code
569 #+BEGIN_SRC emacs-lisp :tangle org-ref.el
570 (provide 'pubmed)
571 #+END_SRC
572
573
574 * Build                                                            :noexport:
575 This code will tangle the elisp code out to pubmed.el and load it.
576
577 [[elisp:(org-babel-load-file "pubmed.org")]]
578
579
580