ropensci / rentrez

talk with NCBI entrez using R
https://docs.ropensci.org/rentrez
Other
195 stars 38 forks source link

Meta: handle API keys #114

Closed dwinter closed 6 years ago

dwinter commented 6 years ago

NCBI is going to start using API keys to allow registered users to make more requests per second. https://ncbiinsights.ncbi.nlm.nih.gov/2017/11/02/new-api-keys-for-the-e-utilities/

Will use this as a meta issue to list as track changes need to support this change.

A proposed solution

This should actually be simple to handle. In fact, the main entrez functions will all happily pass on the new api_key argument and its value. We can still make it easier for users and developers of 'higher-level' packages to use this feature, so here is a proposed change.

  1. Document the existence of an environment variable ENTREZ_KEY and describe how users can set this in their Renviron files
  2. Modify the function make_entrez_query to
    • search for the argument api_key in any request
    • if this argument is not present look for the ENTREZ_KEY environmental value to pass to NCBI
  3. Delete the Sys.sleep() arguments many entrez functions have, since > 3 requests per second will now be allowed. (Need to check with NCBI exactly how to handle this).

From the typical user's point of view, this means they can take advantage of the API keys either by explicitly passing them to a function or by setting them as an environmental variable.

Developers of packages that use the rentrez will not have to make any changes, but the NCBI-calling function will take advantage of the keys if an ENTREZ_KEY is set.

sckott commented 6 years ago

thx @dwinter - should make sure I take this into account in taxize as well