Skip to contents

Returns a rule function for use with shinyvalidate::InputValidator's add_rule(). The rule returns NULL for a valid input and a message otherwise. This adapter does not depend on shinyvalidate; it only produces a rule the package can consume.

Usage

sv_biobouncer(
  source_db,
  how = "pattern",
  species = NULL,
  version = NULL,
  message = NULL
)

Arguments

source_db

Source key, for example "mondo". See sources().

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 for version, 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 as 9606. When given, an id of a different species is invalid: Ensembl is checked from its id prefix (in pattern and remote modes), and UniProt from the entry's organism in remote mode. A species outside the source map is not checked.

version

Snapshot version. In cache mode it selects the snapshot and defaults to the latest installed one when omitted; it selects the snapshot for existence mode; ignored in pattern and remote modes.

message

Optional custom message for an invalid input.

Value

A function of one argument suitable for add_rule().

See also

Examples

rule <- sv_biobouncer("mondo")
rule("MONDO:0005148")
#> NULL
rule("mondo:5148")
#> [1] "Not a valid mondo identifier"