ropensci / rentrez

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

entrez_link: Error in res[[1]] : subscript out of bound #152

Closed SuzeMa closed 3 years ago

SuzeMa commented 3 years ago

Hi, I use entrez_link () to get nuccore db info from a given protein db query in a large-batch fashion (perhaps execute thousands of queries in a loop). This function was used in an ubuntu command line R script (termed rentrez_utils) and after a smooth execution of the first ~750 queries, I encountered an error shown below.

Error in res[[1]] : subscript out of bound Calls: rentrez_utils -> entrez_link -> parse_elink

Since then, this script cannot run smoothly in the command line as this error will occur frequently (after 1~3 query execution).

If anyone has encountered the same issue or has suggestions for me on how to troubleshoot. Thank you very much!

Suze Ma

dwinter commented 3 years ago

Hi @SuzeMa, sorry for not getting to this earlier (2020..). I'm clearing the backlog of issues here now. did you ever resolve this, or is it still an issue.

This issue usually occurs when an empty record is downloaded (e.g. no hits for a given ID), but easier to track down if we have speific cases of the problem.

vragh commented 3 years ago

Hi @dwinter,

I'm not the OP but I'm encountering a similar (maybe the same?) error. I think this issue needs to be re-opened?

Test case:

library(rentrez)

sres <- entrez_search(db = "nucleotide", term = "1456203346[UID]", use_history = TRUE)

sres
#Entrez search result with 1 hits (object contains 1 IDs and a web_history object)
# Search term (as translated):  1456203346[UID]

lres <- entrez_link(dbfrom = "nucleotide", db = "protein", web_history = sres, cmd = "neighbor_history")
#Error in res[[1]] : subscript out of bounds

The error seems to get thrown by rentrez:::parse_elink() that's being called by rentrez::entrez_elink().

This is with rentrez v1.2.3 on R version 4.0.5.