我需要用函数'pheatmap‘制作一个热图,使用UPGMA和1-pearson相关作为距离度量。我的教授声称这是默认的距离度量,尽管在我的例子中它使用‘欧几里德’作为距离度量。欧几里得和1-皮尔逊的相关性是相同的还是他错了?如果他错了,我怎么才能用正确的距离度量我的热图呢?
我的投入
ph=pheatmap(avgreltlog10, color = colorRampPalette(rev(brewer.pal(n = 7,
name = "RdYlBu")))(100),
kmeans_k = NA, breaks = NA, border_color = "grey60",
cellwidth = 10, cellheight=10, scale = "none", cluster_rows=TRUE,
clustering_method = "average", cutree_rows = 4, cutree_cols= 2,)R输出
$tree_row
Call:
hclust(d = d, method = method)
Cluster method : average
Distance : euclidean
Number of objects: 65
$tree_col
Call:
hclust(d = d, method = method)
Cluster method : average
Distance : euclidean
Number of objects: 10 发布于 2017-12-23 11:09:40
可以通过在终端中键入没有()的函数名来轻松检查默认设置
>pheatmap如果这样做,可以看到欧几里德被用作默认值:
... clustering_distance_rows = "euclidean", clustering_distance_cols = "euclidean", clustering_method = "complete", ...要使用1-pearson相关性,只需将其指定如下:
cluster_rows = TRUE,
clustering_distance_rows = "correlation"它的工作是因为,再一次,如果深入到代码中,您可以看到它调用了cluster_mat,这是这样做的:
cluster_mat = function(mat, distance, method){
...
if(distance[1] == "correlation"){
d = as.dist(1 - cor(t(mat)))
}
...更多信息在正式文件。有这么多的包,所以把东西混在一起并不少见:)
https://stackoverflow.com/questions/47874486
复制相似问题