sc3_plot_expression, colour labels
1
1
Entering edit mode
cfustero ▴ 20
@cfustero-13016
Last seen 7.5 years ago
Madrid (Spain)

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

sc3 single-cell • 1.6k views
ADD COMMENT
2
Entering edit mode
@vladimir-kiselev-9342
Last seen 5.7 years ago
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
ADD COMMENT
1
Entering edit mode

Thanks a lot for your quick response, Vladimir!

ADD REPLY

Login before adding your answer.

Traffic: 945 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6