]> git.donarmstrong.com Git - ape.git/blobdiff - man/drop.tip.Rd
new image.DNAbin()
[ape.git] / man / drop.tip.Rd
index 53bc4f097b27a88a5e4fd3c7bb2062d874fac56d..4b4b60e3e496f3c8a9bdf7c2a8b985a69b9b0d52 100644 (file)
@@ -1,9 +1,18 @@
 \name{drop.tip}
 \alias{drop.tip}
+\alias{extract.clade}
 \title{Remove Tips in a Phylogenetic Tree}
+\description{
+  \code{drop.tip} removes the terminal branches of a phylogenetic tree,
+  possibly removing the corresponding internal branches.
+
+  \code{extract.clade} does the inverse operation: it keeps all the tips
+  from a given node, and deletes all the other tips.
+}
 \usage{
 drop.tip(phy, tip, trim.internal = TRUE, subtree = FALSE,
-         root.edge = 0)
+         root.edge = 0, rooted = is.rooted(phy), interactive = FALSE)
+extract.clade(phy, node, root.edge = 0, interactive = FALSE)
 }
 \arguments{
   \item{phy}{an object of class \code{"phylo"}.}
@@ -16,10 +25,12 @@ drop.tip(phy, tip, trim.internal = TRUE, subtree = FALSE,
   \item{root.edge}{an integer giving the number of internal branches to
     be used to build the new root edge. This has no effect if
     \code{trim.internal = FALSE}.}
-}
-\description{
-  This function removes the terminal branches of a phylogenetic tree,
-  possibly removing the corresponding internal branches.
+  \item{rooted}{a logical indicating whether the tree must be treated as
+    rooted or not. This allows to force the tree to be considered as
+    unrooted (see examples).}
+  \item{node}{a node number or label.}
+  \item{interactive}{if \code{TRUE} the user is asked to select the tips
+    or the node by clicking on the tree which must be plotted.}
 }
 \details{
   The argument \code{tip} can be either character or numeric. In the
@@ -27,6 +38,11 @@ drop.tip(phy, tip, trim.internal = TRUE, subtree = FALSE,
   second case the numbers of these labels in the vector
   \code{phy$tip.label} are given.
 
+  This also applies to \code{node}, but if this argument is character
+  and the tree has no node label, this results in an error. If more than
+  one value is given with \code{node} (i.e., a vector of length two or
+  more), only the first one is used with a warning.
+
   If \code{trim.internal = FALSE}, the new tips are given \code{"NA"} as
   labels, unless there are node labels in the tree in which case they
   are used.
@@ -44,7 +60,7 @@ drop.tip(phy, tip, trim.internal = TRUE, subtree = FALSE,
 \value{
   an object of class \code{"phylo"}.
 }
-\author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
+\author{Emmanuel Paradis}
 \seealso{
   \code{\link{bind.tree}}, \code{\link{root}}
 }
@@ -66,9 +82,10 @@ tip <- c(
 plot(drop.tip(bird.families, tip))
 plot(drop.tip(bird.families, tip, trim.internal = FALSE))
 data(bird.orders)
-plot(drop.tip(bird.orders, 6:23, subtree = TRUE), font = 1)
-plot(drop.tip(bird.orders, c(1:5, 20:23), subtree = TRUE), font = 1)
-
+plot(drop.tip(bird.orders, 6:23, subtree = TRUE))
+plot(drop.tip(bird.orders, c(1:5, 20:23), subtree = TRUE))
+plot(drop.tip(bird.orders, c(1:20, 23), subtree = TRUE))
+plot(drop.tip(bird.orders, c(1:20, 23), subtree = TRUE, rooted = FALSE))
 ### Examples of the use of `root.edge'
 tr <- read.tree(text = "(A:1,(B:1,(C:1,(D:1,E:1):1):1):1):1;")
 drop.tip(tr, c("A", "B"), root.edge = 0) # = (C:1,(D:1,E:1):1);