I am going to adjust Seurat dimplot in a way avoiding some cells so both my dimplot and heatmap look nice

If you please consider this picture, you would see some cells are far from the clusters so I want to avoid them in dimplot and of course for heatmap (coming from finding markers).

[![enter image description here][1]][1]

Can you suggest me a piece of code doing that? Thanks


1 Answer 1


If you're using a GUI you could select the cells interactively:

plot <- DimPlot(seurat_obj, reduction = "umap")

Then select the cells by clicking around them

select.cells <- CellSelector(plot = plot)
Idents(seurat_obj, cells = select.cells) <- "SubCells"

and subset based on these cells

sub_cells <- WhichCells(seurat_obj, idents = "SubCells")
sub_obj <- subset(seurat_obj, cells = sub_cells)

You could then use subobject in your downstream dimplot.

See here for some of the interactive options. I guess you could outright subset on UMAP coordinates, but that may not always be easy if your boundary isn't linear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.