View source: R/check-annotation-values.R
check_annotation_values | R Documentation |
Checks that all annotation values are valid. It does not report on values for
invalid keys; see check_annotation_keys()
.
check_annotation_values(x, annotations, ...) ## S3 method for class ''NULL'' check_annotation_values(x, annotations, ...) ## S3 method for class 'synapseclient.entity.File' check_annotation_values(x, annotations, syn, ...) ## S3 method for class 'data.frame' check_annotation_values(x, annotations, ...) ## S3 method for class 'synapseclient.table.CsvFileTable' check_annotation_values(x, annotations, ...)
x |
An object to check. |
annotations |
A data frame of annotation definitions. Must contain at
least three columns: |
... |
Additional options to |
syn |
Synapse client object |
If the allowable annotation values are an enumerated list,
check_annotation_values()
compares the values in the data to the values in
this list. If there is no enumerated list of values and the annotation
definition merely specifies a required type, then the values are checked
against that type, with values that are coercible to the correct type treated
as valid (see can_coerce()
).
A condition object indicating whether all annotation values are valid. Invalid annotation values are included as data within the object.
NULL
: Return NULL
synapseclient.entity.File
: Check annotation values on a Synapse file
data.frame
: Check annotation values in a data frame
synapseclient.table.CsvFileTable
: Check annotation values in a Synapse table
valid_annotation_values()
, can_coerce()
annots <- data.frame( key = c("assay", "fileFormat", "fileFormat", "fileFormat", "species"), value = c("rnaSeq", "fastq", "txt", "csv", "Human"), columnType = c("STRING", "STRING", "STRING", "STRING", "STRING") ) dat1 <- data.frame(assay = "not a valid assay") dat2 <- data.frame(assay = "rnaSeq") check_annotation_values(dat1, annots) check_annotation_values(dat2, annots) ## Not run: syn <- synapse$Synapse() syn$login() annots <- get_synapse_annotations(syn = syn) my_file <- syn$get("syn11931757", downloadFile = FALSE) check_annotation_values(my_file, annots) dat <- data.frame( non_annotation = 5:7, assay = c("rnaSeq", "foo", "bar"), stringsAsFactors = FALSE ) check_annotation_values(dat, annots) fv <- synTableQuery("SELECT * FROM syn17020234") check_annotation_values(fv, annots) # If you don't specify an annotations data frame, these functions will # download annotations automatically using `get_synapse_annotations()` (must # be logged in to Synapse) my_file <- syn$get("syn11931757", downloadFile = FALSE) check_annotation_values(my_file, syn = syn) # It is possible to allowlist certain certain values, or all values for # certain keys: check_annotation_values(dat, allowlist_keys = "assay", syn = syn) check_annotation_values( dat, allowlist_values = list(assay = c("foo")), syn = syn ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.