[BioRuby] use of CGI.escape in Bio::Pubmed.esearch

Naohisa GOTO ngoto at gen-info.osaka-u.ac.jp
Fri Nov 9 12:30:10 UTC 2007


Hi,

On Tue, 06 Nov 2007 10:54:00 +0100
Kaustubh Patil <kpatil at science.uva.nl> wrote:

> Hi,
> 
> I would like to thank you for the BioRuby library, it is a very useful 
> tool. I am doing some literature mining using Ruby and I use PubMed as 
> my source. Here is some background for my question;
> 
> It is not possible to search PubMed with logical operators, e.g.  
> HIV+AND+drug or geneA+OR+geneB etc. using Bio::PubMed.esearch (it 
> returns empty result).

Probably you mean

 Bio::PubMed.esearch("HIV AND drug")
 Bio::PubMed.esearch("geneA OR geneB")

More complicated example:

 Bio::PubMed.esearch("((p53 AND apoptosis) 2007/11[dp]) OR bioperl")

You can use the same search terms as of NCBI PubMed seaech
without any care about URL encoding.

> It is due to the url encoding (i.e. CGI.escape) of the search term 
> (approx. line 89 in pubmed.rb). If we remove this url encoding it is 
> possible to make such queries.
> 
> Now my question is, is it safe to remove this CGI.escape ?

I think it is unsafe and should not be removed.

-- 
Naohisa Goto
ng at bioruby.org / ngoto at gen-info.osaka-u.ac.jp



More information about the BioRuby mailing list