我有两棵树要比较。一个来自 mrbayes,另一个来自 Paup。
当我使用 read.nexus 时,生成的 phylo 对象具有不同顺序的尖端标签,尽管这两个文件具有相同的关系分类单元块。
我在下面复制了这些树:
library(ape)
#trees
t1 <- structure(list(edge = structure(c(29L, 30L, 30L, 30L, 30L, 31L,
31L, 32L, 32L, 33L, 34L, 35L, 35L, 35L, 34L, 36L, 37L, 38L, 38L,
38L, 38L, 37L, 39L, 40L, 40L, 39L, 39L, 39L, 39L, 36L, 36L, 36L,
36L, 33L, 31L, 31L, 31L, 31L, 29L, 30L, 1L, 2L, 3L, 31L, 4L,
32L, 5L, 33L, 34L, 35L, 6L, 7L, 8L, 36L, 37L, 38L, 9L, 10L, 11L,
12L, 39L, 40L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
23L, 24L, 25L, 26L, 27L, 28L), .Dim = c(39L, 2L)), Nnode = 12L,
tip.label = c("Metaspriggina", "Eptatretus", "Mordacia",
"Lasanius", "Phlebolepis", "Zenaspis", "Diademaspis", "Ukrainaspis",
"Tamiobatis", "Ischnacanthus", "Mesacanthus", "Tetanopsyrus",
"Mimipiscis", "Raynerius", "Diabolepis", "Guiyu", "Gavinia",
"Qingmenodus", "Kujdanowiaspis", "Cowralepis", "Jagorina",
"Macropetalichthys", "Polybranchiaspis", "Cyathaspis", "Irregulareaspis",
"Listraspis", "Unarkaspis", "Pikaia")), class = "phylo", order = "cladewise")
t2 <- structure(list(edge = structure(c(29L, 29L, 30L, 30L, 31L, 32L,
33L, 33L, 32L, 31L, 31L, 31L, 31L, 31L, 31L, 34L, 35L, 36L, 37L,
37L, 36L, 35L, 38L, 39L, 40L, 41L, 42L, 42L, 42L, 42L, 41L, 43L,
44L, 44L, 43L, 45L, 46L, 47L, 47L, 46L, 45L, 40L, 48L, 48L, 39L,
38L, 34L, 1L, 30L, 2L, 31L, 32L, 33L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 34L, 35L, 36L, 37L, 11L, 12L, 13L, 38L, 39L, 40L, 41L,
42L, 21L, 23L, 24L, 17L, 43L, 44L, 22L, 27L, 45L, 46L, 47L, 28L,
26L, 25L, 16L, 48L, 15L, 19L, 18L, 20L, 14L), .Dim = c(47L, 2L
)), Nnode = 20L, tip.label = c("Pikaia", "Metaspriggina", "Eptatretus",
"Mordacia", "Lasanius", "Phlebolepis", "Cyathaspis", "Irregulareaspis",
"Listraspis", "Unarkaspis", "Zenaspis", "Diademaspis", "Ukrainaspis",
"Polybranchiaspis", "Cowralepis", "Guiyu", "Ischnacanthus", "Jagorina",
"Kujdanowiaspis", "Macropetalichthys", "Mesacanthus", "Mimipiscis",
"Tamiobatis", "Tetanopsyrus", "Diabolepis", "Gavinia", "Raynerius",
"Qingmenodus")), class = "phylo", order = "cladewise")
#tip labels are the same
all.equal(sort(t1$tip.label), sort(t2$tip.label))
#[1] TRUE
#tip label order is different
all.equal(t1$tip.label, t2$tip.label)
#[1] "26 string mismatches"
有没有办法重新排序 t1 的提示标签,使它们与 t2 一致?