Hi Liam
Thank you very much for your input. I am working with host and parasite trees. 
The host tree topology looks like:

TREE HOST = 
((((H4,H5)H3,H6)H2,((H9,(H11,H12)H10)H8,(H14,((H17,H18)H16,H19)H15)H13)H7)H1,(H21,H22)H20)H0;

and the heights above the root are given as

[RANKS represents the ranks of the nodes in the tree]
[Syntax is: nodename timezone_from timezone_to]
        RANKS
                H0      2       2,
                H1      4       4,
                H2      5       5,
                H3      6       6,
                H4      15      15,
                H5      15      15,
                H6      15      15,
                H7      7       7,
                H8      9       9,
                H9      15      15,
                H10     10      10,
                H11     15      15,
                H12     15      15,
                H13     8       8,
                H14     15      15,
                H15     11      11,
                H16     15      15,
                H17     15      15,
                H18     15      15,
                H19     15      15,
                H20     3       3,
                H21     15      15,
                H22     15      15,

Thanks again for your time.

Juan


> 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/indexhtm>
> > 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-projectorg/
> >
> 


--
--
Dr. Juan A. Balbuena
Cavanilles Institute of Biodiversity and Evolutionary
Biology
University of Valencia
P.O. Box 22085
46071 Valencia, Spain
e-mail: j.a.balbu...@uv.es    tel. +34 963 543 658
+++++++++++++++++++++++++++++++++++++++++++++++++++
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/

Reply via email to