Skip to content

Commit

Permalink
opt: use TRUE/FALSE instead of T/F
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjie1991 committed Jan 17, 2024
1 parent 5ac0707 commit a3894b7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
15 changes: 14 additions & 1 deletion R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...)
}
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions R/stat_ensemble.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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.")
Expand Down
14 changes: 14 additions & 0 deletions man/print.mtmutObj.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/process_locus_bmbb.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/run_model_fit.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a3894b7

Please sign in to comment.