traits icon indicating copy to clipboard operation
traits copied to clipboard

Error : Bad Request (HTTP 400)

Open babinecha opened this issue 1 year ago • 1 comments

Hi! I'm trying to use ncbi_byname function, but it is returning the Error : Bad Request (HTTP 400). What can I do?

ncbi_byname(taxa="Otaria flavescens", gene = c("coi", "co1"), seqrange = "1:2000")

Returns:

Working on Otaria flavescens... ...retrieving sequence IDs... Error : Bad Request (HTTP 400) NULL

babinecha avatar Mar 18 '24 17:03 babinecha

@babinecha Do you have an API Key? Try

Sys.getenv("ENTREZ_KEY", "")

And if the result is an empty string (""), try:

  • create an NCBI account (if you don't have one) https://www.ncbi.nlm.nih.gov/account/
  • generate an API key
    • go to https://www.ncbi.nlm.nih.gov/account/settings/
    • scroll down and create an API key
    • copy the key
  • store the key in your .Renviron
    • an easy way is to install the usethis package and type usethis::edit_r_environ()
    • add a line with ENTREZ_ID="your_api_key_here"
    • restart R and try again

(plus, note to self, I need to update the documentation)

dlebauer avatar May 18 '24 03:05 dlebauer