If data is an addition to an existing study, check the specimen and individual IDs against the master table of existing IDs. Contributors should upload the complete metadata files, so all IDs in the master table should be present in the uploaded data.

check_complete_ids(
  data,
  samples_table,
  study,
  id_type = c("individualID", "specimenID"),
  assay = NULL,
  success_msg = "Data includes a complete set of IDs",
  fail_msg = "Some IDs are missing from the data"
)

Arguments

data

Data frame of data to be checked

samples_table

Data frame containing master table of all individual and specimen IDs per study

study

Name of the study

id_type

"individualID" or "specimenID"

assay

String naming the assay. If provided, will filter master_table to the specific study and assay. This is useful when validating assay metadata in studies wheere multiple assays with different specimens were conducted. If NULL (the default), will look at all IDs for the study, regardless of assay.

success_msg

Message indicating the check succeeded.

fail_msg

Message indicating the check failed.

Value

A condition object indicating whether the required columns were present ("check_pass") or absent ("check_fail")

Examples

samples_table <- tibble::tribble( ~individualID, ~specimenID, ~study, ~assay, "A", "a1", "study1", "rnaSeq", "A", "a2", "study1", "rnaSeq", "B", "b1", "study1", "rnaSeq", "B", "b2", "study1", "rnaSeq", "B", "b1", "study1", "rnaSeq", "B", "b1", "study1", "rnaSeq", "C", "c1", "study1", "LC-MS", "D", "d1", "study2", "rnaSeq", "D", "d2", "study2", "rnaSeq" ) dat <- tibble::tribble( ~individualID, ~specimenID, "A", "a1", "A", "a2" ) check_complete_ids( data = dat, samples_table = samples_table, id_type = "individualID", study = "study1" )
#> <error/check_fail> #> Some IDs are missing from the data