Question: Strange esearch behavior
0
gravatar for RamRS
4 months ago by
RamRS20k
Houston, TX
RamRS20k wrote:

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?

eutils esearch ncbi • 214 views
ADD COMMENTlink modified 4 months ago • written 4 months ago by RamRS20k

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 REPLYlink written 4 months ago by vkkodali990

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 REPLYlink modified 4 months ago • written 4 months ago by RamRS20k
1
gravatar for vkkodali
4 months ago by
vkkodali990
United States
vkkodali990 wrote:

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 COMMENTlink written 4 months ago by vkkodali990

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 REPLYlink written 4 months ago by RamRS20k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1002 users visited in the last hour