Strange esearch behavior
1
0
Entering edit mode
6.1 years ago
Ram 44k

This is a follow-up (kinda) to my previous question: Exclude Replaced or Discontinued UIDs from an reutils.esearch operation

I have a function where I

  • Call esearch on a query
  • Check if it has $no_errors() and then check if only one result is returned (length(uid(esearch())) == 1)
  • If the above conditions are satisfied, perform an esummary() call.

There's this search that throws off my algorithm: FAM231D [Gene Name] AND Homo sapiens[ORGN]. It returns 1 result, where the UID is NA. I feel cheated, like I got a gift-wrapped empty box in the mail. It's either supposed to error out if no results are found, or at least give me length(uid()) = 0.

Code:

> esearch('FAM231D', db='gene')
Object of class ‘esearch’
List of UIDs from the ‘gene’ database.
 [1] "103091866" "102724235" "100996721" "746217   " "113220841" "111543928"
 [7] "111535250" "108538690" "107000807" "105730623" "105709924" "105707698"
[13] "105707697" "105597670" "105549803" "105532204" "105478985" "104667973"
[19] "103889731" "102145358" "101147160" "100996741" "100986275" "100591271"

> esearch('FAM231D AND Homo sapiens[ORGN]', db='gene')
Object of class ‘esearch’
List of UIDs from the ‘gene’ database.
[1] "103091866" "102724235" "100996721" "100996741"

> esearch('FAM231D [Gene Name] AND Homo sapiens[ORGN]', db='gene')
Object of class ‘esearch’
List of UIDs from the ‘gene’ database.
[1] "NA"

> esearch('FAM231D [Gene Name] AND Homo sapiens[ORGN]', db='gene')$no_errors()
[1] TRUE

> uid(esearch('FAM231D [Gene Name] AND Homo sapiens[ORGN]', db='gene'))
[1] NA

> length(uid(esearch('FAM231D [Gene Name] AND Homo sapiens[ORGN]', db='gene')))
[1] 1

What's going on here?

ncbi eutils esearch • 1.3k views
ADD COMMENT
0
Entering edit mode

But there are no results for your query:

> esearch('FAM231D[Gene Name] AND Homo sapiens[ORGN]', db='gene', rettype = "count")
Object of class ‘esearch’ 
[1] 0
ADD REPLY
0
Entering edit mode

Sure, rettype=count gives us 0, but then why does rettype=uilist have a UI entry? I don't wish to perform multiple esearch() calls per keyword, so should the search not be consistent regardless of the rettype?

For example, try esearch('XXYYZZ [Gene Name] AND Homo sapiens[ORGN]', db='gene', rettype='uilist')

ADD REPLY
1
Entering edit mode
6.1 years ago
vkkodali_ncbi ★ 3.8k

I cannot say what the motivation was for this behavior in reutils. From the linux command line, both of the following queries work in the same way:

$ esearch -db gene -q 'FAM231D[Gene Name] AND Homo sapiens[ORGN]'
<ENTREZ_DIRECT>
  <Db>gene</Db>
  <WebEnv>NCID_1_47230685_130.14.18.34_9001_1540567994_1662557237_0MetA0_S_MegaStore</WebEnv>
  <QueryKey>1</QueryKey>
  <Count>0</Count>
  <Step>1</Step>
</ENTREZ_DIRECT>
$ esearch -db gene -q 'XXYYZZ[Gene Name] AND Homo sapiens[ORGN]'
<ENTREZ_DIRECT>
  <Db>gene</Db>
  <WebEnv>NCID_1_149285401_130.14.18.125_9001_1540578340_428880606_0MetA0_S_MegaStore</WebEnv>
  <QueryKey>1</QueryKey>
  <Count>0</Count>
  <Step>1</Step>
</ENTREZ_DIRECT>

That said, you can probably check for uid != "NA" in addition to length(uid(esearch())) == 1 to get around this issue.

ADD COMMENT
0
Entering edit mode

I guess I'll have to use the work-around for now. Thank you! If you could move your comment to an answer (using the moderate option), I'll accept it.

ADD REPLY

Login before adding your answer.

Traffic: 1613 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6