[Phylobase-devl] Root node number should be one plus number of tips?
Sang Chul Choi
choi at biology.rutgers.edu
Sat Apr 12 22:37:12 CEST 2008
Hi,
In my previous message, the first tree's root is 9 but, using
rootNode() function it returns 6, so it may returns one plus number of
tips.
Thank you,
Sang Chul
m <- rbind(c(6,8),c(8,7),c(9,6),c(6,5),c(8,4),c(9,3),c(7,2),c(7,1))
m.l <- c(0.13979526, 0.04856891, 1.51140412, 0.46082282,
0.32102756, 1.97222694, 0.27245865, 0.27245865)
tree1 <- phylo4(edge=m, edge.length=m.l)
rootNode(tree1)
On Apr 11, 2008, at 12:56 PM, Sang Chul Choi wrote:
> Hi,
>
> I made trees using phylo4 object with time. I tested if it is
> ultrametric using is.ultrametric, and I also write it to a tree file.
> It seems that the if root node number is not one plus number of tips,
> then ultrametric and write.tree does not seem to work. Maybe there is
> help document how to create a tree in APE or phylobase package, but I
> could not see any requirement except that matrix first column is for
> ancestors, and second column is for descendants.
>
> Is there any further requirement for making trees other than this
> (that matrix first column is for ancestors, and second column is for
> descendants)?
>
> I am trying to update trees or subtree pruning and regrafting kind of
> work. I take edge information using edges() function and change it.
> Using the changed edge matrix table, I recreate phylo4 object. This
> would change root node numbers and changed trees are behave
> "awkwardly" (I guess only) to me. By the way, I found a "nice"
> function in APE, "reorder", which does somehow help me to change tree
> internal information so that tree can properly manipulated by APE
> function. Is there a function in phylobase that change tree internal
> structure so that tree internal information is corrected?
>
> I do not think that this is a bug, but it is something that is not
> that I expected.
>
> Thank you,
>
> Sang Chul
>
> Just if anybody is interested in (I guess not) what I am doing?
> CODE start:
> All trees are 5 tips binary ultrametric tree.
> tree1: root number is 9 -> tree file has a tree with 4 tips, not
> ultrametric
> tree2: root number is 6 (6 and 9 are reversed from tree1) -> tree
> file has the right tree
> tree3: root number is 6, and change two internal node numbers (8 <-
>> 9) -> tree file has the right tree.
>
> m <- rbind(c(6,8),c(8,7),c(9,6),c(6,5),c(8,4),c(9,3),c(7,2),c(7,1))
> m.l <- c(0.13979526, 0.04856891, 1.51140412, 0.46082282,
> 0.32102756, 1.97222694, 0.27245865, 0.27245865)
> tree1 <- phylo4(edge=m, edge.length=m.l)
> tree1 <- reorder(as(tree1, "phylo"))
> print(tree1)
> print(paste("Is tree1 ultametric?", is.ultrametric(tree1)))
> print("Coal. Intervals")
> print(coalescent.intervals(tree1)$interval.length)
> write.tree(tree1, "1.tre")
>
> m <- rbind(c(9,8),c(8,7),c(6,9),c(9,5),c(8,4),c(6,3),c(7,2),c(7,1))
> m.l <- c(0.13979526, 0.04856891, 1.51140412, 0.46082282,
> 0.32102756, 1.97222694, 0.27245865, 0.27245865)
> tree2 <- phylo4(edge=m, edge.length=m.l)
> tree2 <- reorder(as(tree2, "phylo"))
> print(tree2)
> print(paste("Is tree2 ultametric?", is.ultrametric(tree2)))
> print("Coal. Intervals")
> print(coalescent.intervals(tree2)$interval.length)
> write.tree(tree2, "2.tre")
>
> m <- rbind(c(8,9),c(9,7),c(6,8),c(8,5),c(9,4),c(6,3),c(7,2),c(7,1))
> m.l <- c(0.13979526, 0.04856891, 1.51140412, 0.46082282,
> 0.32102756, 1.97222694, 0.27245865, 0.27245865)
> tree3 <- phylo4(edge=m, edge.length=m.l)
> tree3 <- reorder(as(tree3, "phylo"))
> print(tree3)
> print(paste("Is tree3 ultametric?", is.ultrametric(tree3)))
> print("Coal. Intervals")
> print(coalescent.intervals(tree3)$interval.length)
> write.tree(tree3, "3.tre")
>
> hylogenetic tree with 5 tips and 4 internal nodes.
>
> Tip labels:
> [1] "T1" "T2" "T3" "T4" "T5"
> Node labels:
> [1] "N1" "N2" "N3" "N4"
>
> Rooted; includes branch lengths.
> [1] "Is tree1 ultametric? FALSE"
> [1] "Coal. Intervals"
> [1] 0.46082282 1.32303995 0.04856891 0.13979526
>
> Phylogenetic tree with 5 tips and 4 internal nodes.
>
> Tip labels:
> [1] "T1" "T2" "T3" "T4" "T5"
> Node labels:
> [1] "N1" "N2" "N3" "N4"
>
> Rooted; includes branch lengths.
> [1] "Is tree2 ultametric? TRUE"
> [1] "Coal. Intervals"
> [1] 0.27245865 0.04856891 0.13979526 1.51140412
>
> Phylogenetic tree with 5 tips and 4 internal nodes.
>
> Tip labels:
> [1] "T1" "T2" "T3" "T4" "T5"
> Node labels:
> [1] "N1" "N2" "N3" "N4"
>
> Rooted; includes branch lengths.
> [1] "Is tree3 ultametric? TRUE"
> [1] "Coal. Intervals"
> [1] 0.27245865 0.04856891 0.13979526 1.51140412
>
>
> _______________________________________________
> Phylobase-devl mailing list
> Phylobase-devl at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/phylobase-devl
More information about the Phylobase-devl
mailing list