@@ -62,7 +62,7 @@ setMethod("plot_density", signature("Seurat"),
6262 .validate_dimensions(dims )
6363 # Validate existence of reduction
6464 if (! is.null(reduction )) {
65- if (! ( reduction %in% names(slot( object , " reductions " )) )) {
65+ if (! reduction %in% Reductions( object )) {
6666 stop(" No reduction named '" , reduction ,
6767 " ' found in object" )
6868 }
@@ -76,9 +76,7 @@ setMethod("plot_density", signature("Seurat"),
7676 if (is.null(reduction )) {
7777 reduction <- reduction_list [length(reduction_list )]
7878 }
79- cell_embeddings <- as.data.frame(Embeddings(
80- slot(object , " reductions" )[[reduction ]])
81- )
79+ cell_embeddings <- as.data.frame(Embeddings(object [[reduction ]]))
8280
8381 # Search for dimensions -----
8482 cell_embeddings <- .search_dimensions(dims , cell_embeddings ,
@@ -90,7 +88,7 @@ setMethod("plot_density", signature("Seurat"),
9088 method <- match.arg(method )
9189
9290 # Extract metadata
93- metadata <- slot( object , " meta.data " )
91+ metadata <- object [[]]
9492
9593 # Determine type of feature and extract
9694 if (all(features %in% colnames(metadata ))) {
@@ -142,7 +140,7 @@ setMethod("plot_density", signature("SingleCellExperiment"),
142140 cell_embeddings <- .search_dimensions(dims , cell_embeddings ,
143141 reduction )
144142 colnames(cell_embeddings ) <- paste(reduction , dims , sep = " _" )
145-
143+
146144 # Set up default assay -----
147145 if (is.null(slot )) slot <- " logcounts"
148146
0 commit comments