Skip to content

Commit

Permalink
Check if presto is installled
Browse files Browse the repository at this point in the history
  • Loading branch information
sqjin committed Apr 14, 2024
1 parent 534b91d commit 01948e3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ subsetData <- function(object, features = NULL) {
#' @importFrom pbapply pbsapply
#' @importFrom future.apply future_sapply
#' @importFrom stats sd wilcox.test p.adjust
#' @importFrom presto wilcoxauc
#'
#' @return A CellChat object or a data frame. If returning a CellChat object, two new elements named 'features.name' and paste0(features.name, ".info") will be added into the list `[email protected]`
#' `[email protected][[features.name]]` is a vector consisting of the identified over-expressed signaling genes;
Expand Down Expand Up @@ -428,6 +427,16 @@ identifyOverExpressedGenes <- function(object, data.use = NULL, group.by = NULL,
}

if (do.fast) {
presto.check <- rlang::is_installed(c("presto"))
if (!presto.check) {
stop(
"For a faster implementation of the Wilcoxon Test, please install the presto package",
"\n--------------------------------------------",
"\n devtools::install_github('immunogenomics/presto')",
"\n--------------------------------------------",
"\n Otherwise, plase set `do.fast = FALSE` for running the standard Wilcoxon Test!\n"
)
}
if (is.null(group.dataset)) {
genes.de <- presto::wilcoxauc(data.use, labels, groups_use = level.use)
colnames(genes.de) <- plyr::mapvalues(colnames(genes.de),from = c("group","feature","pval","logFC","pct_in","pct_out","padj"), to = c("clusters","features","pvalues","logFC","pct.1", "pct.2","pvalues.adj"), warn_missing = TRUE)
Expand Down

0 comments on commit 01948e3

Please sign in to comment.