1

当我在 RI 中计算自举树时,会得到与使用 PAST 时不同的值(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,它以某种方式被裁剪):

在此处输入图像描述

我转换数据以将其发送到 PAST,如下所示:

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")
4

1 回答 1

2

经过大量搜索,结果发现答案在apeFAQ Q14中:

我已经用 boot.phylo 进行了引导分析,但是在树根之后,一些引导值似乎在错误的位置。这是因为引导值被计为进化枝的频率,而不是实际的二分法。所以这些值实际上与节点相关联,而不是与边缘相关联。结果是,一些引导值在(重新)植根树之后很容易失去它们的含义,因为这将影响树中进化枝的定义。一个简单的解决方案是在作为 boot.phylo 的参数给出的函数 FUN 的定义中包含生根过程。显然,在进行引导之前,估计的树也必须以相同的方式植根。在这种情况下,预先定义 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")

在此处输入图像描述

这与过去的输出非常匹配。

于 2014-12-18T06:00:04.940 回答