Check that a given set of keys are all present in an annotations dictionary

check_keys(
  x,
  annotations,
  allowlist_keys = NULL,
  success_msg = "All annotation keys are valid",
  fail_msg = "Some annotation keys are invalid",
  annots_link = "https://shinypro.synapse.org/users/nsanati/annotationUI/",
  return_valid = FALSE,
  syn
)

Arguments

x

A data frame of annotation data

annotations

A data frame of annotations to check against

allowlist_keys

A character vector of annotation keys to allowlist. If provided, all values for the given keys will be treated as valid.

success_msg

Message indicating the check succeeded.

fail_msg

Message indicating the check failed.

annots_link

Link to a definition of the annotations being used in the project

return_valid

Should the function return valid values? Defaults to FALSE (i.e. the function will return invalid values).

syn

Synapse client object

Value

A condition object indicating whether keys match the given annotation dictionary. Erroneous keys are included as data within the object.

Examples

annots <- data.frame( key = c("fileFormat", "fileFormat"), value = c("txt", "csv"), columnType = c("STRING", "STRING"), stringsAsFactors = FALSE ) check_keys("fileFormat", annots)
#> <check_pass: All annotation keys are valid>
check_keys("x", annots)
#> <error/check_fail> #> Some annotation keys are invalid