Scott,

I have written a function to transform branch lengths on a tree according to 
age constraints in the terminal taxa and (optionally) the nodes (attached).  If 
your phylo object is tr, the command

scalePhylo(tr, tip.ages, node.mins)

will return a phylo object with new branch lengths scaled to the age 
constraints.  Ages are positive numbers (e.g., in Ma).  If all your taxa are 
extant, set tip.ages to be a vector of zeroes.  The argument node.mins can have 
NA entries for nodes without constraints.

I developed this for paleontological trees so the tip ages usually constrain 
branch lengths as well.  This may not work exactly as you would like for trees 
of extant species with only some of the nodes constrained (some internal nodes 
can be pushed up to the recent).

You may also want to look at Graeme Lloyd's function for doing this, which 
handles zero-length branches in a more elegant way:  
http://www.graemetlloyd.com/methdpf.html.  Again, this was designed for 
paleontological applications, so it might not get you exactly what you need.  
The code may be a useful starting point, though.

Best,
Gene


On 3/11/11 10:01 AM, "Scott Chamberlain" <myrmecocys...@gmail.com> wrote:

Hello,


We have trees for which we have estimated node ages for many nodes (but not all 
nodes in any one tree). We would like to assign node ages to the trees, and 
then later transform branch lengths according to node ages. How does one assign 
node ages in R?


Thanks, Scott Chamberlain
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo



--
Gene Hunt
Curator, Department of Paleobiology
National Museum of Natural History
Smithsonian Institution [NHB, MRC 121]
P.O. Box 37012
Washington DC 20013-7012
Phone: 202-633-1331  Fax: 202-786-2832
http://paleobiology.si.edu/staff/individuals/hunt.cfm

Attachment: Tree-node-ages.R
Description: Tree-node-ages.R

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to