Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort options for Pubmed eutils esearch?

I am using BioPython to query the Pubmed database through the eutils API. The esearch endpoint has a sort option, but the API documentation doesn't list all of the options for this value.

http://www.ncbi.nlm.nih.gov/books/NBK25499/#_chapter4_ESearch_

Example call:

Entrez.esearch(db="pubmed", term=search_term, rettype=rettype, retmax=retmax,
               sort=sort_method)

Values that I know work for sort_method:

  • 'pub date'
  • 'relevance'
  • 'first author'
  • 'last author'
  • 'title'
  • 'journal'

However, I am not sure how to specify the default sort order, which is "Most Recent"; in practice, this appears to be sorted by Pubmed ID value. 'recent', 'most recent', 'pmid', 'id', and 'default' all give the OutputMessage "Unknown sort schema....".

Anyone else know how to explicitly specify the default order?

like image 556
Adam C Avatar asked Nov 15 '25 12:11

Adam C


1 Answers

Not 100% sure if I got your question right. If you don't specify a sort order the default sort order will be used.

handle = Entrez.esearch(db="pubmed", term='TRPV1')
records = Entrez.read(handle)
print('\n'.join(records['IdList']))

will give you the IDs in the same order as on the PubMed web page.

like image 106
Maximilian Peters Avatar answered Nov 17 '25 10:11

Maximilian Peters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!