liana
liana copied to clipboard
Possible check in liana_prep
Hello,
Thanks for sharing this great package. I was trying to use liana to analyze my data, which was a SingleCellExperiment
object that I have been using for a while.
When I tried to use liana_wrap
directly, I found the following error:
Error in `map()`:
ℹ In index: 1.
ℹ With name: CellChatDB.
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 'calculateAverage': level sets of factors are different
Run `rlang::last_trace()` to see where the error occurred.
which wasn't really informative, using rlang::last_trace didn't revealed a lot either at first glance:
1. ├─liana::liana_wrap(...)
2. │ └─... %>% setNames(names(resource))
3. ├─stats::setNames(., names(resource))
4. ├─purrr::map(...)
5. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
6. │ ├─purrr:::with_indexed_errors(...)
7. │ │ └─base::withCallingHandlers(...)
8. │ ├─purrr:::call_with_cleanup(...)
9. │ └─liana (local) .f(.x[[i]], ...)
10. │ └─rlang::invoke(...)
11. ├─liana (local) .fn(...)
12. │ └─liana:::get_log2FC(sce, assay.type = assay.type, base)
13. │ └─... %>% unnest(value)
14. ├─tidyr::unnest(., value)
15. ├─tibble::enframe(., name = "cell")
16. ├─stats::setNames(., levels(colLabels(sce)))
17. ├─purrr::map(...)
18. │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
19. │ ├─purrr:::with_indexed_errors(...)
20. │ │ └─base::withCallingHandlers(...)
21. │ ├─purrr:::call_with_cleanup(...)
22. │ └─liana (local) .f(.x[[i]], ...)
23. │ ├─... %>% dplyr::rename(subject_avg = value)
24. │ ├─scater::calculateAverage(...)
25. │ ├─base::subset(sce, select = colLabels(sce) == subject)
26. │ └─S4Vectors::subset.Vector(sce, select = colLabels(sce) == subject)
27. │ ├─base::subset(x, ...)
28. │ └─SummarizedExperiment::subset(x, ...)
29. │ └─SummarizedExperiment (local) .local(x, ...)
30. │ └─S4Vectors:::evalqForSubset(select, colData(x), ...)
31. │ └─S4Vectors:::evalArg(substitute(expr), envir, ..., where = parent.frame())
32. │ └─S4Vectors:::safeEval(expr, envir, enclos, ...)
33. │ ├─BiocGenerics::eval(expr, envir, enclos)
34. │ └─S4Vectors::eval(expr, envir, enclos)
35. │ ├─BiocGenerics::eval(expr, as.env(envir, enclos))
36. │ └─base::eval(expr, as.env(envir, enclos))
37. │ └─base::eval(expr, as.env(envir, enclos))
38. │ └─base::Ops.factor(colLabels(sce), subject)
39. │ └─base::stop("level sets of factors are different")
40. ├─dplyr::rename(., subject_avg = value)
41. ├─tibble::as_tibble(., rownames = "gene")
42. └─base::.handleSimpleError(...)
43. └─base (local) h(simpleError(msg, call))
But it turned out that the reason that it was crashing was in the line S4Vectors::subset.Vector(sce, select = colLabels(sce) == subject)
because I had a subject
column in my colData
. After changing the name of the column it worked fine, so I thought to let you know about this error because it can be easily addressed in the liana_prep
function.
Thanks again, Rene
Thanks Rene @welch16
I will make sure to change this in the next update :)