do_NebulosaPlot | Feature plots based on density

This plot comes straight from the Nebulosa package. For more information, here is their vignette. In short, it computes a “density” of whether the surrounding cells (in the UMAP embedding) also express the variable that you provide to the function, same variables that one could feed to Seurat::FeaturePlot(). This is how their default plot looks like:

Basic usage

p <- SCpubr::do_NebulosaPlot(sample = sample, 
                             features = "CD14")

This way, not only we do know which clusters are enriched in CD14, we also know the regions of it with the highest density of cells expressing it.

This type visualization becomes a natural partner to `SCpubr::do_FeaturePlot()’ as not only we are able to visualize the expression of a variable, but also query the density of the surrounding cells. Here is an example:

p1 <- SCpubr::do_FeaturePlot(sample = sample, 
                             features = "CD14") 

p2 <- SCpubr::do_NebulosaPlot(sample = sample, 
                              features = "CD14")
p <- p1 | p2
p

Nebulosa package also offers the option to query multiple features at the same time:

p <- SCpubr::do_NebulosaPlot(sample, 
                             features = c("CD14", "CD8A"))
p

Compute joint densities

But, more intriguingly, it can also compute the joint density of the features. This is achieved by parsing joint = TRUE.

p <- SCpubr::do_NebulosaPlot(sample = sample, 
                             features = c("CD14", "CD8A"), 
                             joint = TRUE)
p 

If we were interested in retrieving only the joint density plot, we can accomplish it with return_only_joint parameter. Please note that, since this will return only one plot, if wanted to modify the plot title, use plot.title instead:

p <- SCpubr::do_NebulosaPlot(sample = sample, 
                             features = c("CD14", "CD8A"), 
                             joint = TRUE, 
                             return_only_joint = TRUE,
                             plot.title = "Joint density CD14+-CD8A+")

p