[BioRuby] Bio::PubMed efetch xml support and other options

Toshiaki Katayama ktym at hgc.jp
Thu Nov 15 07:44:03 UTC 2007


Hi Patil,

On 2007/11/12, at 20:09, Kaustubh Patil wrote:
> XML is very nice for searching etc. PubMed documents can be fetched in various formats, including xml. I have changed the efetch method in Bio::PubMed class in order to implement this. Here is the modified method;

Enhancement to accept retmode=xml sounds good idea, so I just committed efetch2 and esearch2 methods which can be better replacements for the efetch and esearch methods.

Both methods are able to accept any E-Utils options as a hash.

I will remove the suffix "2" from these method if the following incompatibility can be accepted.

* changing efetch(*ids) to efetch(ids, hash = {}) breaks compatibility
  currently all of
   1. efetch("123")
   2. efetch("123", "456")
   3. efetch(["123", "456"])
  are accepted but 2. will be unavailable.

Other notes:

* default value for the retmode option remains "text" for the backward compatibility
* both methods are rewritten to use Bio::Command.post_form to make the code clear
* Bio::FlatFile is updated to accept recent MEDLINE entry format (UI -> PMID)


puts Bio::PubMed.esearch2("(genome AND analysis) OR bioinformatics)")
puts Bio::PubMed.esearch2("(genome AND analysis) OR bioinformatics)", {"retmax" => "500"})
puts Bio::PubMed.esearch2("(genome AND analysis) OR bioinformatics)", {"rettype" => "count"})

puts Bio::PubMed.efetch2("10592173")
puts Bio::PubMed.efetch2(["10592173", "14693808"], {"retmode" => "xml"})


Thanks,
Toshiaki Katayama




More information about the BioRuby mailing list