Created
August 10, 2009 03:17
-
-
Save neilfws/164994 to your computer and use it in GitHub Desktop.
Search PubMed using esearch, return results as BibTeX
This file contains 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
#!/usr/bin/ruby | |
# save as pubmed.rb and test using 'ruby pubmed.rb 19662644' | |
# keyword search may return > 1 record due to retmax bug | |
# http://github.com/bioruby/bioruby/commit/51c3223e033b2992a7bd95da282f88164406ff92 | |
require 'rubygems' | |
require 'bio' | |
keywords = ARGV.join(' ') | |
options = { | |
'retmax' => 1 | |
} | |
entries = Bio::PubMed.esearch(keywords, options) | |
entries.each do |entry| | |
query = Bio::PubMed.query(entry) | |
medline = Bio::MEDLINE.new(query) | |
puts medline.reference.bibtex | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment