]> git.donarmstrong.com Git - org-ref.git/blob - pubmed.org
fb68a728ac24ae9fa35977daa62182e1caee3397
[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 #+BEGIN_SRC emacs-lisp
234 (defun pubmed-pmid-to-bibtex (pmid)
235   "Convert a PMID to a bibtex entry."
236   (let* ((data (pubmed-parse-medline pmid))
237          (type (cdr (assoc "PT" data)))
238          (title (cdr (assoc "TI" data)))
239          (authors (mapconcat 'cdr
240                              (-filter (lambda (x)
241                                         (string= (car x) "FAU"))
242                                       data)
243                              " and "))
244          (abstract (cdr (assoc "AB" data)))
245          (volume (cdr (assoc "VI" data)))
246          (issue (cdr (assoc "IP" data)))
247          (journal (cdr (assoc "JT" data)))
248          (year (cdr (assoc "DP" data)))
249          (pages (cdr (assoc "PG" data)))
250          (aid (cdr (assoc "AID" data))))
251
252     (cond
253      ((string= type "JOURNAL ARTICLE")
254       (concat "@article{,
255  author = {" authors "},
256  title = {" title "},
257  abstract = {" abstract "},
258  journal = {" journal "},
259  volume = {" volume "},
260  number = {" issue "},
261  year = {" (car (split-string year)) "},
262  pages = {" pages "},
263  doi = {" (replace-regexp-in-string " \\[doi\\]" "" aid) "},
264 }"))
265     (t
266      (message "No conversion for type: %s" type)))))
267 #+END_SRC
268
269 #+RESULTS:
270 : pubmed-pmid-to-bibtex
271
272 #+BEGIN_SRC emacs-lisp :tangle no
273 (pubmed-pmid-to-bibtex "23162369")
274 #+END_SRC
275
276 #+RESULTS:
277 #+begin_example
278 @article{,
279  author = {Slavich, George M and Zimbardo, Philip G},
280  title = {Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core 
281       Methods.},
282  abstract = {Approaches to classroom instruction have evolved considerably over the past 50
283       years. This progress has been spurred by the development of several learning
284       principles and methods of instruction, including active learning,
285       student-centered learning, collaborative learning, experiential learning, and
286       problem-based learning. In the present paper, we suggest that these seemingly
287       different strategies share important underlying characteristics and can be viewed
288       as complimentary components of a broader approach to classroom instruction called
289       transformational teaching. Transformational teaching involves creating dynamic
290       relationships between teachers, students, and a shared body of knowledge to
291       promote student learning and personal growth. From this perspective, instructors 
292       are intellectual coaches who create teams of students who collaborate with each
293       other and with their teacher to master bodies of information. Teachers assume the
294       traditional role of facilitating students' acquisition of key course concepts,
295       but do so while enhancing students' personal development and attitudes toward
296       learning. They accomplish these goals by establishing a shared vision for a
297       course, providing modeling and mastery experiences, challenging and encouraging
298       students, personalizing attention and feedback, creating experiential lessons
299       that transcend the boundaries of the classroom, and promoting ample opportunities
300       for preflection and reflection. We propose that these methods are synergistically
301       related and, when used together, maximize students' potential for intellectual
302       and personal growth.},
303  journal = {Educational psychology review},
304  volume = {24},
305  number = {4},
306  year = {2012},
307  pages = {569-608},
308  doi = {10.1007/s10648-012-9199-6},
309 }
310 #+end_example
311
312 And we probably want to be able to insert a bibtex entry
313
314 #+BEGIN_SRC emacs-lisp
315 (defun pubmed-insert-bibtex-from-pmid (pmid)
316  "Insert a bibtex entry at point derived from PMID.
317 You must clean the entry after insertion."
318  (interactive "sPMID: ")
319  (insert (pubmed-pmid-to-bibtex pmid)))
320 #+END_SRC
321
322 #+RESULTS:
323 : pubmed-insert-bibtex-from-pmid
324
325 Here is an example of a cleaned entry:
326 #+BEGIN_SRC bibtex :tangle no
327 @article{slavich-2012-trans-teach,
328   author =       {Slavich, George M and Zimbardo, Philip G},
329   title =        {Transformational Teaching: Theoretical
330                   Underpinnings, Basic Principles, and Core Methods.},
331   journal =      {Educational psychology review},
332   volume =       24,
333   number =       4,
334   pages =        {569-608},
335   year =         2012,
336   doi =          {10.1007/s10648-012-9199-6},
337   abstract =     {Approaches to classroom instruction have evolved
338                   considerably over the past 50 years. This progress
339                   has been spurred by the development of several
340                   learning principles and methods of instruction,
341                   including active learning, student-centered
342                   learning, collaborative learning, experiential
343                   learning, and problem-based learning. In the present
344                   paper, we suggest that these seemingly different
345                   strategies share important underlying
346                   characteristics and can be viewed as complimentary
347                   components of a broader approach to classroom
348                   instruction called transformational
349                   teaching. Transformational teaching involves
350                   creating dynamic relationships between teachers,
351                   students, and a shared body of knowledge to promote
352                   student learning and personal growth. From this
353                   perspective, instructors are intellectual coaches
354                   who create teams of students who collaborate with
355                   each other and with their teacher to master bodies
356                   of information. Teachers assume the traditional role
357                   of facilitating students' acquisition of key course
358                   concepts, but do so while enhancing students'
359                   personal development and attitudes toward
360                   learning. They accomplish these goals by
361                   establishing a shared vision for a course, providing
362                   modeling and mastery experiences, challenging and
363                   encouraging students, personalizing attention and
364                   feedback, creating experiential lessons that
365                   transcend the boundaries of the classroom, and
366                   promoting ample opportunities for preflection and
367                   reflection. We propose that these methods are
368                   synergistically related and, when used together,
369                   maximize students' potential for intellectual and
370                   personal growth.},
371 }
372 #+END_SRC
373
374 ** PMID to xml
375 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.
376
377 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
378 (defun pubmed-get-medline-xml (pmid)
379   "Get MEDLINE xml for PMID as a string."
380   (interactive)
381   (with-current-buffer
382     (url-retrieve-synchronously
383      (format "http://www.ncbi.nlm.nih.gov/pubmed/%s/?report=xml&format=text" pmid))
384     (goto-char (point-min))
385     (while (search-forward "&lt;" nil t)
386       (replace-match "<"))
387     (goto-char (point-min))
388     (while (search-forward "&gt;" nil t)
389       (replace-match ">"))
390     (goto-char (point-min))   
391                            
392     (let ((p1 (search-forward "<pre>"))
393           (p2 (search-forward "</pre>")))
394       (buffer-substring (+ 1 p1) (- p2 6)))))
395 #+END_SRC
396
397 #+RESULTS:
398 : pubmed-get-medline-xml
399
400 #+BEGIN_SRC emacs-lisp :tangle no
401 (pubmed-get-medline-xml "23162369")
402 #+END_SRC
403
404 #+RESULTS:
405 #+begin_example
406 <PubmedArticle>
407     <MedlineCitation Status="Publisher" Owner="NLM">
408         <PMID Version="1">23162369</PMID>
409         <DateCreated>
410             <Year>2012</Year>
411             <Month>11</Month>
412             <Day>19</Day>
413         </DateCreated>
414         <Article PubModel="Print-Electronic">
415             <Journal>
416                 <ISSN IssnType="Print">1040-726X</ISSN>
417                 <JournalIssue CitedMedium="Print">
418                     <Volume>24</Volume>
419                     <Issue>4</Issue>
420                     <PubDate>
421                         <Year>2012</Year>
422                         <Month>Dec</Month>
423                     </PubDate>
424                 </JournalIssue>
425                 <Title>Educational psychology review</Title>
426                 <ISOAbbreviation>Educ Psychol Rev</ISOAbbreviation>
427             </Journal>
428             <ArticleTitle>Transformational Teaching: Theoretical Underpinnings, Basic Principles, and Core Methods.</ArticleTitle>
429             <Pagination>
430                 <MedlinePgn>569-608</MedlinePgn>
431             </Pagination>
432             <Abstract>
433                 <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>
434             </Abstract>
435             <AuthorList>
436                 <Author>
437                     <LastName>Slavich</LastName>
438                     <ForeName>George M</ForeName>
439                     <Initials>GM</Initials>
440                     <AffiliationInfo>
441                         <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>
442                     </AffiliationInfo>
443                 </Author>
444                 <Author>
445                     <LastName>Zimbardo</LastName>
446                     <ForeName>Philip G</ForeName>
447                     <Initials>PG</Initials>
448                 </Author>
449             </AuthorList>
450             <Language>ENG</Language>
451             <GrantList>
452                 <Grant>
453                     <GrantID>R01 AG026364</GrantID>
454                     <Acronym>AG</Acronym>
455                     <Agency>NIA NIH HHS</Agency>
456                     <Country>United States</Country>
457                 </Grant>
458                 <Grant>
459                     <GrantID>T32 MH019925</GrantID>
460                     <Acronym>MH</Acronym>
461                     <Agency>NIMH NIH HHS</Agency>
462                     <Country>United States</Country>
463                 </Grant>
464             </GrantList>
465             <PublicationTypeList>
466                 <PublicationType UI="">JOURNAL ARTICLE</PublicationType>
467             </PublicationTypeList>
468             <ArticleDate DateType="Electronic">
469                 <Year>2012</Year>
470                 <Month>7</Month>
471                 <Day>24</Day>
472             </ArticleDate>
473         </Article>
474         <MedlineJournalInfo>
475             <MedlineTA>Educ Psychol Rev</MedlineTA>
476             <NlmUniqueID>9885342</NlmUniqueID>
477             <ISSNLinking>1040-726X</ISSNLinking>
478         </MedlineJournalInfo>
479     </MedlineCitation>
480     <PubmedData>
481         <History>
482             <PubMedPubDate PubStatus="epublish">
483                 <Year>2012</Year>
484                 <Month>7</Month>
485                 <Day>24</Day>
486             </PubMedPubDate>
487             <PubMedPubDate PubStatus="entrez">
488                 <Year>2012</Year>
489                 <Month>11</Month>
490                 <Day>20</Day>
491                 <Hour>6</Hour>
492                 <Minute>0</Minute>
493             </PubMedPubDate>
494             <PubMedPubDate PubStatus="pubmed">
495                 <Year>2012</Year>
496                 <Month>11</Month>
497                 <Day>20</Day>
498                 <Hour>6</Hour>
499                 <Minute>0</Minute>
500             </PubMedPubDate>
501             <PubMedPubDate PubStatus="medline">
502                 <Year>2012</Year>
503                 <Month>11</Month>
504                 <Day>20</Day>
505                 <Hour>6</Hour>
506                 <Minute>0</Minute>
507             </PubMedPubDate>
508         </History>
509         <PublicationStatus>ppublish</PublicationStatus>
510         <ArticleIdList>
511             <ArticleId IdType="doi">10.1007/s10648-012-9199-6</ArticleId>
512             <ArticleId IdType="pubmed">23162369</ArticleId>
513             <ArticleId IdType="pmc">PMC3498956</ArticleId>
514             <ArticleId IdType="mid">NIHMS395714</ArticleId>
515         </ArticleIdList>
516         <?nihms?>
517     </PubmedData>
518 </PubmedArticle>
519
520 #+end_example
521
522 * Pubmed Central (PMC) link
523 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.
524
525 Here we define a new link. Clicking on it simply opens a webpage to the article.
526
527 #+BEGIN_SRC emacs-lisp :tangle pubmed.el :results silent
528 (org-add-link-type
529  "pmcid"
530  ;; clicking
531  (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/%s" link-string)))
532  ;; formatting
533 (lambda (keyword desc format)
534    (cond
535     ((eq format 'html)
536      (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/%s\">pmcid:%s</a>" keyword keyword))
537     ((eq format 'latex)
538      (format "\\url{http://www.ncbi.nlm.nih.gov/pmc/articles/%s}" keyword)))))
539 #+END_SRC
540
541 * NIHMSID 
542 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.
543
544 #+BEGIN_SRC emacs-lisp :tangle pubmed.el :results silent
545 (org-add-link-type
546  "nihmsid"
547  ;; clicking
548  (lambda (link-string) (browse-url (format "http://www.ncbi.nlm.nih.gov/pmc/articles/mid/%s" link-string)))
549  ;; formatting
550 (lambda (keyword desc format)
551    (cond
552     ((eq format 'html)
553      (format "<a href=\"http://www.ncbi.nlm.nih.gov/pmc/articles/mid//%s\">nihmsid:%s</a>" keyword keyword))
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
560
561
562 * End of code
563 #+BEGIN_SRC emacs-lisp :tangle pubmed.el
564 (provide 'pubmed)
565 #+END_SRC
566
567 * Build                                                            :noexport:
568 This code will tangle the elisp code out to pubmed.el and load it.
569
570 [[elisp:(org-babel-load-file "pubmed.org")]]
571
572
573