R/importDataVersions.R

Defines functions importDataVersions

Documented in importDataVersions

#' Import data versions
#'
#' @note The `data_versions.csv` file is only generated for special genomes
#' containing additional information (e.g. the built-in `"hg38"` build).
#'
#' @author Michael Steinbaugh
#' @note Updated 2022-03-07.
#' @export
#'
#' @inheritParams AcidRoxygen::params
#'
#' @return `DataFrame`.
#'
#' @examples
#' file <- file.path(bcbioBaseTestsUrl, "data-versions.csv")
#' x <- importDataVersions(file)
#' print(x)
importDataVersions <- function(file) {
    tryCatch(
        expr = {
            df <- import(
                con = file,
                format = "csv",
                engine = "base"
            )
            df <- as(df, "DataFrame")
            df
        },
        error = function(e) {
            alertWarning("Data versions are missing.")
            DataFrame()
        }
    )
}
hbc/bcbioBase documentation built on Oct. 18, 2023, 1:02 p.m.