diff --git a/R/io.R b/R/io.R index a482479..b2de032 100644 --- a/R/io.R +++ b/R/io.R @@ -378,6 +378,19 @@ format.mtmutObj <- function(x, ...) { #' @param ... other parameters passed to \code{\link[base]{format}} or \code{\link[base]{print}}. #' @return a string #' @export +#' @examples +#' ## Use the example data +#' f <- system.file("extdata", "mini_dataset.tsv.gz", package = "scMitoMut") +#' ## Create a temporary h5 file +#' ## In real case, we keep the h5 in project folder for future use +#' f_h5_tmp <- tempfile(fileext = ".h5") +#' ## Load the data with parse_table function +#' f_h5 <- parse_table(f, sep = "\t", h5_file = f_h5_tmp) +#' f_h5 +#' ## open the h5 file and create a mtmutObj object +#' x <- open_h5_file(f_h5) +#' x +#' print(x) print.mtmutObj <- function(x, ...) { format(x, ...) } @@ -561,7 +574,7 @@ filter_loc <- function(mtmutObj, min_cell = 5, model = "bb", p_threshold = 0.05, res_2 <- parallel::mclapply(res$loc, function(xi) { d <- read_locus(mtmutObj, xi) pval <- get_pval(mtmutObj, xi, model = model, method = p_adj_method) - n <- sum((d$coverage - d$alt_depth) >= alt_count_threshold & pval <= p_threshold, na.rm = T) + n <- sum((d$coverage - d$alt_depth) >= alt_count_threshold & pval <= p_threshold, na.rm = TRUE) data.frame(loc = xi, mut_cell_n = n) }) %>% rbindlist() res <- res_2[mut_cell_n >= min_cell] diff --git a/R/stat_ensemble.R b/R/stat_ensemble.R index f2d2cea..b3d5622 100644 --- a/R/stat_ensemble.R +++ b/R/stat_ensemble.R @@ -41,7 +41,7 @@ get_bm_pval <- function(x, method = "none") { #' res #' #' @export -process_locus_bmbb <- function(mtmutObj, loc, dom_allele = NULL, return_data = FALSE, bb_over_bm = T, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr", ...) { +process_locus_bmbb <- function(mtmutObj, loc, dom_allele = NULL, return_data = FALSE, bb_over_bm = TRUE, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr", ...) { if (!is(mtmutObj, "mtmutObj")) { stop("mtmutObj must be a mtmutObj object.") @@ -117,7 +117,7 @@ process_locus_bmbb <- function(mtmutObj, loc, dom_allele = NULL, return_data = F #' x <- filter_loc(x, min_cell = 5, model = "bb", p_threshold = 0.05, p_adj_method = "fdr") #' x #' @export -run_model_fit <- function(mtmutObj, mc.cores = getOption("mc.cores", 1L), bb_over_bm = T, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr") { +run_model_fit <- function(mtmutObj, mc.cores = getOption("mc.cores", 1L), bb_over_bm = TRUE, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr") { if (!is(mtmutObj, "mtmutObj")) { stop("mtmutObj must be a mtmutObj object.") diff --git a/man/print.mtmutObj.Rd b/man/print.mtmutObj.Rd index c3673d1..ba08ee6 100644 --- a/man/print.mtmutObj.Rd +++ b/man/print.mtmutObj.Rd @@ -23,3 +23,17 @@ a string \description{ The print method for mtmutObj object. } +\examples{ +## Use the example data +f <- system.file("extdata", "mini_dataset.tsv.gz", package = "scMitoMut") +## Create a temporary h5 file +## In real case, we keep the h5 in project folder for future use +f_h5_tmp <- tempfile(fileext = ".h5") +## Load the data with parse_table function +f_h5 <- parse_table(f, sep = "\t", h5_file = f_h5_tmp) +f_h5 +## open the h5 file and create a mtmutObj object +x <- open_h5_file(f_h5) +x +print(x) +} diff --git a/man/process_locus_bmbb.Rd b/man/process_locus_bmbb.Rd index efd151e..160a6c8 100644 --- a/man/process_locus_bmbb.Rd +++ b/man/process_locus_bmbb.Rd @@ -9,7 +9,7 @@ process_locus_bmbb( loc, dom_allele = NULL, return_data = FALSE, - bb_over_bm = T, + bb_over_bm = TRUE, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr", ... diff --git a/man/run_model_fit.Rd b/man/run_model_fit.Rd index 4dcc142..55d4013 100644 --- a/man/run_model_fit.Rd +++ b/man/run_model_fit.Rd @@ -7,7 +7,7 @@ run_model_fit( mtmutObj, mc.cores = getOption("mc.cores", 1L), - bb_over_bm = T, + bb_over_bm = TRUE, bb_over_bm_p = 0.05, bb_over_bm_adj = "fdr" )