Question: sc3_plot_expression, colour labels
gravatar for cfustero
8 months ago by
Madrid (Spain)
cfustero20 wrote:


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!

ADD COMMENTlink modified 8 months ago by Vladimir Kiselev130 • written 8 months ago by cfustero20
gravatar for Vladimir Kiselev
8 months ago by
Sanger Institute, Cambridge, UK
Vladimir Kiselev130 wrote:


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:


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

    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:

ADD COMMENTlink modified 8 months ago • written 8 months ago by Vladimir Kiselev130

Thanks a lot for your quick response, Vladimir!

ADD REPLYlink modified 8 months ago • written 8 months ago by cfustero20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 234 users visited in the last hour