#' Given a Seurat object and treatment variable, compare
#' clusters between levels of the treatment
#'
#' @param obj Seurat object
#' @param trt_var Treatment variable
#' @param rep_var Replicate/Individual ID variable
#' @param ci Whether to plot binomial confidence intervals (Jeffreys)
#' @param group_by Name of grouping variable (default is Idents)
#' @examples
#' pbmc_small$trt <- sample(c('drug', 'control'), ncol(pbmc_small), replace=TRUE)
#' pbmc_small$genotype <- sample(c('1', '2', '3'), ncol(pbmc_small), replace=TRUE)
#' CompareClustersByTrt(pbmc_small, trt, genotype)
#'
#' @export
CompareClustersByTrt <- function(obj, trt_var, rep_var, group_by = NULL, ci = TRUE, ci_alpha = 0.05,
seed = 1, ...) {
grp_stats <- ComputeClustersByTrt(obj, {{ trt_var }}, {{ rep_var }},
group_by = group_by, ci = ci,
ci_alpha = ci_alpha)
PlotClustersByTrt(grp_stats, seed = seed, ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.