pheatmap
2
0
Entering edit mode
14 months ago
Sara ▴ 30

Hi All,

I made a heat map to show the top 25 significant differentially expressed genes. I would like to make some changes in my heatmap but I couldn't find how to do it, may you please provide me with some solutions please?

Here is the code that I used:

select<- resOrdered$ENSEMBL[1:25] #selected the 25 most significant genes
toplot<- assay(vsd)[select,]  #retreived the vst values for selected genes
rownames(toplot) <- resOrdered$SYMBOL[1:25] #defined the gene symbol
df <- as.data.frame(colData(vsd)["condition"])
ann_colors<- list(condition=c(OE="red", WT="blue"))

pheatmap(toplot,annotation_col = df, annotation_colors = ann_colors,
         scale = "row", border_color = "transparent",
         cutree_cols = 2, cutree_rows = 2,fontsize = 7,
         color = colorRampPalette(c("blue","white","red"))(50))

here is my heatmap

enter image description here

in a row is the name of the genes that I covered, and the column is the name of the sample group by WT and OE.

I want to show WT condition on the left of my plot and, next to it OE condition. exactly the invert one of that already is. but I couldn't figure out how.

I appreciate any solutions please.

pheatmap heatmap differential-expression RNA-seq • 1.0k views
ADD COMMENT
1
Entering edit mode
14 months ago
bk11 ★ 3.0k

Can you please try this? I have not tested it but it should work.

install.packages("seriation")
install.packages("dendextend")

library(seriation)
library(dendextend)    

phtmap <- pheatmap(toplot,annotation_col = df, annotation_colors = ann_colors,
             scale = "row", border_color = "transparent",
             cutree_cols = 2, cutree_rows = 2,fontsize = 7,
             color = colorRampPalette(c("blue","white","red"))(50))
col_dend =phtmap[[2]]
col_dend <- rotate(col_dend, order = rev(colnames(toplot)[get_order(col_dend)]))

pheatmap(toplot,annotation_col = df, annotation_colors = ann_colors,
             scale = "row", border_color = "transparent",
             cutree_cols = 2, cutree_rows = 2,fontsize = 7, cluster_cols = as.hclust(col_dend),
             color = colorRampPalette(c("blue","white","red"))(50))
ADD COMMENT
0
Entering edit mode
14 months ago

Hi, you could maybe try releveling the factor when you define them in your coldata, because otherwise it's alphabetic:

colData$condition <- factor(colData$condition, levels = c("WT", "OE"))

And then run the heatmap as is.

ADD COMMENT
0
Entering edit mode

Thank you for your comment, but it did not help!

ADD REPLY

Login before adding your answer.

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