[R-sig-phylo] Collapsing nodes using node.labels

Emmanuel Paradis emmanuel.paradis at ird.fr
Thu Sep 29 07:05:29 CEST 2011


My suggestion below should work with trees initially with zero-length branch if using a negative value instead of 0, e.g.:

tr$edge.length[j] <- -1

Then di2multi(tr, tol = -0.5) 

Emmanuel
-----Original Message-----
From: "Emmanuel Paradis" <emmanuel.paradis at ird.fr>
Sender: r-sig-phylo-bounces at r-project.org
Date: Wed, 28 Sep 2011 14:10:55 
To: Daniel Rafael Miranda-Esquivel<dmiranda at uis.edu.co>; <r-sig-phylo-bounces at r-project.org>; <r-sig-phylo at r-project.org>
Reply-To: emmanuel.paradis at ird.fr
Subject: Re: [R-sig-phylo] Collapsing nodes using node.labels

Hello Daniel,

Try this small manipulation ('tr' is your tree and 'node' stores the label of the node): 

i <- which(tr$node.label == node)
j <- which(tr$edge[, 2] == i + Ntip(tr))
tr$edge.length[j] <- 0

Then di2multi(tr) will do the job. (Hopefully, there's originally no zero-length branch in tr.)

HTH

Emmanuel
-----Original Message-----
From: Daniel Rafael Miranda-Esquivel <dmiranda at uis.edu.co>
Sender: r-sig-phylo-bounces at r-project.org
Date: Wed, 28 Sep 2011 00:21:43 
To: <r-sig-phylo at r-project.org>
Subject: [R-sig-phylo] Collapsing nodes using node.labels

 Hello all,


I am trying to collapse some nodes in a tree but using node.label and
not  edge.length, is there a way to convert  node.label to
edge.length? or a function to collapse a node but using node.label
directly?


Daniel

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

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


More information about the R-sig-phylo mailing list