heatmap繪制

  1. 整理出這樣的group和表達(dá)譜數(shù)據(jù),其中表達(dá)譜必須是矩陣



  2. 為熱圖上方的bar賦值

annotation_col = data.frame(Gender = group)
rownames(annotation_col) = colnames(expr_limma)
ann_colors = list(Type = c(F = "#FFA42D", M = "#A9D9DF"))

  1. 熱圖主程序

pdf("heatmap.pdf",width = 20,height = 60)
pheatmap(expr_limma,cellwidth = 8, cellheight = 1, fontsize = 8,
method="spearman", #計(jì)算gene或sample之間的相關(guān)性的方法,可選"pearson" (default), "kendall", or "spearman"
scale="row", #為基因做scale
cluster_rows=T,#為基因做聚類
cluster_cols=T,#為sample做聚類
color = colorRampPalette(c("navy", "white", "firebrick3"))(20),
show_colnames=F,show_rownames =F,
annotation_col = annotation_col,
annotation_colors = ann_colors,
#treeheight_row = "0",treeheight_col = "0",#不畫樹
border_color = "NA")
dev.off()

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容