[Biopython] Entrez.esearch sort by publication date

Peter biopython at maubp.freeserve.co.uk
Mon Jun 1 06:30:48 EDT 2009


On Sun, May 31, 2009 at 6:16 PM, Renato Alves <rjalves at igc.gulbenkian.pt> wrote:
> Hi everyone,
>
> I've been using Entrez.esearch for a while without problems but today I
> wanted to have the results sorted by publication date.
>
> According to the docs at:
> http://www.ncbi.nlm.nih.gov/corehtml/query/static/esearch_help.html#Sort
> I should use 'pub+date', however this doesn't work. If I use 'author'
> and 'journal' I have no problems but if I use 'last+author' or
> 'pub+date' I get an empty reply:
>
>>>>Entrez.esearch(db='pubmed', term=search, retmax=5,
> sort='pub+date').read()
> <?xml version="1.0" ?>\n<!DOCTYPE eSearchResult PUBLIC "-//NLM//DTD
> eSearchResult, 11 May 2002//EN"
> "http://www.ncbi.nlm.nih.gov/entrez/query/DTD/eSearch_020511.dtd">\n<eSearchResult><Count/><RetMax/><RetStart/><TranslationSet/><QueryTranslation/></eSearchResult>\n'
>
> Any suggestions on how to make this work?

The NCBI documentation for "sort" says "Use in conjunction with Web
Environment to display sorted results in ESummary and EFetch.", and in
the example above you are not using the Web Environment (history)
mode.

i.e. I think you need to do an ESearch with history="Y" and
sort="pub+date", then an EFetch which will be in date order.

If you get this working, perhaps you could share a complete example?
It would make a nice cookbook entry for the wiki.

Peter


More information about the Biopython mailing list