Let’s say you have a non-ultrametric tree called “MyTree.” Just load the function and run the following line of code:
NewTree <- ultrametricize(MyTree)
“NewTree” will be your ultrametricized phylogeny.
I wrote this function as an alternative to the compute.brlen function in ape (described at inside-R and r-phylo as well as the ape reference manual). My function averages the terminal branch lengths of sister taxa and then stretches all the other branches proportionally, scaling them to the longest branch(es). The function is inspired by Sanderson (1997).
If you use this function, please let me know at email@example.com. In the future I hope to share additional R functions relating to tree stretching and coevolution.