Pheatmap error Error in hclust (d, method = method): NA / NaN / Inf in external function call (arg 11)

I am trying to create a heatmap with gene expression values โ€‹โ€‹using the pheatmap package in r. I have used the code many times and never had a problem until today. It seems when I do scale = "string" I get this error. I cannot create z-scores. So it is likely that some strings don't have any mutability for which this happens. How can I get rid of this. The matrix has 1100 rows and 9 columns. Below is the am code using

data<-read.table("~path/DEGs_DESeq.txt",sep="\t")
data2<-as.matrix(data[,2:9])
data3<-data2[-1,]
samples<-data2[1,]
genes<-data[2:length(data2[,1]),1]
vett<-as.numeric(data3)
data4<-matrix(vett,length(genes),length(samples), dimnames=list(paste(genes),paste(samples)))
head(data4)

pheatmap(as.matrix(data4),col=bluered(200), scale="row", key=T, keysize=1.5,density.info="none", trace="none",cexCol=0.6, fontsize_row = 8,,fontsize_col = 10)

      

Error in hclust (d, method = method): NA / NaN / Inf in external function call (arg 11)

How can I get rid of this error?

+3


source to share


1 answer


I figured I would fix it .. I had to delete the lines for which there was no SD when doing the z score calculation and it rebuilt the heatmap. Thanks to



+1


source







All Articles