]> git.donarmstrong.com Git - ape.git/blob - man/rotate.Rd
various updates for ape 2.7-2 (fixed)
[ape.git] / man / rotate.Rd
1 \name{rotate}
2 \alias{rotate}
3 \title{Swapping sister clades}
4 \description{
5 For a given node, rotate exchanges the position of two clades descending from this node. It can handle dichotomies as well as polytomies. In the latter case, two clades from the polytomy are selected for swapping.}
6 \usage{
7 rotate(phy, node, polytom = c(1, 2))
8 }
9 \arguments{
10   \item{phy}{an object of class \code{"phylo"}.}
11   \item{node}{a vector of mode numeric or character specifying the number of the node}
12   \item{polytom}{a vector of mode numeric and length two specifying the two clades that should be exchanged in a polytomy}
13 }
14 \details{
15 phy can be either rooted or unrooted, contain polytomies and lack branch lengths. In the presence of very short branch lengths it is convenient to plot the phylogenetic tree without branch lengths in order to identify the number of the node in question.
16
17 node can be any of the interior nodes of a phylogenetic tree including the root node. Number of the nodes can be identified by the nodelabels function. Alternatively, you can specify a vector of length two that contains either the number or the names of two tips that coalesce in the node of interest.
18
19 If the node subtends a polytomy, any two clades of the the polytomy can be chosen by polytom. On a plotted phylogeny, the clades are numbered from bottom to top and polytom is used to index the two clades one likes to swop.
20 }
21 \value{
22 an object of class \code{"phylo"}.
23 }
24 \author{Christoph Heibl \email{heibl@lmu.de}}
25 \seealso{
26         \code{\link{plot.phylo}},
27         \code{\link{nodelabels}},
28         \code{\link{root}},
29         \code{\link{drop.tip}}}
30 \examples{
31 # create a random tree:
32 tre <- rtree(25)
33
34 # visualize labels of internal nodes:
35 plot.phylo(tre, use.edge.length=FALSE)
36 nodelabels()
37
38 # rotate clades around node 30:
39 tre.new <- rotate(tre, 30)
40
41 # compare the results:
42 par(mfrow=c(1,2)) # split graphical device
43 plot(tre) # plot old tre
44 plot(tre.new) # plot new tree
45
46 # visualize labels of terminal nodes:
47 plot.phylo(tre)
48 tiplabels()
49
50 # rotate clades containing nodes 12 and 20:
51 tre.new <- rotate(tre, c(12, 21))
52
53 # compare the results:
54 par(mfrow=c(1,2)) # split graphical device
55 plot(tre) # plot old tre
56 plot(tre.new) # plot new tree
57
58 # or you migth just specify tiplabel names:
59 tre.new <- rotate(tre, c("t3", "t14"))
60
61 # compare the results:
62 par(mfrow=c(1,2)) # devide graphical device
63 plot(tre) # plot old tre
64 plot(tre.new) # plot new tree
65 }
66 \keyword{manip}