4

When working with phylogenetic tree data in R (specifically when working with "phylo" or "phylo4" objects) it would be useful to normalize branch lengths so that certain taxa (the ones that evolve faster) do not contribute a disproportionate amount of branch length to the tree. This seems to be common in computing UniFrac values, as can be found in the discussion here: http://bmf2.colorado.edu/unifrac/help.psp. (I need more than just UniFrac values, however).

However, I cannot find a function that performs this normalization step. I have looked in ape, picante, adephylo, and phylobase. Could someone direct me to a package that includes this function, or a package that makes writing this kind of function straightforward?

C_Z_
  • 7,427
  • 5
  • 44
  • 81
Krisrs1128
  • 311
  • 4
  • 8

1 Answers1

2

Are you looking for a function to just scale the branch lengths of a tree? If so, compute.brlen() in ape will do it. There are built in options for Grafen's rho and all = 1. You can also supply your own function.

I don't know if UniFrac does some other kind of branch length scaling. But if so, you could write your function and pass it.

kmm
  • 6,045
  • 7
  • 43
  • 53
  • This does what I was asking for, thanks! I don't think UniFrac requires any other kind of branch length scaling. Also, I've found that, another way to do this would be to let branch.sum <- tree@edge.length and then set tree@edge.length <- tree@edge.length/branch.sum. – Krisrs1128 Aug 08 '11 at 07:10