R/read_pheno_model_file.R

Defines functions read_pheno_model_file

Documented in read_pheno_model_file

#' Read a `GCAE` phenotypic model file
#' @inheritParams default_params_doc
#' @return the `pheno_model` as a JSON object
#' @seealso
#' Use \link{read_model_file} to read a `model`
#' @examples
#' if (is_gcae_repo_cloned()) {
#'   # A real GCAE file
#'   pheno_model_filename <- get_gcae_pheno_model_filename("p1")
#' } else {
#'   # An example file
#'   pheno_model_filename <- get_gcaer_filename("p0.json")
#' }
#' read_pheno_model_file(pheno_model_filename)
#' @author Richèl J.C. Bilderbeek
#' @export
read_pheno_model_file <- function(pheno_model_filename) {
  testthat::expect_true(file.exists(pheno_model_filename))
  gcaer::check_pheno_model_filename(pheno_model_filename)
  jsonlite::read_json(pheno_model_filename)
}
richelbilderbeek/gcaer documentation built on March 25, 2024, 3:08 p.m.