Hola Juan.

If your heights (distances) above the root are a vector h in the order of the node indices of the tree (in tree$edge) it would be as easy as:


tree$edge.length<-rep(NA,nrow(tree$edge))
for(i in 1:nrow(tree$edge))
        tree$edge.length[i]<-h[tree$edge[i,2]]-h[tree$edge[i,1]]

If it the nodes are labeled in a different fashion, then it would be slightly more complicated (for instance, involving the identifying MRCAs or matching nodes), but similar. How are your node & leaf heights organized?

All the best, Liam

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
email: liam.rev...@umb.edu
blog: http://blog.phytools.org

On 11/30/2016 11:30 AM, Juan Antonio Balbuena wrote:
Hi all

This is a simple question:

I have a set of ultrametric trees with information on their topology but
without branch lengths. On a separate file, I have the distances of each
node and leaf to the root. Can someone instruct me on how to to compute
the branch lengths of the tree with these two separate bits of information?

Many thanks in advance

Juan A. Balbuena


--

Dr. Juan A. Balbuena
Cavanilles Institute of Biodiversity and Evolutionary Biology
University of Valencia
http://www.uv.es/~balbuena <http://www.uv.es/%7Ebalbuena>
P.O. Box 22085
http://www.uv.es/cophylpaco <http://www.uv.es/cavanilles/zoomarin/index.htm>
46071 Valencia, Spain
e-mail: j.a.balbu...@uv.es <mailto:j.a.balbu...@uv.es>    tel. +34 963
543 658    fax +34 963 543 733
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*NOTE!*For shipments by EXPRESS COURIER use the following street address:
C/ Catedrático José Beltrán 2, 46980 Paterna (Valencia), Spain.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to