Skip to content

Commit

Permalink
bf, comm processSeuratObject
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Jun 20, 2024
1 parent d1fbcc2 commit c1f3494
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions R/Seurat.Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,18 @@ processSeuratObject <- function(obj, param.list = p, add.meta.fractions = FALSE,
...) {
#
warning("Make sure you cleaned up the memory!", immediate. = TRUE)
tic()
stopifnot(require(tictoc))
message("nfeatures: ", nfeatures)

tic()

# Assertions to check input types _________________________________________________
stopifnot(
"Seurat" %in% class(obj),
is.list(param.list),
all(c("n.PC", "snn_res") %in% names(param.list)),
is.numeric(n.PC),
is.numeric(resolutions),
is.character(variables.2.regress) | is.null(variables.2.regress)
)

.checkListElements(param_list = p, elements = c("variables.2.regress.combined", "n.PC", "snn_res"))
is.numeric(n.PC), is.numeric(resolutions),
is.character(variables.2.regress) | is.null(variables.2.regress),
"variables.2.regress is not found in @meta" = variables.2.regress %in% colnames(obj@meta.data)
)

iprint("nfeatures:", nfeatures)
iprint("n.PC:", n.PC)
Expand All @@ -87,6 +83,8 @@ processSeuratObject <- function(obj, param.list = p, add.meta.fractions = FALSE,
param.list$"n.PC" <- n.PC
param.list$"snn_res" <- resolutions

# .checkListElements(param_list = param.list, elements = c("variables.2.regress.combined", "n.PC", "snn_res"))

obj@misc$"p" <- param.list # overwrite previous parameters

gc()
Expand Down Expand Up @@ -5450,7 +5448,7 @@ compareVarFeaturesAndRanks <- function(
if (is.null(param_list[[element]])) {
warning(sprintf("`%s` is not defined", element), immediate. = TRUE, call. = FALSE)
} else {
message(sprintf("`%s` is: %s", element, param_list[[element]]))
message(sprintf("`%s` is: %s", element, param_list[[element]]) )
}
}, USE.NAMES = FALSE)

Expand Down

0 comments on commit c1f3494

Please sign in to comment.