Re: [R-sig-phylo] Midpoint root a tree with root() function ape ver 4.0

2016-12-15 Thread Todd Knutson
Hi Klaus, 

Actually, I need to apologize to the community. I was wrong — the midpoint() 
function works perfectly as is!

I had built a little example with dummy data that was confusing me. But, I 
changed my example and now I understand what’s going on. After running the 
midpoint() function, it simply labels both branches on either side of the 
midpoint root with the same support value (which is correct and makes sense). 
In my poor example, I thought this was a bug.

Thank you very much for this function. It’s very useful for my work!
Todd





> On Dec 15, 2016, at 3:22 PM, Klaus Schliep  wrote:
> 
> Hi Knud,
> in phangorn I try to take care that the node labels are assigned to the right 
> nodes after using midpoint, see attached code and pic. It seems to work quite 
> nicely. It would be useful if you could supply a reproducible example or the 
> tree you have problems with and open otherwise an issue on github. 
> Regards, 
> Klaus
> 
>   
> 
> 
> On Thu, Dec 15, 2016 at 9:14 AM, Todd Knutson  > wrote:
> Hi,
> 
> Is there any way to use the updated root() function in ape ver 4.0 to find 
> and set the midpoint root in a tree? I greatly appreciate the updated root() 
> function to include the “edgelabel = TRUE” option, so that when I have 
> bootstrapping support values listed as node labels, they get assigned to the 
> proper edge of the tree after re-rooting.
> 
> However, using the midpoint.root() function from phytools or midpoint() from 
> the phangorn packages alter the node labels after rooting, and the 
> bootstrapping values get assigned to the wrong edges.
> 
> Thus, I would love to use the new root() function, with “edgelabel = TRUE” 
> option enabled, to midpoint a tree. I would appreciate any suggestions.
> 
> Thanks,
> Todd
> ___
> 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/ 
> 
> 
> 
> -- 
> Klaus Schliep
> Postdoctoral Fellow
> Revell Lab, University of Massachusetts Boston
> http://www.phangorn.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
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Midpoint root a tree with root() function ape ver 4.0

2016-12-15 Thread Klaus Schliep
Hi Knud,
in phangorn I try to take care that the node labels are assigned to the
right nodes after using midpoint, see attached code and pic. It seems to
work quite nicely. It would be useful if you could supply a reproducible
example or the tree you have problems with and open otherwise an issue on
github.
Regards,
Klaus




On Thu, Dec 15, 2016 at 9:14 AM, Todd Knutson  wrote:

> Hi,
>
> Is there any way to use the updated root() function in ape ver 4.0 to find
> and set the midpoint root in a tree? I greatly appreciate the updated
> root() function to include the “edgelabel = TRUE” option, so that when I
> have bootstrapping support values listed as node labels, they get assigned
> to the proper edge of the tree after re-rooting.
>
> However, using the midpoint.root() function from phytools or midpoint()
> from the phangorn packages alter the node labels after rooting, and the
> bootstrapping values get assigned to the wrong edges.
>
> Thus, I would love to use the new root() function, with “edgelabel = TRUE”
> option enabled, to midpoint a tree. I would appreciate any suggestions.
>
> Thanks,
> Todd
> ___
> 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-ph...@r-project.org/




-- 
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston
http://www.phangorn.org/
library(phangorn)
library(ape)

data("Laurasiatherian")
tree <- nj(dist.ml(Laurasiatherian))
set.seed(42)
trees <- bootstrap.phyDat(Laurasiatherian, function(x)nj(dist.ml(x)))

tree1 <- plotBS(tree, trees, "phylogram")
pdf("Bootstrap.pdf")
par(mar=c(1,1,1,1))
par(mfrow=c(3,1))
plot(tree1, show.node.label = TRUE)
tree2 <- midpoint(tree1)
plot(tree2, show.node.label = TRUE)
tree$tip.label[43]
tree3 = tree1
# make edge to Cat large
ind = which(tree1$edge[,2]==43)
tree3$edge.length[ind]=.5
tree3 = midpoint(tree3)
plot(tree3, show.node.label = TRUE)
dev.off()


Bootstrap.pdf
Description: Adobe PDF document
___
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/