A checkmate-style check function. Returns TRUE when every element of x is
a valid identifier for source_db, otherwise a message describing the
failure. A missing element (NA) is not a failure. Pairs with
assert_valid_id() and test_valid_id().
Arguments
- x
A vector of identifiers. Coerced to character.
- source_db
Source key, for example
"mondo". Seesources().- how
Checking mode:
"pattern"(offline, shape only),"cache"(offline existence against a snapshot),"remote"(live existence against the source API), or"existence"(cache when a snapshot is available forversion, otherwise remote, or pattern for a source with no resolver).- species
Optional species context, echoed in the result. A name such as
"homo_sapiens"or an NCBI taxon id such as9606. When given, an id of a different species is invalid: Ensembl is checked from its id prefix (inpatternandremotemodes), and UniProt from the entry's organism inremotemode. A species outside the source map is not checked.- version
Snapshot version. In
cachemode it selects the snapshot and defaults to the latest installed one when omitted; it selects the snapshot forexistencemode; ignored inpatternandremotemodes.
Examples
check_valid_id(c("MONDO:0005148", "MONDO:0018076"), "mondo")
#> [1] TRUE
check_valid_id("mondo:5148", "mondo")
#> [1] "Must be valid mondo identifiers (pattern mode), but 1 of 1 failed, for example 'mondo:5148'"