Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Suggests:
AUCell,
BiocParallel,
BiocStyle,
DelayedMatrixStats,
dplyr,
fgsea,
GSEABase,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export(splitEnrichment)
import(ggplot2)
importFrom(MatrixGenerics,rowMeans2)
importFrom(MatrixGenerics,rowSds)
importFrom(MatrixGenerics,rowSums2)
importFrom(SummarizedExperiment,colData)
importFrom(ggdist,stat_pointinterval)
importFrom(grDevices,hcl.pals)
Expand Down
9 changes: 8 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
# -----------------------------------------------------------------------------
# EXPRESSION MATRIX EXTRACTOR -------------------------------------------------
# -----------------------------------------------------------------------------
#' @importFrom MatrixGenerics rowSums2
.cntEval <- function(obj, assay = "RNA", type = "counts") {
if (.is_seurat(obj)) {
# Use generic accessor if available
Expand Down Expand Up @@ -177,10 +178,16 @@
} else {
cnts <- obj
}
# Conditionally require DelayedMatrixStats if cnts is dgCMatrix
if (inherits(cnts, "dgCMatrix")) {
if (!requireNamespace("DelayedMatrixStats", quietly = TRUE)) {
stop("Package 'DelayedMatrixStats' is required to handle sparse matrices. Please install it with BiocManager::install('DelayedMatrixStats').")
}
loadNamespace("DelayedMatrixStats")
}
cnts[MatrixGenerics::rowSums2(cnts) != 0, , drop = FALSE]
}


# -----------------------------------------------------------------------------
# ATTACH / PULL ENRICHMENT MATRICES ------------------------------------------
# -----------------------------------------------------------------------------
Expand Down
Loading