GreenleafLab / ArchR

ArchR : Analysis of Regulatory Chromatin in R (www.ArchRProject.com)
MIT License
377 stars 133 forks source link

highlighting cells with plotEmbedding() #115

Closed liviuspenter closed 4 years ago

liviuspenter commented 4 years ago

I really like ArchR. There is one feature that I am missing: highlighting cells when plotting embeddings. So far the work around is to create a new variable that splits the cells into two groups and then to use two different colors to plot that variable with name = '...'.

The Seurat package has this option for DimPlot() which can be used with cells.highlight = '...'.

Could you add an option to plotEmbedding() that allows to specify which cells will be highlighted?

Thank you!

livius

rcorces commented 4 years ago

Thanks for the feature request. This is reasonable though not plug and play to implement given the way plotEmbedding() currently works. Our original intention was for users to do what you recommended (add a new column to cellColData that defines the desired comparison). We will keep this request open for now but it may be lower priority in the short term while we deal with bugs since there is a plausible work around.

Having a clear use case for this might elevate its priority though if it is something that users would do very frequently. Maybe you could describe the situation where you have specific cell names but those cell names dont correspond to a biologically relevant group that you would want stored in cellColData. In my typical use of ArchR, I am rarely working with cell names.

Is the desired functionality to work exactly as cells.highlight in Seurat?

liviuspenter commented 4 years ago

Thank you for your reply. I understand that this will be low priority given that it can be worked around. Yes, if it were possible to specify cells to be highlighted exactly as in Seurat, that would be awesome. If you do implement such a functionality, then maybe you could also allow an option for color and size of the highlighted cells at the same time.

Indeed I have two use cases for cells.highlight - generally this would be useful when integrating additional information:

jgranja24 commented 4 years ago

Hi @shaka87,

Can you add a screenshot/figure of what it is you are requesting. Im not familiar with Seurats DimPlot to this extent. You just want a two color split UMAP? Like grey and red sorta thing highlighting the cells you desire? Or is it you want the current overlay only colored for those cells (ie like gene scores)?

Best

Jeff

liviuspenter commented 4 years ago

Hey Jeff,

attached is a screen shot of a (trivial) example of using DimPlot to highlight 3 subpopulations. I would like to be able to highlight individual subpopulations with ArchR - not necessarily defined by clustering - in order to demonstrate additional aspects obtained through other assays. This could be a subclone defined by a mutation that spans multiple clusters and I would like to show its location on the umap.

Thank you,

livius

Screen Shot 2020-05-07 at 11 58 47 PM
jgranja24 commented 4 years ago

Got it. So basically all non highlighted cells will be grey. If this is correct i can add this feature.

liviuspenter commented 4 years ago

Yes! :)

jgranja24 commented 4 years ago

This is now functional in the new master update. See highlightCells in plotEmbedding. Closing this issue feel free to reopen if further issues.

liviuspenter commented 4 years ago

@jgranja24 cool, it works fine. I don't know if you intended this, but you can even play with the colors (for example background black and highlighted cells in blue):

plotEmbedding(pbmc, highlightCells = pbmc$cellNames[which(pbmc$manual.clusters == 'cluster.of.interest')], plotAs = 'points', pal = c('blue','black'))