【pheatmap热图scale报错】Error in hclust(d, method = method):NA/NaN/Inf in foreign function call (arg 11)

初始数据类似如下:
【pheatmap热图scale报错】Error in hclust(d, method = method):NA/NaN/Inf in foreign function call (arg 11)_归一化
填充下缺失值

data[data==0] <- NA
data[is.na(data)] <- min(data,na.rm = T)*0.01
pheatmap(log10(data))

pheatmap(data,scale = "row")

直接取log绘制不报错,但做​ ​scale​ ​时报错:

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

原因是数据中有标准差sd为0的行,做归一化时报错。pheatmap中做归一化采用的是scale方法:
【pheatmap热图scale报错】Error in hclust(d, method = method):NA/NaN/Inf in foreign function call (arg 11)_微信公众号_02
因此如果要做scale,需要将这样的行去掉:

test <- data[apply(data, 1, function(x) sd(x)!=0),]
pheatmap(test,scale = "row")


Ref:
​​ ​https://stackoverflow.com/questions/30350438/pheatmap-scale-row-giving-error-in-hclustd-method-method-na-nan-inf-in​ ​​ ​https://zhuanlan.zhihu.com/p/30518877​



本文来自博客园,作者:​ ​Bioinfarmer​ ​​,转载请注明原文链接:​ ​javascript:void(0)p/13142053.html​ ​。若要及时了解动态信息,请关注同名微信公众号:Bioinfarmer。

There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor

There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not suppor 解决方案 必须都是包装类型 ...

eclipse报错:The method convert(String) of type DateConvertor must override a superclass method;

​​@Override must override a superclass method 问题解决​​ 如果在使用Eclipse开发Java项目时,在使用 @Override 出现以下错误: The method *** of type *** must override a superclass method 主要是因为你的Compiler是jdk5,(5不支持@Override等形式的批