Closed intawat closed 1 year ago
Hi @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.
Ok normalization using log is good, thank you for the quick response. I will probably ask you more about your great package in the future.
//Intawat
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 https://github.com/saezlab/liana/issues/117#issuecomment-1600897208, 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 inmap()
: ℹ In index: 1. Caused by error inh()
: ! error in evaluating the argument 'x' in selecting a method for function 'rowMeans': size factors should be positive Traceback: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))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"]])) . })1
, op_resource =2
, verbose =3
, cell.adj =4
, . base =5
, test.type =6
, pval.type =7
, assay =8
, . assay.type =9
)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 theConsensus
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(...)[["lianapipe"]])) . }), 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, avglog2FC) . }), 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")))