Closed akshaynagpal closed 9 years ago
Hi @akshaynagpal, thanks for reporting this. This error occurs when you send too many IDs, and the resuling URL becomes too long.
If you want to work on many IDs I'd suggest using the 'webenv' features. The CRAN version of rentrez doesn't handle these for entrez_link
, but the dev version does:
library(devtools)
install_github("dwinter/rentrez")
library(rentrez)
ps <- entrez_search(db="pubmed","HRVA")
ps_2 <- entrez_link(dbfrom="pubmed",id=ps$ids,db="pubmed", cmd="neighbor_history")
ps_2
This object will contain a WebEnv ( basically a cookie) and a list of keys for each database matched by the search.
elink object with contents:
$WebEnv: A WebEnv (cookie) value
$QueryKeys: A list of QUeryKeys for each included database
You can use that to get your big entrez summay list
res <- entrez_summary("pubmed", WebEnv=ps_2$WebEnv, query_key = ps_2$QueryKeys$pubmed_pubmed, version = "1.0")
List of 1093 esummary records. First record:
$`25672409`
esummary result with 25 items:
[1] PubDate EPubDate Source AuthorList LastAuthor Title Volume
[8] Issue Pages LangList NlmUniqueID ISSN ESSN PubTypeList
[15] RecordStatus PubStatus ArticleIds DOI History References HasAbstract
[22] PmcRefCount FullJournalName ELocationID SO
There is also a useful new function, extract_from_esummary
dois <- extract_from_esummary(res, "DOI")
head(dois)
$`25672409`
[1] "10.7883/yoken.JJID.2014.090"
$`25001076`
[1] "10.1007/s00234-014-1399-y"
$`24389019`
[1] "10.1016/j.jinf.2013.12.010"
$`24267739`
[1] "10.1016/j.jns.2013.10.039"
$`22865548`
[1] "10.1002/lary.23411"
$`22087272`
[1] "10.1371/journal.pone.0027247"
I will make sure the development versions hints at this solution when a user runs into this error (#46)
Thanks a lot! Will try webenv asap! Loved your work in this R package by the way ! Will keep contributing in any way possible! Cheers!
Thankw @akshaynagpal . As I say, the webenv features are new, so there may well be cases that break what I've written. Let me know if you find any problems :)
install_github("dwinter/rentrez")
This gives the following error:
Downloading github repo dwinter/rentrez@master Error in download(dest, src, auth) : client error: (404) Not Found
Oh, yeah, this isn't under by account! try
install_github("ropensci/rentrez")
Error in make_entrez_query("esummary", db = db, config = config, retmode = retmode, : client error: (414) Request-URI Too Long
The above error occurs at line given below:
My total code is :