Doheatmap in seurat
2
0
Entering edit mode
6 months ago
odi ▴ 10

enter image description here

Hi guys (sorry I cannot show the full heatmap as it is about to be in a paper),

I am trying to reorder this heatmap's identity where instead of BGH>CFAP>NM>WT we have WT>CFAP>NM>BGH.

How do I do that in doheatmap? Here is the code that gave me this order:

c1 <- subset(trac_all_cc, idents = "1")
c1 <- ScaleData(c1, features = NULL, assay = "SCT")

c1_df <- as.data.frame(c1@assays$SCT@scale.data) |> tibble::rownames_to_column() |> filter(rowname %in% top50$gene)
c1_df <- c1_df |> tibble::column_to_rownames() #genes back to rownames
d <- dist(c1_df, method = "euclidean")
hc <- hclust(d, method = "ward.D2")
gene_order <- hc$order
gene_ordernames <- rownames(c1_df)[gene_order]

p <- DoHeatmap(c1, features = gene_ordernames, group.by = "Sample_name")
seurat doheatmap • 798 views
ADD COMMENT
1
Entering edit mode
6 months ago

c1$Sample_name <- factor(c1$Sample_name, levels = c("WT", "CFAP", "NM", "BGH"))

ADD COMMENT
0
Entering edit mode

thank you very much!

ADD REPLY
0
Entering edit mode

A small educational note: if an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they all work. If an answer was not really helpful or did not work, provide detailed feedback so others know not to use that answer.
upvote_bookmark_accept

ADD REPLY
0
Entering edit mode
6 months ago
bk11 ★ 2.4k

You need to order the sample names as follows and DoHeatmap.

c1$Sample_name <- factor(c1$Sample_name, levels = c("WT","CFAP","NM","BGH."))

p <- DoHeatmap(c1, features = gene_ordernames, group.by = "Sample_name")
ADD COMMENT
0
Entering edit mode

Thank you very much

ADD REPLY

Login before adding your answer.

Traffic: 1671 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