Hi Liam,

It is fixed and on the SVN:

https://svn.mpl.ird.fr/ape/dev/ape/R/drop.tip.R

Do not hesitate to test it because this function has been written some years ago and has been patched quite a few times.

Thanks for the accurate report.

Emmanuel

On Sat, 20 Nov 2010 15:57:05 -0500
 "Liam J. Revell" <lrev...@nescent.org> wrote:
Hi list.

The following seems to reveal a bug in drop.tip{ape}:

require(geiger)
tr<-read.tree(text="(((A:1.0,B:1.0):1.0,C:2.0):1.0,(D:1.0,E:1.0):2.0);")
plot(drop.tip(tr,c("A","B"),trim.internal=FALSE))
# or, equivalently
write.tree(drop.tip(tr,c("A","B"),trim.internal=FALSE))
# which yields: [1] "((E:1,NA:2):1,(C:1,D:1):2);"

Obviously, the unlabeled topology and branch-lengths are correct, but the tips are mislabeled.

This also seems to affect the subtree=TRUE option.

I discovered that the following work-around seems to "fix" the problem:

tr2<-drop.tip(tr,c("A","B"),trim.internal=FALSE)
# or tr2<-drop.tip(tr,c("A","B"),subtree=TRUE)
tr2$tip.label<-tr2$tip.label[order(tr2$edge[tr2$edge[,2]<=length(tr2$tip.label),2])]
write.tree(tr2)
# which yields [1] "((NA:1,C:2):1,(D:1,E:1):2);" or [1] "((E:1,[2_tips]:2):1,(C:1,D:1):2);" in this case

But I don't know that this will always work. Any suggestions (or a proper fix) are welcome.

Sincerely, Liam

--
Liam J. Revell
NESCent, Duke University
web: http://anolis.oeb.harvard.edu/~liam/
NEW email: lrev...@nescent.org


        [[alternative HTML version deleted]]

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

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

Reply via email to