R gplots heatmap.2-键不会显示(警告:未分类的“ breaks”将在使用前进行分类)

时间:2018-07-03 18:33:02

标签: r heatmap

尝试使用heatmap.2制作热图时遇到多个错误。我可以用实际数字获得正确的方案,但图例不会显示。我不断收到以下错误:

Error in seq.default(min.raw, max.raw, by = min(diff(breaks)/100)) : 
  wrong sign in 'by' argument
In addition: Warning message:
In image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 +  :
  unsorted 'breaks' will be sorted before use

出现第一个错误时,我尝试将符号更改为by,但在seq()命令中使用length。即使我的数字向量都是正确的,即使我对向量进行硬编码而不是使用seq()也会遇到错误。由于第二个错误,我无法弄清楚这个问题,我之前用symkey = FALSE修复了这个问题,但是这次不起作用。还有其他人了解我可能会想念的吗?非常感激。我的代码在下面。

#heart data input
heart=read.csv('heart_rnaseq.csv',header=T,check.names=FALSE)
row.names(heart) = heart$time
heart = heart[,2:33]
heart_matrix=data.matrix(heart)

new_palette = c("#B1DAD9", "#808080", "#FFFF00", "#FFE600", "#FFCD00",
                "#FFB400", "#FF9B00", "#FF8300", "#FF6A00", "#FF5100", 
                "#FB4000", "#F53700", "#EE2E00", "#E72400", "#E11B00", 
                "#DA1200", "#D30900", "#CD0000")


col_breaks = c(seq(599.9,499.6,length=2),        
               seq(499.5,399.6,length=2),    
               seq(399.5,299.6,length=2),    
               seq(299.5,199.6,length=2),
               seq(199.5,99.6,length=2),
               seq(99.5,49.6,length=2),
               seq(49.5,24.6,length=2),
               seq(24.5,0.6,length=2),
               seq(0.5,-0.5,length=2),
               seq(-0.6,-15.5,length=1))                  

heatmap.2(heart_matrix,
          main = "Heart Significant\nPathways by Comparison",
          xlab = "Pathway",
          ylab = "Timepoint Group",
          keysize = 1.25,
          symkey = FALSE,
          key.xlab = "Count",
          key.par = list(mar=c(4.5,4,3,0)),
          breaks = col_breaks,
          cexRow = 1.5,
          cexCol = 0.7,
          density.info = "none",
          trace = "none",
          margins = c(12,9),
          col = new_palette,
          dendrogram = "none",
          Colv = "NA",
          Rowv = "NA",
          scale = "none",
          sepcolor="black",
          sepwidth = c(0.01,0.01),
          colsep=1:ncol(heart_matrix),
          rowsep=1:nrow(heart_matrix))

0 个答案:

没有答案