代码之家  ›  专栏  ›  技术社区  ›  Josh

Rentrez错误HTTP失败:下载超过1/3条记录时为400

  •  0
  • Josh  · 技术社区  · 8 年前

    我有个奇怪的情况。我正在使用 rentrez 是的。当我跑的时候 entrez_search() 然后 entrez_summary() 然后 entrez_fetch() 我收到这个错误的消息(完整的代码在文章的底部):

    Error: HTTP failure: 400
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
    <eFetchResult>
        <ERROR>Cannot retrieve history data. query_key: 1, WebEnv: NCID_1_51629226_130.14.18.34_9001_1531773486_1795859931_0MetA0_S_MegaStore, retstart: 0, retmax: 552</ERROR>
        <ERROR>Can't fetch uids from history because of: NCBI C++ Exception:
        Error: UNK_MODULE(CException::eInvalid) "UNK_FILE", line 18446744073709551615: UNK_FUNC --- 
    </ERROR>
    </eFetchResult>
    

    在四处寻找之后,我想我已经在 this discussion 查询大小的。当我减少 retmax_set 从500到10,代码起作用了。然后迭代确定最大值。 retmax_集 不会抛出错误并发现在我看来非常怪异行为的值。

    搜索 term_set = "transcription AND enhancer AND promoter AND 2017:2018[PDAT]" 是的552张唱片。当使用不同的值运行我的代码时 retmax 以下内容:

    • 设置 retmax_集 <=183件
    • 设置 retmax_集 >=184给出上述错误

    修改过的搜索 term_set = "transcription AND enhancer AND promoter AND 2018[PDAT]" 是186张唱片。使用不同的值运行此搜索时 雷特麦克斯 以下内容:

    • 设置 retmax_集 <=61件
    • 设置 retmax_集 >=62给出上述错误

    搜索 term_set = "transcription AND enhancer AND promoter AND 2017[PDAT]" Yeilds 395条记录(由于某种原因,PubMed将29条记录标注为在2017年和2018年发布)。使用不同的值运行此搜索项上的代码时 雷特麦克斯 以下内容:

    • 设置 retmax_集 <=131件
    • 设置 retmax_集 >=132给出上述误差

    有趣的是,当 雷特麦克斯 值大于记录总数的三分之一(552/3=184186/3=62395/3=131.67)。我要修改我的代码来计算 retmax_集 基于返回的结果数 entrez_search ,但我不知道为什么 伦特雷斯 或者NCBI正在这么做。有什么想法吗?

    > ##  set search term 
    > term_set = "transcription AND enhancer AND promoter AND 2017:2018[PDAT]"
    > ##  load package
    > library(rentrez)
    > ##  set maximum records batch
    > retmax_set = 182
    > ##  search pubmed using web history
    > search <- entrez_search(
    +   db = "pubmed", 
    +   term = term_set, 
    +   use_history = T
    + )
    > ##  get summaries of search hits 
    > summary <- list(); for (seq_start in seq(0, search$count - 1, retmax_set)) {
    +     summary1 <- entrez_summary(
    +         db = "pubmed", 
    +         web_history = search$web_history, 
    +         retmax = retmax_set, 
    +         retstart = seq_start
    +     )
    +     summary <- c(summary, summary1)
    + }
    > ##  download full XML refs for hits
    > XML_refs <- entrez_fetch(
    +     db = "pubmed", 
    +     web_history = search$web_history, 
    +     rettype = "xml", 
    +     parsed = TRUE
    + )
    > 
    > 
    > ##  set search term 
    > term_set = "transcription AND enhancer AND promoter AND 2017:2018[PDAT]"
    > ##  load package
    > library(rentrez)
    > ##  set maximum records batch
    > retmax_set = 183
    > ##  search pubmed using web history
    > search <- entrez_search(
    +   db = "pubmed", 
    +   term = term_set, 
    +   use_history = T
    + )
    > ##  get summaries of search hits 
    > summary <- list(); for (seq_start in seq(0, search$count - 1, retmax_set)) {
    +     summary1 <- entrez_summary(
    +         db = "pubmed", 
    +         web_history = search$web_history, 
    +         retmax = retmax_set, 
    +         retstart = seq_start
    +     )
    +     summary <- c(summary, summary1)
    + }
    > ##  download full XML refs for hits
    > XML_refs <- entrez_fetch(
    +     db = "pubmed", 
    +     web_history = search$web_history, 
    +     rettype = "xml", 
    +     parsed = TRUE
    + )
    > 
    > 
    > ##  set search term 
    > term_set = "transcription AND enhancer AND promoter AND 2017:2018[PDAT]"
    > ##  load package
    > library(rentrez)
    > ##  set maximum records batch
    > retmax_set = 184
    > ##  search pubmed using web history
    > search <- entrez_search(
    +   db = "pubmed", 
    +   term = term_set, 
    +   use_history = T
    + )
    > ##  get summaries of search hits 
    > summary <- list(); for (seq_start in seq(0, search$count - 1, retmax_set)) {
    +     summary1 <- entrez_summary(
    +         db = "pubmed", 
    +         web_history = search$web_history, 
    +         retmax = retmax_set, 
    +         retstart = seq_start
    +     )
    +     summary <- c(summary, summary1)
    + }
    > ##  download full XML refs for hits
    > XML_refs <- entrez_fetch(
    +     db = "pubmed", 
    +     web_history = search$web_history, 
    +     rettype = "xml", 
    +     parsed = TRUE
    + )
    Error: HTTP failure: 400
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
    <eFetchResult>
        <ERROR>Cannot retrieve history data. query_key: 1, WebEnv: NCID_1_51629226_130.14.18.34_9001_1531773486_1795859931_0MetA0_S_MegaStore, retstart: 0, retmax: 552</ERROR>
        <ERROR>Can't fetch uids from history because of: NCBI C++ Exception:
        Error: UNK_MODULE(CException::eInvalid) "UNK_FILE", line 18446744073709551615: UNK_FUNC --- 
    </ERROR>
    </eFetchResult>
    > 
    > 
    > ##  set search term 
    > term_set = "transcription AND enhancer AND promoter AND 2017:2018[PDAT]"
    > ##  load package
    > library(rentrez)
    > ##  set maximum records batch
    > retmax_set = 185
    > ##  search pubmed using web history
    > search <- entrez_search(
    +   db = "pubmed", 
    +   term = term_set, 
    +   use_history = T
    + )
    > ##  get summaries of search hits 
    > summary <- list(); for (seq_start in seq(0, search$count - 1, retmax_set)) {
    +     summary1 <- entrez_summary(
    +         db = "pubmed", 
    +         web_history = search$web_history, 
    +         retmax = retmax_set, 
    +         retstart = seq_start
    +     )
    +     summary <- c(summary, summary1)
    + }
    > ##  download full XML refs for hits
    > XML_refs <- entrez_fetch(
    +     db = "pubmed", 
    +     web_history = search$web_history, 
    +     rettype = "xml", 
    +     parsed = TRUE
    + )
    Error: HTTP failure: 400
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE eEfetchResult PUBLIC "-//NLM//DTD efetch 20131226//EN" "https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20131226/efetch.dtd">
    <eFetchResult>
        <ERROR>Cannot retrieve history data. query_key: 1, WebEnv: NCID_1_52654089_130.14.22.215_9001_1531773493_484860305_0MetA0_S_MegaStore, retstart: 0, retmax: 552</ERROR>
        <ERROR>Can't fetch uids from history because of: NCBI C++ Exception:
        Error: UNK_MODULE(CException::eInvalid) "UNK_FILE", line 18446744073709551615: UNK_FUNC --- 
    </ERROR>
    </eFetchResult>
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   Josh    7 年前

    结果是Rentrez使用0进制计数。所以552条记录对应于 retstart 值为0到551。因为我的代码正在寻找值1到552,所以它错过了第一个记录(0),然后在寻找不存在的记录552时抛出了一个错误。

    推荐文章