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:
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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With