diff --git a/R/shrinkBins.R b/R/shrinkBins.R index 136f4a67..8bf41c22 100644 --- a/R/shrinkBins.R +++ b/R/shrinkBins.R @@ -61,11 +61,12 @@ shrinkBins <- function( } # get the prior means - prior.means <- prior.means %||% getGlobalMeans( - obj = original.x, - targets = targets, - assay = assay - ) + prior.means <- prior.means %||% + getGlobalMeans( + obj = original.x, + targets = targets, + assay = assay + ) is.atac_or_rna <- assay %in% c("atac", "rna") input.fun <- if (jse) { @@ -84,7 +85,7 @@ shrinkBins <- function( # bin the input bin.mat <- getBinMatrix( - mat = as.matrix(cbind(input.assay, prior.means)), + mat = cbind(input.assay, prior.means), genloc = rowRanges(x), chr = chr, res = res, diff --git a/R/transformTFIDF.R b/R/transformTFIDF.R index 394d0ba1..4f642da7 100644 --- a/R/transformTFIDF.R +++ b/R/transformTFIDF.R @@ -41,10 +41,7 @@ transformTFIDF <- function(mat, scale.factor = 1e5, binarize = FALSE) { tf <- t(t(mat.capped) / Matrix::colSums(mat.capped)) # compute term-frequency tf@x <- log1p(tf@x * scale.factor) # scale idf <- log(1 + ncol(mat.capped) / Matrix::rowSums(mat.capped)) # inverse-document frequency smooth - tfidf <- .tfidf(tf, idf) # transform - - # cast back to a matrix since things like UMAP don't like sparse matrices - as.matrix(tfidf) + .tfidf(tf, idf) # transform } .binarize <- function(v) {