自举树值从过去的不同(Bootstrapped tree values differ from PA

2019-10-21 10:30发布

当我在计算RI自举树得到不同的值时,我利用过去( http://folk.uio.no/ohammer/past/ )。 我怎样才能得到的输出从两个方案相匹配?

下面是我在R(以下数据)正在做:

library("ape")
library("phytools")
library("phangorn")
library("cluster")

# compute neighbour-joined tree
f <- function(xx) nj(daisy(xx))
nj_tree <- f(tab) 
nj_tree_root <- root(nj_tree, 1, r = TRUE)

## bootstrap
# bootstrap values do not match PAST output - why is that?

nj_tree_root_boot <- boot.phylo(nj_tree, FUN = f, tab,  rooted = TRUE)

# Are bootstrap values stable?
for (i in 1:10){
  print(boot.phylo(nj_tree, FUN = f, tab,  rooted = TRUE, quiet = TRUE))
}
# yes, they seem ok

# plot tree with bootstrap values
plot(nj_tree_root, use.edge.length = FALSE)
nodelabels(nj_tree_root_boot, adj = c(1.2, 1.2), frame = "none")

自举典型输出为[1] 100 6 39 27 23 57 53 75 71和这里的图(远LHS值应为100,它在某种程度上裁剪):

我的变换,送过去,像这样的数据:

tab1 <- t(apply(tab, 1, as.numeric))
write.table(tab1, "tab.txt")

过去我打开tab.txt文件,做多元 - >群集 - >邻居欧几里德和100次自加入重复使用外群。 从过去的我得到这个情节:

和值有很大的不同。 我需要做什么有R做的,使输出匹配,从过去呢? 已经过去错了吗?

数据:

tab <- structure(list(X1 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
                                1L, 2L, 2L), .Label = c("0", "1"), class = "factor"), X2 = structure(c(1L, 
                                                                                                       1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("0", "1"), class = "factor"), 
               X3 = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 
                                2L), .Label = c("0", "1"), class = "factor"), X4 = structure(c(2L, 
                                                                                               2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L), .Label = c("0", 
                                                                                                                                                   "1"), class = "factor"), X5 = structure(c(1L, 1L, 1L, 1L, 
                                                                                                                                                                                             2L, 2L, 1L, 2L, 1L, 2L, 1L), .Label = c("0", "1"), class = "factor"), 
               X6 = structure(c(1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 
                                2L), .Label = c("0", "1"), class = "factor"), X7 = structure(c(1L, 
                                                                                               2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L), .Label = c("0", 
                                                                                                                                                   "1"), class = "factor"), X8 = structure(c(2L, 2L, 2L, 2L, 
                                                                                                                                                                                             1L, 1L, 2L, 2L, 1L, 2L, 2L), .Label = c("0", "1"), class = "factor"), 
               X9 = structure(c(1L, 1L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 
                                1L), .Label = c("0", "1"), class = "factor"), X10 = structure(c(1L, 
                                                                                                1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 2L), .Label = c("0", 
                                                                                                                                                    "1"), class = "factor"), X11 = structure(c(1L, 2L, 1L, 1L, 
                                                                                                                                                                                               1L, 1L, 2L, 2L, 2L, 1L, 2L), .Label = c("0", "1"), class = "factor"), 
               X12 = structure(c(2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                 1L), .Label = c("0", "1"), class = "factor"), X13 = structure(c(2L, 
                                                                                                 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0", 
                                                                                                                                                     "1"), class = "factor"), X14 = structure(c(2L, 2L, 1L, 1L, 
                                                                                                                                                                                                1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"), 
               X15 = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                 2L), .Label = c("0", "1"), class = "factor"), X16 = structure(c(2L, 
                                                                                                 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L), .Label = c("0", 
                                                                                                                                                     "1"), class = "factor"), X17 = structure(c(2L, 1L, 1L, 1L, 
                                                                                                                                                                                                1L, 1L, 1L, 2L, 1L, 1L, 2L), .Label = c("0", "1"), class = "factor"), 
               X18 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 
                                 1L), .Label = c("0", "1"), class = "factor"), X19 = structure(c(1L, 
                                                                                                 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L), .Label = c("0", 
                                                                                                                                                     "1"), class = "factor"), X20 = structure(c(1L, 1L, 1L, 1L, 
                                                                                                                                                                                                1L, 1L, 1L, 1L, 1L, 2L, 2L), .Label = c("0", "1"), class = "factor"), 
               X21 = structure(c(1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 
                                 1L), .Label = c("0", "1"), class = "factor"), X22 = structure(c(2L, 
                                                                                                 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 2L), .Label = c("0", 
                                                                                                                                                     "1"), class = "factor"), X23 = structure(c(1L, 1L, 2L, 1L, 
                                                                                                                                                                                                1L, 1L, 1L, 2L, 1L, 2L, 2L), .Label = c("0", "1"), class = "factor"), 
               X24 = structure(c(1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 2L, 
                                 2L), .Label = c("0", "1"), class = "factor"), X25 = structure(c(1L, 
                                                                                                 1L, 2L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L), .Label = c("0", 
                                                                                                                                                     "1"), class = "factor"), X26 = structure(c(1L, 1L, 2L, 2L, 
                                                                                                                                                                                                2L, 1L, 2L, 2L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor")), .Names = c("X1", 
                                                                                                                                                                                                                                                                                  "X2", "X3", "X4", "X5", "X6", "X7", "X8", "X9", "X10", "X11", 
                                                                                                                                                                                                                                                                                  "X12", "X13", "X14", "X15", "X16", "X17", "X18", "X19", "X20", 
                                                                                                                                                                                                                                                                                  "X21", "X22", "X23", "X24", "X25", "X26"), row.names = c("a", 
                                                                                                                                                                                                                                                                                                                                           "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"), class = "data.frame")

Answer 1:

经过一番摸索,它转出答案是ape包常见问题Q14 :

我做了一个自举分析boot.phylo但一些引导值生根的树后,似乎在错误的地方。 这是因为,自引导值被计为进化枝的频率,而不是作为实际bipartitions。 所以这些值确实相关联的节点,而不是边缘。 一个后果是,一些引导值都lilely失去他的意思后(再)生根的树,因为这将影响到树进化枝的定义。 一个简单的解决方案是在包括被给出作为参数boot.phylo函数FUN的定义生根过程。 显然,估计树也必须做好引导前植根于相同的方式。 在这种情况下,更方便预先定义乐趣。 一个例子代码如下:

outgroup <- 1 # may be several tips, numeric or tip labels
foo <- function(xx) root(nj(dist.dna(xx)), outgroup)
tr <- foo(X) # X is the matrix of DNA sequences
bp <- boot.phylo(tr, X, foo)
plot(tr)
nodelabels(bp) # will have "100" at the root

在我的问题的具体情况:

nj_tree_root_boot <- boot.phylo(nj_tree, FUN = f, tab,  rooted = TRUE)
plot(nj_tree_root, use.edge.length = FALSE)
nodelabels(nj_tree_root_boot, adj = c(1.2, 1.2), frame = "none")

这在过去的输出相匹配相当不错。



文章来源: Bootstrapped tree values differ from PAST