> library(ape)
> set.seed(100)
> tree > X > # replace all node numbers for tips with their labels
> X[X[,2]%in%1:length(tree$tip),2] tree$tip[X[X[,2]%in%1:length(tree$tip),2]]
> # substitute the names of tree$edge.length for the rows of X
> names(tree$edge.length) > round(tree$edge.length,2)
11,12??12,t9??12,13??13,t4??13,t5??11,14??14,15??15,t2??15,16
??0.20?? 0.36?? 0.36?? 0.69?? 0.54?? 0.71?? 0.54?? 0.75?? 0.42
16,t10??16,17??17,t8??17,t7??14,18??18,t6??18,19??19,t3??19,t1
??0.17?? 0.77?? 0.88?? 0.55?? 0.28?? 0.49?? 0.93?? 0.35?? 0.95
> plot(tree,no.margin=T)
> edgelabels(round(tree$edge.length,2))
> nodelabels()
That's it.
Source: http://phytools.blogspot.com/2012/08/trick-to-name-edges-of-phylo-object-for.html
Allyson Felix Kourtney Kardashian Baby Girl Ashton Eaton London 2012 basketball London 2012 Slalom Canoe Alex Morgan Misty May Treanor
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.