Search
Question: sc3_plot_expression, colour labels
1
gravatar for cfustero
18 months ago by
cfustero20
Madrid (Spain)
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

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

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 COMMENTlink modified 18 months ago • written 18 months ago by Vladimir Kiselev130
1

Thanks a lot for your quick response, Vladimir!

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

Help
Access

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