Skip to content

Commit

Permalink
makes coercion only on individual samples
Browse files Browse the repository at this point in the history
  • Loading branch information
plger committed Jan 6, 2025
1 parent 7c99ee4 commit 283dfed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ propHomotypic <- function(clusters){
rank=max(dims))$x[,seq_len(max(dims))]
}

.checkSCE <- function(sce){
.checkSCE <- function(sce, coerce=TRUE){
msg <- paste(
"`sce` should be a SingleCellExperiment, a SummarizedExperiment, ",
"or an array (i.e. matrix, sparse matric, etc.) of counts.")
Expand All @@ -446,7 +446,7 @@ propHomotypic <- function(clusters){
}
if( !("counts" %in% assayNames(sce)) )
stop("`sce` should have an assay named 'counts'")
if(!is(counts(sce),"DelayedMatrix"))
if(coerce || !is(counts(sce),"DelayedMatrix"))
counts(sce) <- as(counts(sce),"CsparseMatrix")
if(any(counts(sce)<0))
stop(msg, "\n", "The data contains negative counts!")
Expand Down
2 changes: 1 addition & 1 deletion R/scDblFinder.R
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ scDblFinder <- function(
" works if `sce` is a SingleCellExperiment.\n",
"Please pass the vector of labels.")
}
sce <- .checkSCE(sce)
sce <- .checkSCE(sce, coerce=is.null(samples))
score <- match.arg(score)
knownUse <- match.arg(knownUse)
if(!is.null(clustCor)){
Expand Down

0 comments on commit 283dfed

Please sign in to comment.