[R] compute the associate vector of distances between leaves in a binary non-rooted tree

2010-06-02 Thread Arnau Mir Torres
Hello. I'd like to compute the associate vector of distances between leaves in a binary non-rooted tree. The definition of a distance between two leaves in a binary non-rooted tree is the number of edges in the path joining the two leaves. I've tried the ape package but I'm unable to find this

Re: [R] compute the associate vector of distances between leaves in a binary non-rooted tree

2010-06-02 Thread Joris Meys
Hi, with a little hack you can use the function cophenetic.phylo from ape. You just set all branch lengths to 1 : require(ape) tree - rtree(5,rooted=F) n - length(tree$edge.length) tree$edge.length - rep(1,n) cophenetic.phylo(tree) t3 t1 t2 t4 t5 t3 0 3 3 3 3 t1 3 0 2 4 4 t2 3 2

Re: [R] compute the associate vector of distances between leaves in a binary non-rooted tree

2010-06-02 Thread Arnau Mir
El 02/06/10 15:14, Joris Meys escribió: Hi, with a little hack you can use the function cophenetic.phylo from ape. You just set all branch lengths to 1 : require(ape) tree - rtree(5,rooted=F) n - length(tree$edge.length) tree$edge.length - rep(1,n) cophenetic.phylo(tree) t3 t1 t2