[R-sig-phylo] assign numbers to nodes

2013-07-05 Thread Juan Antonio Balbuena

  
  
Hello 
Sorry for this apparently simple question, but could not find the
right answer on the internet.

For a given phylo object in ape consisting of n tips, how can I
assign unique node numbers from 1 to 2n-1, such that if a node i is
ancestral to a node k, i  k?

Thanks for your attention.  

Juan A. Balbuena

-- 
  
  

  Dr. Juan
A. Balbuena 
Marine Zoology Unit 
Cavanilles Institute of Biodiversity and Evolutionary
Biology 
University of
Valencia
  http://www.uv.es/~balbuena 
P.O. Box
22085
  http://www.uv.es/cavanilles/zoomarin/index.htm 
46071 Valencia,
Spain
  http://cetus.uv.es/mullpardb/index.html 
e-mail: 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/ Catedrtico Jos Beltrn 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/

Re: [R-sig-phylo] assign numbers to nodes

2013-07-05 Thread Liam J. Revell

Hi Juan.

I'm pretty sure that by ape phylo convention all node numbers in 
tree$edge are such that all descendants node numbers  ancestor node 
numbers. To assign numbers to node labels such that the reverse is true 
(and such that node numbers go from 1:tree$Nnode) you can do:


tree$node.label-tree$Nnode:1

To check, try:

library(phytools)
tree$node.label-tree$Nnode:1
plotTree(tree,setEnv=TRUE)
nodelabels(tree$node.label)

I think this is what you mean. - Liam

Liam J. Revell, Assistant 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 7/5/2013 11:33 AM, Juan Antonio Balbuena wrote:

Hello
Sorry for this apparently simple question, but could not find the right
answer on the internet.

For a given phylo object in ape consisting of n tips, how can I assign
unique node numbers from 1 to 2n-1, such that if a node i is ancestral
to a node k, i  k?

Thanks for your attention.

Juan A. Balbuena

--

Dr. Juan A. Balbuena
Marine Zoology Unit
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/cavanilles/zoomarin/index.htm
46071 Valencia, Spain http://cetus.uv.es/mullpardb/index.html
e-mail: j.a.balbu...@uv.es mailto:j.a.balbu...@uv.estel. +34 963
543 658fax +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/