ropensci / rentrez

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

Error in ans[[1]] : subscript out of bounds #133

Closed anleopa closed 3 years ago

anleopa commented 5 years ago

These queries throw an error: Q1: id_list <- rentrez::entrez_search(db="clinvar", term="human[Organism]", retmax = 100000, retstart = 0) Q2: id_list <- rentrez::entrez_search(db="clinvar", term="human[Organism]", retmax = 200, retstart = 100000)

Error in ans[[1]] : subscript out of bounds

But these queries don't: id_list <- rentrez::entrez_search(db="clinvar", term="human[Organism]", retmax = 99999, retstart = 0) id_list <- rentrez::entrez_search(db="clinvar", term="human[Organism]", retmax = 200, retstart = 99999)

The first query attempts to retrieve the first 100,000 records and the second one 200 records starting from the position 100,000

I tried with retstart = 200,000 and thowrs the same error... but everything works fine with 199,000

dwinter commented 5 years ago

Hi @anleopa ,

Thanks for reporting this, when you see errors that are unique to "large round numbers" like this it's almost always to do with the numbers being represented of scientific notation. You can get around this by setting the scipen option to some very large number

Vanilla R:

 1e5
# [1] 1e+05

With scipen:

options("scipen"=100)
1e5
# [1] 100000

Setting scipen this way will provide a workaround for your case, but rentrez shuold do a better job in these cases, so I'll eave this issue open until it's fixed.

IdoBar commented 2 years ago

Having the same issue with species <- entrez_search("taxdb", "neisseria gonorrhoeae OR gardnerella vaginalis") but the proposed solution did not work for me.

drumstick90 commented 1 year ago

Having the same issue with species <- entrez_search("taxdb", "neisseria gonorrhoeae OR gardnerella vaginalis") but the proposed solution did not work for me.

did you ever solve it? I am encountering it with entrez_search(db = "pubmed", term = "cancer")