【发布时间】:2014-02-12 12:22:06
【问题描述】:
下面的这个脚本运行良好,可以很好地获得包含大量数据集的集群,但我需要将集群放入一个 newick 文件或文本文件中,以便我可以将它从 R 导出到其他编辑程序,但我找不到一种将 hclust 转换为 newick 格式的方法,我该怎么做? 我觉得 new2phylo 功能可能会完成这项工作,但我们没有设法让它发挥作用。
非常感谢您的帮助,因为我们到处搜索并找不到解决方案 =(
datos <- read.table("morphclustersred.csv",header=T,sep="\t")
head(datos)
distfunc <- function(x) daisy(x,metric="gower")
d <- distfunc(datos)
hclustfunc <- function(x) hclust(x, method="complete")
fit <- hclustfunc(d)
plot(fit)
plot(fit, labels=datos$Species,main='Morphological Clustering')
rect.hclust(fit, k=5, border="red")
【问题讨论】:
-
什么是新文件?
-
你检查过Bioconductor或
library(sos); findFn("write newick")吗? -
非常感谢罗曼!!得到它的工作!伟大的!该函数来自 ctc write(hc2Newick(fit), file='hclust.newick')
-
@Spacedman newick 格式(文件)为a way of representing graph-theoretical trees with edge lengths using parentheses and commas。
标签: r cluster-computing hclust