如题目:在画热图时出现如下错误:
Error in names(annotation_colors[[names(annotation)[i]]]) <- l :
'names' attribute [2] must be the same length as the vector [1]
代码:
> library(pheatmap)
> setwd("C:\\Users")
> DEM<-read.table("data.txt",sep='\t',header=T, row.names = 1, quote = "")
> designNC = c( rep("N",6), rep("P",5))
> group_info <- data.frame(row.names=names(DEM),groups=designNC)
> metaclass<-read.table("group.txt", sep='\t',header=T,quote = "")
> designClass= c(rep("Alcoholsandpolyols",5),rep("Benzeneandsubstitutedderivatives",5),rep("Benzenoids",1),
+ rep("FattyAcyls",26),rep("Flavonoids",7),rep("Glycerolipids",2),rep("Glycerophospholipids",44),rep("Harmalaalkaloids",2),
+ rep("Quinolinesandderivatives",2),rep("Sphingolipids",7),rep("Steroidsandsteroidderivatives",14))
> group_class<-data.frame(metclass=designClass)
> pheatmap(DEM,color=colorRampPalette(c("navy","white","firebrick3"))(100),fontsize_row=10
+ ,fontsize_col=10,scale="row",border_color=NA,cluster_rows = TRUE,cluster_cols = TRUE, annotation_col=group_info, annotation_row = group_class)
目的是想做出附件中的图
附件列表