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