基因组数据绘图R语言R语言

热图-木秀于林,风必摧之

2019-04-05  本文已影响316人  Juan_NF
R包依据input产生output,热图亦如是。我们要清楚地了解自己的目的,才能有望基于pheatmap生成自己想要的结果。很大或很小的数值都会影响热图的效果,鹤立鸡群、木秀于林,会影响对其他大多数数据的展示,对比就不那么明显了;毕竟,我们要的不是一枝独秀,而是万紫千红。
数据放在这里:

以下是我要画的热图
image.png
但实际,相同数据,我画出来,它长这样
TF_matrix=t(scale(t(TF_matrix)))
annotation_col = data.frame(CellType = factor(rep(c("NSCLC", "SCLC"), c(68,37))))
######nrDEG这里没展示,大家可用其他函数生成105个不同的名称,否则会annotation_col这里会报错;
rownames(annotation_col)<-colnames(nrDEG)
pheatmap(TF_matrix,annotation_col=annotation_col,labels_col = '',cluster_cols = FALSE)
之前我觉得,图画出来就好了
但其实
合理性、对比鲜明、美观这些因素,如果只是捎带手的事儿,为什么不做好呢?
略微改良以后,出图如下:
TF_matrix=t(scale(t(TF_matrix)))
TF_matrix[TF_matrix>2]=2
TF_matrix[TF_matrix< -2] = -2
annotation_col = data.frame(CellType = factor(rep(c("NSCLC", "SCLC"), c(68,37))))
rownames(annotation_col)<-colnames(nrDEG)
pheatmap(TF_matrix,annotation_col=annotation_col,labels_col = '',cluster_cols = FALSE, cellwidth = 3, cellheight = 15,filename = 'test.png')
bk = unique(c(seq(-2,2, length=100)))
pheatmap(TF_matrix,annotation_col=annotation_col,labels_col = '',breaks=bk,color = colorRampPalette(c("navy", "white", "firebrick3"))(100),cluster_cols = FALSE, cellwidth = 3, cellheight = 15,filename = 'test.png')
这里解释下以上用到的参数(R里的pheatmap这里的参数太多,一一解释也没有必要):
test.png
0这里很好
上一篇 下一篇

猜你喜欢

热点阅读