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