You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run the wrapper using mouse ortholog table follow the vignette but got error below (command in bold)
sce <- liana_prep(dat.integrated)
Expression from the RNA assay will be used
Running LIANA with cl_names as labels!
Warning message in exec(output, ...):
“19384 genes and/or 0 cells were removed as they had no counts!”
liana_res <- liana_wrap(sce,
resource = 'custom', # resource has to be set to 'custom' to work with external resources
external_resource = ortholog_resource, # provide orthologous resource
method=c('sca', 'natmi') # run only with sca and natmi for comp. time
)
Running LIANA with label as labels!
Error in map():
ℹ In index: 1.
ℹ With name: custom_resource.
Caused by error in map():
ℹ In index: 1.
Caused by error in h():
! error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive
Traceback:
I assume you have are encountering some kind of an issue with the counts that you are using - you should use log-normalized. Specifically, I see that liana has filtered 19384 genes which means that something is wrong, and likely you simply have none left. Check if you are not using the residuals or any type of negative values from your integration approach.
On Wed, Jun 21, 2023 at 9:02 AM Daniel Dimitrov ***@***.***> wrote:
Hi @intawat <https://github.com/intawat>,
I assume you have are encountering some kind of an issue with the counts
that you are using - you should use log-normalized. Specifically, I see
that liana has filtered 19384 genes which means that something is wrong,
and likely you simply have none left. Check if you are not using the
residuals or any type of negative values from your integration approach.
—
Reply to this email directly, view it on GitHub
<#117 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4VBHWNADHDIHNLUEWF5PLXML5I7ANCNFSM6AAAAAAZN55K7Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
I run the wrapper using mouse ortholog table follow the vignette but got error below (command in bold)
sce <- liana_prep(dat.integrated)
Expression from the
RNA
assay will be usedRunning LIANA with
cl_names
as labels!Warning message in exec(output, ...):
“19384 genes and/or 0 cells were removed as they had no counts!”
liana_res <- liana_wrap(sce,
resource = 'custom', # resource has to be set to 'custom' to work with external resources
external_resource = ortholog_resource, # provide orthologous resource
method=c('sca', 'natmi') # run only with sca and natmi for comp. time
)
Running LIANA with
label
as labels!Error in
map()
:ℹ In index: 1.
ℹ With name: custom_resource.
Caused by error in
map()
:ℹ In index: 1.
Caused by error in
h()
:! error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive
Traceback:
. method = c("sca", "natmi"))
. if (is.null(reso)) {
. liana_message("Resource was NULL and LIANA's internal methods were run with the
Consensus
resource",. verbose = verbose, output = "warning")
. reso <- select_resource("Consensus")[[1]]
. }
. rlang::invoke(liana_pipe, append(list(sce = sce, op_resource = decomplexify(reso),
. verbose = verbose, cell.adj = cell.adj, base = base),
. liana_defaults(...)[["liana_pipe"]]))
. }) %>% setNames(names(resource))
. if (is.null(reso)) {
. liana_message("Resource was NULL and LIANA's internal methods were run with the
Consensus
resource",. verbose = verbose, output = "warning")
. reso <- select_resource("Consensus")[[1]]
. }
. rlang::invoke(liana_pipe, append(list(sce = sce, op_resource = decomplexify(reso),
. verbose = verbose, cell.adj = cell.adj, base = base),
. liana_defaults(...)[["liana_pipe"]]))
. })
. call_with_cleanup(map_impl, environment(), .type, .progress,
. n, names, i))
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=
. "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name, parent = cnd,
. call = error_call, class = "purrr_error_indexed")
. }
. })
. n, names, i)
. verbose = verbose, cell.adj = cell.adj, base = base), liana_defaults(...)[["liana_pipe"]]))
1
, op_resource =2
, verbose =3
, cell.adj =4
,. base =
5
, test.type =6
, pval.type =7
, assay =8
,. assay.type =
9
). subject_avg <- scater::calculateAverage(subset(sce, select = colLabels(sce) ==
. subject), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(subject_avg = value)
. loso_avg <- scater::calculateAverage(subset(sce, select = !(colLabels(sce) %in%
. subject)), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(loso_avg = value)
. left_join(subject_avg, loso_avg, by = "gene") %>% mutate(avg_log2FC = log2((subject_avg +
. 1)) - log2((loso_avg + 1))) %>% select(gene, avg_log2FC)
. }) %>% setNames(levels(colLabels(sce))) %>% enframe(name = "cell") %>%
. unnest(value)
. subject_avg <- scater::calculateAverage(subset(sce, select = colLabels(sce) ==
. subject), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(subject_avg = value)
. loso_avg <- scater::calculateAverage(subset(sce, select = !(colLabels(sce) %in%
. subject)), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(loso_avg = value)
. left_join(subject_avg, loso_avg, by = "gene") %>% mutate(avg_log2FC = log2((subject_avg +
. 1)) - log2((loso_avg + 1))) %>% select(gene, avg_log2FC)
. })
. call_with_cleanup(map_impl, environment(), .type, .progress,
. n, names, i))
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=
. "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name, parent = cnd,
. call = error_call, class = "purrr_error_indexed")
. }
. })
. n, names, i)
. subject), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(subject_avg = value)
. subject), assay.type = "normcounts")
. subject), assay.type = "normcounts")
. log = FALSE))
. .Internal(C_tryCatchHelper(addr, 1L, cond)), "size factors should be positive",
. base::quote(.local(x, ...)))
. {
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=
. "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name, parent = cnd,
. call = error_call, class = "purrr_error_indexed")
. }
. }, "error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive",
. base::quote(h(simpleError(msg, call))))
. call = error_call, class = "purrr_error_indexed")
. .frame = .frame)
. {
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) && names[[i]] !=
. "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name, parent = cnd,
. call = error_call, class = "purrr_error_indexed")
. }
. })(structure(list(message = c(i = "In index: 1."), trace = structure(list(
. call = list(IRkernel::main(), kernel$run(), handle_shell(),
. executor$execute(msg), tryCatch(evaluate(request$content$code,
. envir = .GlobalEnv, output_handler = oh, stop_on_error = 1L),
. interrupt = function(cond) {
. log_debug("Interrupt during execution")
. interrupted <<- TRUE
. }, error = .self$handle_error), tryCatchList(expr,
. classes, parentenv, handlers), tryCatchOne(tryCatchList(expr,
. names[-nh], parentenv, handlers[-nh]), names[nh],
. parentenv, handlers[[nh]]), doTryCatch(return(expr),
. name, parentenv, handler), tryCatchList(expr, names[-nh],
. parentenv, handlers[-nh]), tryCatchOne(expr, names,
. parentenv, handlers[[1L]]), doTryCatch(return(expr),
. name, parentenv, handler), evaluate(request$content$code,
. envir = .GlobalEnv, output_handler = oh, stop_on_error = 1L),
. evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,
. debug = debug, last = i == length(out), use_try = stop_on_error !=
. 2L, keep_warning = keep_warning, keep_message = keep_message,
. log_echo = log_echo, log_warning = log_warning, output_handler = output_handler,
. include_timing = include_timing), timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,
. envir, enclos, user_handlers)), warning = wHandler,
. error = eHandler, message = mHandler))), handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,
. envir, enclos, user_handlers)), warning = wHandler,
. error = eHandler, message = mHandler)), try(f, silent = TRUE),
. tryCatch(expr, error = function(e) {
. call <- conditionCall(e)
. if (!is.null(call)) {
. if (identical(call[[1L]], quote(doTryCatch)))
. call <- sys.call(-4L)
. dcall <- deparse(call, nlines = 1L)
. prefix <- paste("Error in", dcall, ": ")
. LONG <- 75L
. sm <- strsplit(conditionMessage(e), "\n")[[1L]]
. w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L],
. type = "w")
. if (is.na(w))
. w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],
. type = "b")
. if (w > LONG)
. prefix <- paste0(prefix, "\n ")
. }
. else prefix <- "Error : "
. msg <- paste0(prefix, conditionMessage(e), "\n")
. .Internal(seterrmessage(msg[1L]))
. if (!silent && isTRUE(getOption("show.error.messages"))) {
. cat(msg, file = outFile)
. .Internal(printDeferredWarnings())
. }
. invisible(structure(msg, class = "try-error", condition = e))
. }), tryCatchList(expr, classes, parentenv, handlers),
. tryCatchOne(expr, names, parentenv, handlers[[1L]]),
. doTryCatch(return(expr), name, parentenv, handler), withCallingHandlers(withVisible(eval_with_user_handlers(expr,
. envir, enclos, user_handlers)), warning = wHandler,
. error = eHandler, message = mHandler), withVisible(eval_with_user_handlers(expr,
. envir, enclos, user_handlers)), eval_with_user_handlers(expr,
. envir, enclos, user_handlers), eval(expr, envir,
. enclos), eval(expr, envir, enclos), liana_wrap(sce,
. resource = "custom", external_resource = ortholog_resource,
. method = c("sca", "natmi")), resource %>% map(function(reso) {
. if (is.null(reso)) {
. liana_message("Resource was NULL and LIANA's internal methods were run with the
Consensus
resource",. verbose = verbose, output = "warning")
. reso <- select_resource("Consensus")[[1]]
. }
. rlang::invoke(liana_pipe, append(list(sce = sce,
. op_resource = decomplexify(reso), verbose = verbose,
. cell.adj = cell.adj, base = base), liana_defaults(...)[["liana_pipe"]]))
. }) %>% setNames(names(resource)), setNames(., names(resource)),
. map(., function(reso) {
. if (is.null(reso)) {
. liana_message("Resource was NULL and LIANA's internal methods were run with the
Consensus
resource",. verbose = verbose, output = "warning")
. reso <- select_resource("Consensus")[[1]]
. }
. rlang::invoke(liana_pipe, append(list(sce = sce,
. op_resource = decomplexify(reso), verbose = verbose,
. cell.adj = cell.adj, base = base), liana_defaults(...)[["liana_pipe"]]))
. }), map_("list", .x, .f, ..., .progress = .progress),
. with_indexed_errors(i = i, names = names, error_call = .purrr_error_call,
. call_with_cleanup(map_impl, environment(), .type,
. .progress, n, names, i)), withCallingHandlers(expr,
. error = function(cnd) {
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) &&
. names[[i]] != "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name,
. parent = cnd, call = error_call, class = "purrr_error_indexed")
. }
. }), call_with_cleanup(map_impl, environment(), .type,
. .progress, n, names, i), .f(.x[[i]], ...), rlang::invoke(liana_pipe,
. append(list(sce = sce, op_resource = decomplexify(reso),
. verbose = verbose, cell.adj = cell.adj, base = base),
. liana_defaults(...)[["liana_pipe"]])), .fn(sce =
1
,. op_resource =
2
, verbose =3
, cell.adj =4
,. base =
5
, test.type =6
, pval.type =7
, assay =8
,. assay.type =
9
), get_log2FC(sce, assay.type = assay.type,. base), levels(colLabels(sce)) %>% map(function(subject) {
. subject_avg <- scater::calculateAverage(subset(sce,
. select = colLabels(sce) == subject), assay.type = "normcounts") %>%
. as_tibble(rownames = "gene") %>% dplyr::rename(subject_avg = value)
. loso_avg <- scater::calculateAverage(subset(sce,
. select = !(colLabels(sce) %in% subject)), assay.type = "normcounts") %>%
. as_tibble(rownames = "gene") %>% dplyr::rename(loso_avg = value)
. left_join(subject_avg, loso_avg, by = "gene") %>%
. mutate(avg_log2FC = log2((subject_avg + 1)) -
. log2((loso_avg + 1))) %>% select(gene, avg_log2FC)
. }) %>% setNames(levels(colLabels(sce))) %>% enframe(name = "cell") %>%
. unnest(value), unnest(., value), enframe(., name = "cell"),
. setNames(., levels(colLabels(sce))), map(., function(subject) {
. subject_avg <- scater::calculateAverage(subset(sce,
. select = colLabels(sce) == subject), assay.type = "normcounts") %>%
. as_tibble(rownames = "gene") %>% dplyr::rename(subject_avg = value)
. loso_avg <- scater::calculateAverage(subset(sce,
. select = !(colLabels(sce) %in% subject)), assay.type = "normcounts") %>%
. as_tibble(rownames = "gene") %>% dplyr::rename(loso_avg = value)
. left_join(subject_avg, loso_avg, by = "gene") %>%
. mutate(avg_log2FC = log2((subject_avg + 1)) -
. log2((loso_avg + 1))) %>% select(gene, avg_log2FC)
. }), map_("list", .x, .f, ..., .progress = .progress),
. with_indexed_errors(i = i, names = names, error_call = .purrr_error_call,
. call_with_cleanup(map_impl, environment(), .type,
. .progress, n, names, i)), withCallingHandlers(expr,
. error = function(cnd) {
. if (i == 0L) {
. }
. else {
. message <- c(i = "In index: {i}.")
. if (!is.null(names) && !is.na(names[[i]]) &&
. names[[i]] != "") {
. name <- names[[i]]
. message <- c(message, i = "With name: {name}.")
. }
. else {
. name <- NULL
. }
. cli::cli_abort(message, location = i, name = name,
. parent = cnd, call = error_call, class = "purrr_error_indexed")
. }
. }), call_with_cleanup(map_impl, environment(), .type,
. .progress, n, names, i), .f(.x[[i]], ...), scater::calculateAverage(subset(sce,
. select = colLabels(sce) == subject), assay.type = "normcounts") %>%
. as_tibble(rownames = "gene") %>% dplyr::rename(subject_avg = value),
. dplyr::rename(., subject_avg = value), as_tibble(., rownames = "gene"),
. scater::calculateAverage(subset(sce, select = colLabels(sce) ==
. subject), assay.type = "normcounts"), scater::calculateAverage(subset(sce,
. select = colLabels(sce) == subject), assay.type = "normcounts"),
. .local(x, ...), callNextMethod(x, size.factors = size.factors,
. ...), eval(call, callEnv), eval(call, callEnv), .nextMethod(x,
. size.factors = size.factors, ...), .local(x, ...),
. .calculate_average(assay(x, assay.type), ...), rowMeans(normalizeCounts(x,
. size.factors, subset.row = subset.row, log = FALSE)),
. normalizeCounts(x, size.factors, subset.row = subset.row,
. log = FALSE), normalizeCounts(x, size.factors, subset.row = subset.row,
. log = FALSE), .local(x, ...), stop("size factors should be positive"),
. .handleSimpleError(
<fn>
, "size factors should be positive",. base::quote(.local(x, ...))), h(simpleError(msg,
. call)), .handleSimpleError(
<fn>
, "error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive",. base::quote(h(simpleError(msg, call)))), h(simpleError(msg,
. call)), cli::cli_abort(message, location = i, name = name,
. parent = cnd, call = error_call, class = "purrr_error_indexed"),
. rlang::abort(message, ..., call = call, use_cli_format = TRUE,
. .frame = .frame)), parent = c(0L, 1L, 2L, 3L, 4L,
. 5L, 6L, 7L, 6L, 9L, 10L, 4L, 12L, 13L, 13L, 15L, 16L, 17L,
. 18L, 19L, 13L, 13L, 13L, 23L, 24L, 0L, 26L, 0L, 0L, 29L,
. 30L, 31L, 30L, 30L, 34L, 0L, 36L, 37L, 0L, 0L, 0L, 0L, 42L,
. 43L, 44L, 43L, 43L, 47L, 0L, 0L, 47L, 47L, 52L, 53L, 54L,
. 55L, 53L, 57L, 58L, 59L, 59L, 59L, 62L, 63L, 0L, 65L, 0L,
. 67L, 68L, 69L), visible = c(TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
. TRUE, FALSE, FALSE, FALSE, FALSE), namespace = c("IRkernel",
. NA, "IRkernel", NA, "base", "base", "base", "base", "base",
. "base", "base", "evaluate", "evaluate", "evaluate", "evaluate",
. "base", "base", "base", "base", "base", "base", "base", "evaluate",
. "base", "base", "liana", NA, "stats", "purrr", "purrr", "purrr",
. "base", "purrr", "liana", "rlang", "liana", "liana", NA,
. "tidyr", "tibble", "stats", "purrr", "purrr", "purrr", "base",
. "purrr", "liana", NA, "dplyr", "tibble", "scater", "scater",
. "scuttle", "methods", "base", "base", "scuttle", "scuttle",
. "scuttle", "methods", "scuttle", "scuttle", "scuttle", "base",
. "base", "base", "base", "purrr", "cli", "rlang"), scope = c("::",
. NA, "local", NA, "::", "local", "local", "local", "local",
. "local", "local", "::", ":::", "local", "local", "::", "::",
. "local", "local", "local", "::", "::", ":::", "::", "::",
. "::", NA, "::", "::", ":::", ":::", "::", ":::", "local",
. "::", "local", ":::", NA, "::", "::", "::", "::", ":::",
. ":::", "::", ":::", "local", NA, "::", "::", "::", "::",
. "local", "::", "::", "::", "local", "local", ":::", "local",
. "::", "::", "local", "::", "::", "local", "::", "local",
. "::", "::"), error_frame = c(FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
. FALSE, FALSE, FALSE)), row.names = c(NA, -70L), version = 2L, class = c("rlang_trace",
. "rlib_trace", "tbl", "data.frame")), parent = structure(list(
. message = "error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive",
. call = h(simpleError(msg, call))), class = c("simpleError",
. "error", "condition")), location = 1L, name = NULL, rlang = list(
. inherit = TRUE), call = map(., function(subject) {
. subject_avg <- scater::calculateAverage(subset(sce, select = colLabels(sce) ==
. subject), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(subject_avg = value)
. loso_avg <- scater::calculateAverage(subset(sce, select = !(colLabels(sce) %in%
. subject)), assay.type = "normcounts") %>% as_tibble(rownames = "gene") %>%
. dplyr::rename(loso_avg = value)
. left_join(subject_avg, loso_avg, by = "gene") %>% mutate(avg_log2FC = log2((subject_avg +
. 1)) - log2((loso_avg + 1))) %>% select(gene, avg_log2FC)
. }), use_cli_format = TRUE), class = c("purrr_error_indexed",
. "rlang_error", "error", "condition")))
. call = error_call, class = "purrr_error_indexed")
. .frame = .frame)
The text was updated successfully, but these errors were encountered: