Hello all,

Recently I noticed a complex function of mine that does some tree
transformations was randomly scrambling node.label elements.

In the course of doing so, I found this old email (below) from Rebecca
Best in 2012, which outlined an issue that occurred when a ladderized
tree had tips dropped. It appears that bug has reappeared  in more
recent version of ape.

Here's a slightly modified version of her example code, which appears
to still replicate a node label shuffling in ape v3.3.

#############################
require(ape)

#read tree
mytree<-read.tree()
((D,(E,G)1)1,((H,J)0.8,(K,(((L,M)0.5,(N,O)0.6)1,(P,(Q,R)1)1)0.7)1)1);

#ladderize tree
mytree.lad<-ladderize(mytree)

#node labels display on both trees correctly
layout(1:2)
plot(mytree,show.node.label=TRUE)
plot(mytree.lad,show.node.label=TRUE)

#drop tips from both trees
drop.mytree<-drop.tip(mytree,c("L","D","G"))
drop.mytree.lad<-drop.tip(mytree.lad,c("L","D","G"))

#plot both trees, node labels are incorrect for ladderized tree
dev.new()
layout(1:2)
plot(drop.mytree,show.node.label=TRUE)
plot(drop.mytree.lad,show.node.label=TRUE)
#############################

Although I'm still in the process of dismantling my own issue, so I am
not 100% certain, I strongly believe this is the culprit in my case,
as my script partly drops.tips from an input tree (that happens to
always be ladderized).

Cheers,
-Dave


---------- Forwarded message ----------
From: Rebecca Best <rjb...@ucdavis.edu>
Date: Tue, Oct 2, 2012 at 12:26 AM
Subject: [R-sig-phylo] ladderize + drop.tip = shuffled node labels
To: r-sig-phylo@r-project.org


Hi all

I have been plotting some pruned trees recently, and have run into a
problem using drop.tip() after ladderize(). If you ladderize() and
then drop tips from the ladderized tree, then at least in my case the
node labels are no longer correct. This may be an unlikely sequence of
commands, but I thought I'd post this in case it is an easy fix, or it
helps anyone else avoid issues.
Thanks!

Rebecca

##

require(ape)

#read tree

mytree<-read.tree()
((D,(E,G)1)1,((H,J)0.8,(K,(((L,M)0.5,(N,O)0.6)1,(P,(Q,R)1)1)0.7)1)1);

#ladderize tree

mytree.lad<-ladderize(mytree)

#node labels display on both trees correctly

plot(mytree,show.node.label=TRUE)
plot(mytree.lad,show.node.label=TRUE)

#drop tips from both trees

drop.mytree<-drop.tip(mytree,c("L","D","G"))
drop.mytree.lad<-drop.tip(mytree.lad,c("L","D","G"))

#plot both trees, node labels are incorrect for ladderized tree

plot(drop.mytree,show.node.label=TRUE)
plot(drop.mytree.lad,show.node.label=TRUE)

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


-- 
David W. Bapst, PhD
Adjunct Asst. Professor, Geology and Geol. Eng.
South Dakota School of Mines and Technology
501 E. St. Joseph
Rapid City, SD 57701

http://webpages.sdsmt.edu/~dbapst/
http://cran.r-project.org/web/packages/paleotree/index.html

_______________________________________________
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