-
-
Save schluppeck/df5c38f9047ffe135024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pmid2bibtex.rb | |
# convert a PubMed PMID to BibTeX citation format | |
# updated version of http://chrisamiller.com/science/2010/12/13/using-bioruby-to-fetch-citations-from-pubmed/ | |
# works as of 2015-03-18 | |
require 'bio' | |
Bio::NCBI.default_email = "[email protected]" # required for EUtils | |
id = "18265351" | |
pm = Bio::PubMed::efetch(id) # array of MEDLINE-formatted string | |
med = Bio::MEDLINE.new(pm[0]) # MEDLINE object | |
bib = med.reference.format("bibtex") # format is a method of Reference object | |
# "@article{PMID:18265351,\n author = {Brown, T. and Mackey, K. and Du, T.},\n title = {Analysis of RNA by northern | |
# and slot blot hybridization.},\n journal = {Curr Protoc Mol Biol},\n year = {2004},\n volume = {Chapter | |
# 4},\n pages = {Unit 4.9},\n url = {http://www.ncbi.nlm.nih.gov/pubmed/18265351},\n}\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment