作弊图 - cytokine_annotation

pheatmap - cytokine_annotation

我尝试在 pheatmap 中开发 cytokine_annotation 并收到错误消息

Error in seq.int(rx[1L], rx[2L], length.out = nb) : 'from' must be finite

R 版本 3.3.3 pheatmap_1.0.8

可重现的例子:

#Using cytokine annotations
M<-matrix(rnorm(8*20),ncol=8)
row_annotation<-data.frame(A=gl(4,nrow(M)/4),B=gl(4,nrow(M)/4))
eg<-expand.grid(factor(c(0,1)),factor(c(0,1)),factor(c(0,1)))
colnames(eg)<-c("IFNg","TNFa","IL2")
rownames(eg)<-apply(eg,1,function(x)paste0(x,collapse=""))
rownames(M)<-1:nrow(M)
colnames(M)<-rownames(eg)
cytokine_annotation=eg
pheatmap(M,annotation=annotation,row_annotation=row_annotation,annotation_legend=TRUE,row_annotation_legend=TRUE,cluster_rows=FALSE,cytokine_annotation=cytokine_annotation,cluster_cols=FALSE)

在我的 pheatmap_1.0.8 的 R 3.3.3 上,以下代码有效:

set.seed(1)
M <- matrix(rnorm(8*20),ncol=8)
row_annotation <- data.frame(A=gl(4,nrow(M)/4),B=gl(4,nrow(M)/4))
eg <- expand.grid(factor(c(0,1)),factor(c(0,1)),factor(c(0,1)))
colnames(eg) <- c("IFNg","TNFa","IL2")
rownames(eg) <- apply(eg,1,function(x)paste0(x,collapse=""))
rownames(M) <- 1:nrow(M)
colnames(M) <- rownames(eg)
cytokine_annotation <- eg
library(pheatmap)
pheatmap(M, annotation=cytokine_annotation, row_annotation=row_annotation,
            annotation_legend=TRUE, row_annotation_legend=TRUE, cluster_rows=FALSE,
            cytokine_annotation=cytokine_annotation, cluster_cols=FALSE)

我也遇到了这个问题,发现重启R就解决了这个问题。