#' prep_project_data
#'
#' @description prepare an RDS file for loading into the data.
#'
#' Requirements:
#' - RDS
#' - A list of 6 tables corresponding to:
#' 1. Quality control table (QCTable)
#' 2. Editing frequency table (EditingFreq)
#' 3. Indel frequency table (IndelFreq)
#' 4. CRISPR summary table (CRISPRSummary)
#' 5. Sample metadata table (SampleMeta)
#' 6. Allele frequency and Sequence alignment table (AlleleAlignFreq)
#' - The order matters
#' - Currently, no checks are made for table composition and column types,
#' so be sure to the table conform to original examples
#'
#' Procedure:
#' 1. Load the RDS list of tables
#' 2. Rename the tables
#' 3. Format the column names into BigCamel
#' 4. Save to a serialized, fast, QC binary file for faster reading in-app
#'
#' @param project_rds_path character, path to the project data RDS file
#' @param output_qs_path character, path for the output serialized qs file
#'
#' @importFrom qs qsave
#' @importFrom janitor clean_names
#'
#' @export
prep_project_data <- function(project_rds_path, output_qs_path) {
table_names <- c(
"QCTable",
"EditingFreq",
"IndelFreq",
"CRISPRSummary",
"SampleMeta",
"AlleleAlignFreq"
)
# 1. load the rds
project_data <- readRDS(project_rds_path)
# 2. rename tables
names(project_data) <- table_names
# 3. rename columns
project_data <- lapply(project_data, janitor::clean_names, case = "big_camel")
# 4. write to file
qs::qsave(x = project_data, file = output_qs_path, preset = "balanced")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.