Many Entrez APIs accept either a UID list or tokens that point to a result stored on its history server. The classes here wrap these and keep track of the database name that the identifiers belong to. Most of the API helpers in this package are generic over the type of ID set and so can be used the same way with either type. For large numbers of UIDs, the web history versions are generally recommended to avoid running into server-side request timeouts.
Usage
id_list(db, ids = character())
web_history(db, WebEnv, query_key, length = NA)
is_id_set(x)
is_id_list(x)
is_web_history(x)
as_id_list(x, .paginate = 5000L, .path = NULL, .call = current_env())
Arguments
- db
name of the associated Entrez database (e.g.
"biosample"
).- ids
UIDs, coercible to a character vector (can be accessions or GI numbers).
- query_key, WebEnv
history server tokens returned by another Entrez API call.
- length
number of UIDs in the set, if known.
- x
object to test or convert.
- .paginate
controls how multiple API requests are used to complete the call. Pagination is performed using the
retstart
andretmax
API parameters. When set to an integer, no more than.pagniate
items will be requested per API call. WhenFALSE
or0
, only one API request is sent. Ignored whenusehistory
isTRUE
.- .path
path specification for saving raw responses. See
path
argument ofhttr2::req_perform_iterative()
.- .call
call environment to use in error messages/traces. See rlang::topic-error-call and the
call
argument ofcli::cli_abort()
. You only need to specify this in internal helper functions that don't need to be mentioned in error messages.
Value
For
id_list()
andas_id_list()
anid_list
vector.For
web_history()
aweb_history
object.For
is_id_set()
,is_id_list()
, andis_web_history()
a logical.
Details
id_list
is a vector and can be manipulated to take subsets (e.g. id_set[1:10]
or
tail(id_set)
).
web_history
is an opaque reference to an ID list stored on the Entrez
history server. Through the course of API calls, information about the length or
the actual list of IDs may be discovered and cached, avoiding subsequent API calls.
as_id_list()
can be used to extract the list of IDs.
Convert id_list
to web_history
with epost()
.
Convert web_history
to id_list
with as_id_list()
.