[BioRuby] count parameter in Bio::PubMed.esearch
Kaustubh Patil
kpatil at science.uva.nl
Tue Nov 6 10:00:46 UTC 2007
Hi,
Here is a suggestion/feature for Bio::PubMed.esearch.
Currently it is not possible to use rettype=count (through options hash)
in Bio::PubMed.esearch.
To get this feature replace the following line in pubmed.rb (approx.
line 97)
result = result.scan(/<Id>(.*?)<\/Id>/m).flatten
by
if(hash['rettype']=="count")
result = result.scan(/<Count>(.*?)<\/Count>/m).flatten
result = result[0]
else
result = result.scan(/<Id>(.*?)<\/Id>/m).flatten
end
and it will return the count as a string, which can be easily converted
to an integer by "result.to_i"
I hope it is useful.
Cheers,
Kaustubh Patil
PS: for more details on Entrez esearch parameters, please refer to;
http://www.ncbi.nlm.nih.gov/entrez/query/static/esearch_help.html
More information about the BioRuby
mailing list