Question: sc3_plot_expression, colour labels
1
2.3 years ago by
cfustero20
cfustero20 wrote:

Hi,

I have been using the "SC3" R package to analyse single cell expression data. We expect to find four different groups of cells within our data, so I've included a column corresponding to our cell labels.
When using the sc3_plot_expression, our cell labels are coloured automatically, but the colours are really similar between each other and it's hard to discern between groups. Is there any parameter I can use to manually adjust the label colours?

Thanks a lot!
Coral

single-cell sc3 • 523 views
modified 2.3 years ago by Vladimir Kiselev150 • written 2.3 years ago by cfustero20
2
2.3 years ago by
Sanger Institute, Cambridge, UK

Hi,

Unfortunately, it is not possible through sc3_plot_expression itself. However, since all heatmaps in SC3 are based on the pheatmap package, you can use the source code of sc3_plot_expression and add some manual colour annotations to it via pheatmap arguments.

So if object is your scater object and k is the number of clusters (4 in your case) then you can plot the expression matrix (without coloured cell labels) using this code:

library(scater)
library(SC3)
library(pheatmap)

hc <- object@sc3$consensus[[as.character(k)]]$hc
dataset <- get_exprs(object, "exprs")

pheatmap(
dataset,
cluster_cols = hc,
kmeans_k = 100,
cutree_cols = k,
show_rownames = FALSE,
show_colnames = FALSE
)

Then you will need to add both annotation_col and annotation_colors arguments to the last pheatmap call. For mored details and examples on how to do it please refer to the pheatmap documentation using:

?pheatmap
1