Skip to content

Commit e53774b

Browse files
committed
fix(CellDimPlot/FeatureStatPlot): fix when reduction is only on a subset of cells
1 parent 323a24c commit e53774b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

R/celldimplot.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ CellDimPlot.Seurat <- function(
265265
graph <- object@graphs[[graph]]
266266
}
267267

268-
data <- cbind(Embeddings(object, reduction = reduction), object@meta.data)
268+
emb <- Embeddings(object, reduction = reduction)
269+
data <- cbind(emb, object@meta.data[rownames(emb), , drop = FALSE])
269270
if (is.null(group_by)) {
270271
group_by <- "Identity"
271272
data[[group_by]] <- Idents(object)

R/featurestatplot.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,12 @@ FeatureStatPlot.Seurat <- function(
544544
if (is.null(reduction)) {
545545
data <- cbind(object@meta.data, assay_data)
546546
} else {
547-
data <- cbind(Embeddings(object, reduction = reduction), object@meta.data, assay_data)
547+
emb <- Embeddings(object, reduction = reduction)
548+
data <- cbind(
549+
emb,
550+
object@meta.data[rownames(emb), , drop = FALSE],
551+
assay_data[rownames(emb), , drop = FALSE]
552+
)
548553
}
549554

550555
if (is.null(ident)) {

0 commit comments

Comments
 (0)