satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.25k stars 904 forks source link

FeaturePlot: Conflict using split.by and cells in the same call. #3037

Closed aubreyghoward closed 4 years ago

aubreyghoward commented 4 years ago

I am attempting to split a Seurat object in a feature plot by a specific manually set identity, "FinalCat" as well as a specific subset of cells, defined by "cell2use". Cell2use is specified following a call of Whichcells. Every time I attempt to plot the object, I get the following error:

Error in seq.default(range[1], range[2], length.out = self$detail) : 'from' must be of length 1

split.by and cells works if I use "orig.ident", but not with "seurat_clusters". If i set combine=FALSE, the first plot will print, but then terminate with the same error. Sub-setting to limit the number of cells produces the same issue. Does anyone have a recommendation on how I can subset a specific set of cells and split.by to separate a specific group of cells by their ident?

Here is a sample of the relevant code I have used:

boilerplate to define the variables

nc1 <- readRDS(file = filepath) Idents(nc1)<-"FinalCat" nc1.subset <- subset(x = nc1, idents =c("ident1", "ident2", "ident3")) DP <- DimPlot(object = nc1.subset, reduction = "umap") cells2use <- CellSelector(plot = DP) genelist<- c("geneA","geneB","geneC") levels(nc1) # [1] "ident1" "ident2" [3] "ident3" "ident4" [5] "ident5" "ident5" [6] "ident6" "ident7"

levels(nc1.subset) # [1] "ident1" "ident2" [3] "ident3"

Featureplot(object = nc1, features = genelist, cells = cells2use, split.by = "FinalCat")

Featureplot(object = nc1.subset, features = genelist, cells = cells2use, split.by = "FinalCat")

Here is the traceback.

20: stop("'from' must be of length 1") 19: seq.default(range[1], range[2], length.out = self$detail) 18: seq(range[1], range[2], length.out = self$detail) 17: f(..., self = self) 16: self$mono_test(scale) 15: f(..., self = self) 14: scale$secondary.axis$break_info(continuous_range, scale) 13: view_scale_secondary(scale, limits, continuous_range) 12: view_scales_from_scale(scale_y, self$limits$y, self$expand) 11: f(..., self = self) 10: self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params) 9: (function (scale_x, scale_y) { self$coord$setup_panel_params(scale_x, scale_y, params = self$coord_params) })(dots[[1L]][[1L]], dots[[2L]][[1L]]) 8: mapply(FUN = f, ..., SIMPLIFY = FALSE) 7: Map(setup_panel_params, scales_x, scales_y) 6: f(..., self = self) 5: layout$setup_panel_params() 4: ggplot_build.ggplot(x) 3: ggplot_build(x) 2: print.ggplot(x) 1: (function (x, ...) UseMethod("print"))(x)

satijalab commented 4 years ago

we're looking into this - @jaisonj708

aubreyghoward commented 4 years ago

I wanted to follow up on this issue and see if any progress has been made. I have had none so far.

jaisonj708 commented 4 years ago

This should be fixed in the development version of Seurat. To install the development version of Seurat, please see the instructions here.