R/predicates.R

Defines functions is_report_key is_mgi_identifier

Documented in is_mgi_identifier

#' MGI accession identifier checking
#'
#' [is_mgi_identifier()] checks whether the input is of the format
#' `"MGI:nnnnnn"`, where `"n"` is a digit and the number of digits can vary.
#'
#' @param x A character vector.
#'
#' @returns A logical vector.
#'
#' @keywords internal
is_mgi_identifier <- function(x) {

  if (!(rlang::is_character(x)))
    rlang::abort("`x` must be a character vector.")

  grepl("^MGI:\\d+$", x)
}

#' @keywords internal
is_report_key <- function(report_key) {

  if (!(rlang::is_character(report_key)))
    rlang::abort("`report_key` must be a character vector.")

  report_key %in% reports$report_key

}

Try the mgi.report.reader package in your browser

Any scripts or data that you put into this service are public.

mgi.report.reader documentation built on Sept. 11, 2024, 8:41 p.m.