今天小编接着来介绍R绘制带有显著性的热图。
测试数据文件:
①table1.txt
②col_group.txt
③row_group.txt
1.导入pheatmap包,读取数据;
#导入包
library(pheatmap)
#读取数据
data<-read.table("table1.txt",header=T,row.names = 1,sep="\t")
2.直接作图;
#直接作图
pheatmap(data)
3.对相关参数指标进行调整;
# scale = "row"参数对行进行归一化
pheatmap(data, scale = "row")
# clustering_method参数设定不同聚类方法,默认为"complete",可以设定为'ward', 'ward.D', 'ward.D2', 'single', 'complete', 'average', 'mcquitty', 'median' or 'centroid'
pheatmap(data,scale = "row", clustering_method = "average")
# clustering_distance_rows = "correlation"参数设定行聚类距离方法为Pearson corralation,默认为欧氏距离"euclidean"
pheatmap(data, scale = "row", clustering_distance_rows = "correlation")
# cluster_row = FALSE参数设定不对行进行聚类
pheatmap(data, cluster_row = FALSE)
# legend = FALSE参数去掉图例
pheatmap(data, l