Skip to content

Commit

Permalink
Fixing visualization for "after" plot
Browse files Browse the repository at this point in the history
  • Loading branch information
lobanovav authored Jul 7, 2023
1 parent 0b66085 commit d7bb90f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/Filter_Seurat_Object_by_Metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ filterSeuratObjectByMetadata <- function(object,


## User-selected metadata column is used to set idents.
Filter.orig = object@meta.data[category.to.filter[1]]
Filter.orig = object@meta.data[[category.to.filter[1]]]
colname <- category.to.filter[1]

ident.of.interest = as.factor(object@meta.data[[colname]])
Expand All @@ -264,12 +264,12 @@ filterSeuratObjectByMetadata <- function(object,

## Get colors from user parameter and add more if the default list is too short.
if (class(object@meta.data[[category.to.filter[1]]]) != "numeric") {
col.length = length(levels(as.factor(Filter.orig[[colname]])))
col.length = length(levels(as.factor(Filter.orig[colname])))
if (length(colors) < col.length) {
more.cols = .distinctColorPalette(col.length - length(colors), 10)
colors <- c(colors, more.cols)
}
names(colors) <- levels(as.factor(Filter.orig[[colname]]))
names(colors) <- levels(as.factor(Filter.orig[colname]))

## Keep or remove cells based on user input values.
if (keep.or.remove) {
Expand Down

0 comments on commit d7bb90f

Please sign in to comment.