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?
But there are no results for your query:
Sure,
rettype=count
gives us0
, but then why doesrettype=uilist
have a UI entry? I don't wish to perform multipleesearch()
calls per keyword, so should the search not be consistent regardless of therettype
?For example, try
esearch('XXYYZZ [Gene Name] AND Homo sapiens[ORGN]', db='gene', rettype='uilist')