Hi Kamila.
The only two tricks I can suggest are:
tree-reorder(reorder(tree,pruningwise))
## or
tree-read.tree(text=write.tree(tree))
Sometimes functions in ape other packages might produce phylo
objects as output that have a nonstandard edge order these steps can
often be used to resolve that issue.
Let us know if this helps. If not, you could send the tree in Newick
format as a text file. You can easily strip the tip numbers if you are
concerned about distributing data in progress, for example:
temp-tree
temp$tip.label-as.character(1:length(tree$tip.label))
## tree 'temp' now has numbers as labels
write.tree(temp,file=filename)
All the best, 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 8/19/2013 10:43 PM, Naxerova, Kamila wrote:
Hi Liam,
thank you so much!
Your answer to 1) is exactly what I wanted to do. My root is not hypothetical, but one of
the samples in my data set. I suppose it would also be possible to root by using this
real root as an outgroup, but it seems a bit counterintuitive, no? Apparently
having an extant root is a bit of an unusual situation? I like the solution you suggested
a lot.
2)
R.Version()
$platform
[1] i386-apple-darwin9.8.0
$arch
[1] i386
$os
[1] darwin9.8.0
ape version 3.0-8
I am not entirely sure what you mean by providing the tree -- it's a tree I
made in ape with nj() on a large distance matrix -- not sure what the best way of sharing
this structure on the list would be? Plotting it with default values is no problem. I
then use nodelabels() to identify which nodes I want to rotate around and say something
like plot(rotate(tree,node)) -- that's when R freezes. I have tried to do the same thing
with random trees generated by rtree, and it worked fine.
Thanks again.
Kamila
On Aug 19, 2013, at 10:12 PM, Liam J. Revell liam.rev...@umb.edu
wrote:
Hi Kamila.
1) A tree stored in memory as an object of class phylo can have a root edge - but no
root label. One option (if your tree has edge lengths) that approximates what it sounds like you
want to do is to re-root the tree 0 distance below the tip that is your root. You can do this using
the function reroot (which uses root internally) from the phytools package. E.g., to re-root the
(random, in this case) tree 'tree' at the tip t10:
library(phytools)
tree-rtree(n=10) ## just for demonstration
nn-which(tree$tip.label==t10) ## get node number of tip
tt-reroot(tree,nn,tree$edge.length[which(tree$edge[,2]==nn)])
plotTree(tt)
2) To better help you with this, can you give us a reproducible error? (E.g.,
your tree, the code that produces the error, your version of R and ape.)
All the best, 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 8/19/2013 9:51 PM, Naxerova, Kamila wrote:
Dear list,
I have just started playing around with ape, and I have some naive newbie
questions. Any help would be very much appreciated.
1) In my data set, the root is extant. Is there a way to directly designate one
of the taxa as the root?
2) When I use the rotate function on what I think is a fairly small and simple
tree, R always freezes and I have to kill it and start over. Any ideas what I
might be doing wrong?
Many thanks in advance.
Kamila
___
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/