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
13 changes: 7 additions & 6 deletions R/shrinkBins.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions R/transformTFIDF.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down