Browse code

Commit made by the Bioconductor Git-SVN bridge. Consists of 3 commits.

Commit information:

Commit id: cd270be7dff4e811297283d7cd5da2826d4c60aa

update news

Committed by: GuangchuangYu
Author Name: GuangchuangYu
Commit date: 2015-02-04 16:24:25 +0800
Author date: 2015-02-04 16:24:25 +0800

Commit id: 240a0ebc95b76ce091f0c59c95d53db841127493

gzoom methods

Committed by: GuangchuangYu
Author Name: GuangchuangYu
Commit date: 2015-02-04 16:23:19 +0800
Author date: 2015-02-04 16:23:19 +0800

Commit id: 55f42d1fa0d7bcddc8cf8bcdcff87f887b215acf

geom_hilight

Committed by: GuangchuangYu
Author Name: GuangchuangYu
Commit date: 2015-02-04 15:54:42 +0800
Author date: 2015-02-04 15:54:42 +0800


git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@99033 bc3139a8-67e5-0310-9ffc-ced21a209358

g.yu authored on 04/02/2015 08:24:48
Showing 21 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: ggtree
2 2
 Type: Package
3 3
 Title: a phylogenetic tree viewer for different types of tree annotations
4
-Version: 0.99.11
4
+Version: 0.99.12
5 5
 Author: Guangchuang Yu
6 6
 Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
7 7
 Description: ggtree extends the ggplot2 plotting system which implemented the
... ...
@@ -16,6 +16,7 @@ export(.)
16 16
 export(aes)
17 17
 export(as.binary)
18 18
 export(geom_aline)
19
+export(geom_hilight)
19 20
 export(geom_text)
20 21
 export(geom_tiplab)
21 22
 export(geom_tippoint)
... ...
@@ -62,6 +63,7 @@ exportMethods(get.tree)
62 63
 exportMethods(get.treeinfo)
63 64
 exportMethods(get.treetext)
64 65
 exportMethods(groupOTU)
66
+exportMethods(gzoom)
65 67
 exportMethods(plot)
66 68
 exportMethods(scale_color)
67 69
 exportMethods(show)
... ...
@@ -1,3 +1,9 @@
1
+CHANGES IN VERSION 0.99.12
2
+------------------------
3
+ o update vignette <2015-02-04, Wed>
4
+ o gzoom methods that supports all tree objects <2015-02-04, Wed>
5
+ o geom_hilight layer for highlighting clade <2015-02-04, Wed> 
6
+ 
1 7
 CHANGES IN VERSION 0.99.11
2 8
 ------------------------
3 9
  o add scale_color to support colored lines and text based on numerical values and update vignette <2015-02-04, Wed>
... ...
@@ -126,3 +126,14 @@ setGeneric("groupOTU", function(object, focus) standardGeneric("groupOTU"))
126 126
 ##' @export
127 127
 setGeneric("scale_color", function(object, by, ...) standardGeneric("scale_color"))
128 128
 
129
+##' @docType methods
130
+##' @name gzoom
131
+##' @rdname gzoom-methods
132
+##' @title gzoom method
133
+##' @param object supported tree objects
134
+##' @param focus selected tips
135
+##' @param subtree logical
136
+##' @param widths widths
137
+##' @return figure
138
+##' @export
139
+setGeneric("gzoom", function(object, focus, subtree=FALSE, widths=c(.3, .7)) standardGeneric("gzoom"))
... ...
@@ -97,6 +97,13 @@ setMethod("scale_color", signature(object="beast"),
97 97
           })
98 98
 
99 99
 
100
+##' @rdname gzoom-methods
101
+##' @exportMethod gzoom
102
+setMethod("gzoom", signature(object="beast"),
103
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
104
+              gzoom.phylo(get.tree(object), focus, subtree, widths)
105
+          })
106
+
100 107
 ##' get.tree method
101 108
 ##'
102 109
 ##'
... ...
@@ -133,6 +140,7 @@ read.treetext_beast <- function(file) {
133 140
         tree <- paste0(tree)
134 141
     }
135 142
     tree %<>% sub("tree TREE1\\s+=\\s+\\[&R\\]\\s+", "", .)
143
+    tree %<>% sub("[^(]*", "", .)
136 144
     return(tree)
137 145
 }
138 146
 
... ...
@@ -38,6 +38,13 @@ setMethod("scale_color", signature(object="codeml"),
38 38
           })
39 39
 
40 40
 
41
+##' @rdname gzoom-methods
42
+##' @exportMethod gzoom
43
+setMethod("gzoom", signature(object="codeml"),
44
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
45
+              gzoom.phylo(get.tree(object), focus, subtree, widths)
46
+          })
47
+
41 48
 ##' @rdname show-methods
42 49
 ##' @exportMethod show
43 50
 setMethod("show", signature(object = "codeml"),
... ...
@@ -23,6 +23,14 @@ read.codeml_mlc <- function(mlcfile) {
23 23
         mlcfile  = mlcfile)
24 24
 }
25 25
 
26
+
27
+##' @rdname gzoom-methods
28
+##' @exportMethod gzoom
29
+setMethod("gzoom", signature(object="codeml_mlc"),
30
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
31
+              gzoom.phylo(get.tree(object), focus, subtree, widths)
32
+          })
33
+
26 34
 ##' @rdname groupOTU-methods
27 35
 ##' @exportMethod groupOTU
28 36
 setMethod("groupOTU", signature(object="codeml_mlc"),
... ...
@@ -69,7 +69,7 @@ ggtree <- function(tr, showDistance=FALSE, layout="phylogram", ...) {
69 69
 ##' tr <- rtree(10)
70 70
 ##' require(ggplot2)
71 71
 ##' ggplot(tr) + geom_tree()
72
-geom_tree <- function(layout="phylogram", color="black", linetype="solid", size=1, ...) {
72
+geom_tree <- function(layout="phylogram", color="black", linetype="solid", size=0.5, ...) {
73 73
     x <- y <- parent <- NULL
74 74
     if (layout == "phylogram" || layout == "fan") {
75 75
         if (length(color) != 1) {
... ...
@@ -86,17 +86,41 @@ geom_tree <- function(layout="phylogram", color="black", linetype="solid", size=
86 86
                          y    = c(y,         y[parent]),
87 87
                          yend = c(y,         y)),
88 88
                      color = color,
89
-                     linetype = linetype, ...)
89
+                     linetype = linetype,
90
+                     size = size, ...)
90 91
     } else if (layout == "cladogram" || layout == "unrooted") {
91 92
         geom_segment(aes(x    = x[parent],
92 93
                          xend = x,
93 94
                          y    = y[parent],
94 95
                          yend = y),
95 96
                      color = color,
96
-                     linetype = linetype, ...)
97
+                     linetype = linetype,
98
+                     size = size, ...)
97 99
     }
98 100
 }
99 101
 
102
+##' hilight clade with rectangle
103
+##'
104
+##' 
105
+##' @title geom_hilight 
106
+##' @param tree_object supported tree object
107
+##' @param node internal node
108
+##' @param ... additional parameters
109
+##' @return ggplot layer
110
+##' @importFrom ape extract.clade
111
+##' @export
112
+##' @author Guangchuang Yu
113
+geom_hilight <- function(tree_object, node, ...) {
114
+    clade <- extract.clade(get.tree(tree_object), node)
115
+    idx <- groupOTU(tree_object, clade$tip.label)
116
+    dd <- fortify(tree_object)
117
+    x <- dd[idx == 2, "x"]
118
+    y <- dd[idx == 2, "y"]
119
+    annotate("rect", xmin=min(x)-dd[node, "branch.length"]/2,
120
+             xmax=max(x), ymin=min(y)-0.5, ymax=max(y)+0.5, ...)
121
+}
122
+
123
+
100 124
 ##' add tip label layer
101 125
 ##'
102 126
 ##' 
... ...
@@ -104,6 +104,14 @@ setMethod("scale_color", signature(object="hyphy"),
104 104
               scale_color_(object, by, ...)
105 105
           })
106 106
 
107
+
108
+##' @rdname gzoom-methods
109
+##' @exportMethod gzoom
110
+setMethod("gzoom", signature(object="hyphy"),
111
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
112
+              gzoom.phylo(get.tree(object), focus, subtree, widths)
113
+          })
114
+
107 115
 ##' @rdname show-methods
108 116
 ##' @exportMethod show
109 117
 setMethod("show", signature(object = "hyphy"),
... ...
@@ -60,6 +60,14 @@ read.paml_rst <- function(rstfile, tip.fasfile = NULL) {
60 60
     set.paml_rst_(res)
61 61
 }
62 62
 
63
+
64
+##' @rdname gzoom-methods
65
+##' @exportMethod gzoom
66
+setMethod("gzoom", signature(object="paml_rst"),
67
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
68
+              gzoom.phylo(get.tree(object), focus, subtree, widths)
69
+          })
70
+
63 71
 ##' @rdname groupOTU-methods
64 72
 ##' @exportMethod groupOTU
65 73
 setMethod("groupOTU", signature(object="paml_rst"),
66 74
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+##' @rdname get.tree-methods
2
+##' @exportMethod get.tree
3
+setMethod("get.tree", signature(object="phylo"),
4
+          function(object, ...) {
5
+              return(object)
6
+          })
7
+
8
+##' @rdname scale_color-methods
9
+##' @exportMethod scale_color
10
+setMethod("scale_color", signature(object="phylo"),
11
+          function(object, by, ...) {
12
+              scale_color_(object, by, ...)
13
+          })
14
+
15
+
16
+##' @rdname groupOTU-methods
17
+##' @exportMethod groupOTU
18
+setMethod("groupOTU", signature(object="phylo"),
19
+          function(object, focus) {
20
+              groupOTU.phylo(object, focus)
21
+          })
22
+
23
+
24
+##' group OTU
25
+##'
26
+##' 
27
+##' @title groupOTU.phylo
28
+##' @param phy tree object
29
+##' @param focus tip list
30
+##' @return cluster index
31
+##' @author ygc
32
+groupOTU.phylo <- function(phy, focus) {
33
+    if ( is(focus, "list") ) {
34
+        for (i in 1:length(focus)) {
35
+            phy <- gfocus(phy, focus[[i]])
36
+        } 
37
+    } else {
38
+        phy <- gfocus(phy, focus)
39
+    }
40
+    attr(phy, "focus")
41
+}
42
+
43
+
44
+##' @rdname gzoom-methods
45
+##' @exportMethod gzoom
46
+setMethod("gzoom", signature(object="phylo"),
47
+          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
48
+              gzoom.phylo(object, focus, subtree, widths)
49
+          })
... ...
@@ -1,9 +1,3 @@
1
-##' @rdname scale_color-methods
2
-##' @exportMethod scale_color
3
-setMethod("scale_color", signature(object="phylo"),
4
-          function(object, by, ...) {
5
-              scale_color_(object, by, ...)
6
-          })
7 1
 
8 2
 ##' @importFrom colorspace rainbow_hcl
9 3
 scale_color_ <- function(phylo, by, low=NULL, high=NULL, na.color=NULL, default.color="grey") {
... ...
@@ -18,12 +12,8 @@ scale_color_ <- function(phylo, by, low=NULL, high=NULL, na.color=NULL, default.
18 12
     idx <- sapply(vals, getIdx, min(vals, na.rm=TRUE), max(vals, na.rm=TRUE))
19 13
     df$color <- cols[idx]
20 14
 
21
-    if ( is(phylo, "phylo")) {
22
-        tree <- phylo
23
-    } else {
24
-        tree <- get.tree(phylo)
25
-    }
26
-
15
+    tree <- get.tree(phylo)
16
+    
27 17
     if (is.null(na.color)) {
28 18
         nodes <- getNodes_by_postorder(tree)
29 19
         for (curNode in nodes) {
... ...
@@ -52,37 +42,10 @@ scale_color_ <- function(phylo, by, low=NULL, high=NULL, na.color=NULL, default.
52 42
 }
53 43
 
54 44
 
55
-##' @rdname groupOTU-methods
56
-##' @exportMethod groupOTU
57
-setMethod("groupOTU", signature(object="phylo"),
58
-          function(object, focus) {
59
-              groupOTU.phylo(object, focus)
60
-          })
61
-
62
-
63 45
 groupOTU_ <- function(object, focus) {
64 46
     groupOTU.phylo(get.tree(object), focus)
65 47
 }
66 48
 
67
-##' group OTU
68
-##'
69
-##' 
70
-##' @title groupOTU.phylo
71
-##' @param phy tree object
72
-##' @param focus tip list
73
-##' @return cluster index
74
-##' @author ygc
75
-groupOTU.phylo <- function(phy, focus) {
76
-    if ( is(focus, "list") ) {
77
-        for (i in 1:length(focus)) {
78
-            phy <- gfocus(phy, focus[[i]])
79
-        } 
80
-    } else {
81
-        phy <- gfocus(phy, focus)
82
-    }
83
-    attr(phy, "focus")
84
-}
85
-
86 49
 ##' @importFrom ape which.edge
87 50
 gfocus <- function(phy, focus) {
88 51
     if (is.character(focus)) {
... ...
@@ -121,13 +84,12 @@ gfocus <- function(phy, focus) {
121 84
 ##' @importFrom ggplot2 xlim
122 85
 ##' @importFrom ggplot2 scale_color_manual
123 86
 ##' @importFrom ape drop.tip
124
-##' @export
125 87
 ##' @author ygc
126 88
 ##' @examples
127 89
 ##' require(ape)
128 90
 ##' data(chiroptera)
129 91
 ##' gzoom(chiroptera, grep("Plecotus", chiroptera$tip.label))
130
-gzoom <- function(phy, focus, subtree=FALSE, widths=c(.3, .7)) {
92
+gzoom.phylo <- function(phy, focus, subtree=FALSE, widths=c(.3, .7)) {
131 93
     if (is.character(focus)) {
132 94
         focus <- which(phy$tip.label %in% focus)
133 95
     }
... ...
@@ -136,9 +98,8 @@ gzoom <- function(phy, focus, subtree=FALSE, widths=c(.3, .7)) {
136 98
 
137 99
     foc <- attr(phy, "focus")
138 100
     cols <- c("black", "red")[foc]
139
-    
140
-    p1 <- ggplot(phy) + geom_tree(colour=cols) +
141
-        xlab("") + ylab("") + theme_tree()
101
+
102
+    p1 <- ggtree(phy, color=cols)
142 103
     
143 104
     subtr <- drop.tip(phy, phy$tip.label[-focus],
144 105
                       subtree=subtree, rooted=TRUE)
145 106
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+% Generated by roxygen2 (4.1.0): do not edit by hand
2
+% Please edit documentation in R/ggtree.R
3
+\name{geom_hilight}
4
+\alias{geom_hilight}
5
+\title{geom_hilight}
6
+\usage{
7
+geom_hilight(tree_object, node, ...)
8
+}
9
+\arguments{
10
+\item{tree_object}{supported tree object}
11
+
12
+\item{node}{internal node}
13
+
14
+\item{...}{additional parameters}
15
+}
16
+\value{
17
+ggplot layer
18
+}
19
+\description{
20
+hilight clade with rectangle
21
+}
22
+\author{
23
+Guangchuang Yu
24
+}
25
+
... ...
@@ -5,7 +5,7 @@
5 5
 \title{geom_tree}
6 6
 \usage{
7 7
 geom_tree(layout = "phylogram", color = "black", linetype = "solid",
8
-  size = 1, ...)
8
+  size = 0.5, ...)
9 9
 }
10 10
 \arguments{
11 11
 \item{layout}{one of phylogram, cladogram}
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2 (4.1.0): do not edit by hand
2
-% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R
2
+% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R, R/phylo.R
3 3
 \docType{methods}
4 4
 \name{get.tree}
5 5
 \alias{get.tree}
... ...
@@ -9,6 +9,7 @@
9 9
 \alias{get.tree,hyphy-method}
10 10
 \alias{get.tree,jplace-method}
11 11
 \alias{get.tree,paml_rst-method}
12
+\alias{get.tree,phylo-method}
12 13
 \title{get.tree method}
13 14
 \usage{
14 15
 get.tree(object, ...)
... ...
@@ -24,6 +25,8 @@ get.tree(object, ...)
24 25
 \S4method{get.tree}{jplace}(object)
25 26
 
26 27
 \S4method{get.tree}{paml_rst}(object)
28
+
29
+\S4method{get.tree}{phylo}(object, ...)
27 30
 }
28 31
 \arguments{
29 32
 \item{object}{one of \code{jplace}, \code{beast} object}
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2 (4.1.0): do not edit by hand
2
-% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R, R/tree.R
2
+% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R, R/phylo.R
3 3
 \docType{methods}
4 4
 \name{groupOTU}
5 5
 \alias{groupOTU}
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2 (4.1.0): do not edit by hand
2
-% Please edit documentation in R/tree.R
2
+% Please edit documentation in R/phylo.R
3 3
 \name{groupOTU.phylo}
4 4
 \alias{groupOTU.phylo}
5 5
 \title{groupOTU.phylo}
6 6
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+% Generated by roxygen2 (4.1.0): do not edit by hand
2
+% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/paml_rst.R, R/phylo.R
3
+\docType{methods}
4
+\name{gzoom}
5
+\alias{gzoom}
6
+\alias{gzoom,beast-method}
7
+\alias{gzoom,codeml-method}
8
+\alias{gzoom,codeml_mlc-method}
9
+\alias{gzoom,hyphy-method}
10
+\alias{gzoom,paml_rst-method}
11
+\alias{gzoom,phylo-method}
12
+\title{gzoom method}
13
+\usage{
14
+gzoom(object, focus, subtree = FALSE, widths = c(0.3, 0.7))
15
+
16
+\S4method{gzoom}{beast}(object, focus, subtree = FALSE, widths = c(0.3,
17
+  0.7))
18
+
19
+\S4method{gzoom}{codeml}(object, focus, subtree = FALSE, widths = c(0.3,
20
+  0.7))
21
+
22
+\S4method{gzoom}{codeml_mlc}(object, focus, subtree = FALSE, widths = c(0.3,
23
+  0.7))
24
+
25
+\S4method{gzoom}{hyphy}(object, focus, subtree = FALSE, widths = c(0.3,
26
+  0.7))
27
+
28
+\S4method{gzoom}{paml_rst}(object, focus, subtree = FALSE, widths = c(0.3,
29
+  0.7))
30
+
31
+\S4method{gzoom}{phylo}(object, focus, subtree = FALSE, widths = c(0.3,
32
+  0.7))
33
+}
34
+\arguments{
35
+\item{object}{supported tree objects}
36
+
37
+\item{focus}{selected tips}
38
+
39
+\item{subtree}{logical}
40
+
41
+\item{widths}{widths}
42
+}
43
+\value{
44
+figure
45
+}
46
+\description{
47
+gzoom method
48
+}
49
+
0 50
similarity index 82%
1 51
rename from man/gzoom.Rd
2 52
rename to man/gzoom.phylo.Rd
... ...
@@ -1,10 +1,10 @@
1 1
 % Generated by roxygen2 (4.1.0): do not edit by hand
2 2
 % Please edit documentation in R/tree.R
3
-\name{gzoom}
4
-\alias{gzoom}
3
+\name{gzoom.phylo}
4
+\alias{gzoom.phylo}
5 5
 \title{gzoom}
6 6
 \usage{
7
-gzoom(phy, focus, subtree = FALSE, widths = c(0.3, 0.7))
7
+gzoom.phylo(phy, focus, subtree = FALSE, widths = c(0.3, 0.7))
8 8
 }
9 9
 \arguments{
10 10
 \item{phy}{phylo object}
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2 (4.1.0): do not edit by hand
2
-% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R, R/tree.R
2
+% Please edit documentation in R/AllGenerics.R, R/beast.R, R/codeml.R, R/codeml_mlc.R, R/hyphy.R, R/jplace.R, R/paml_rst.R, R/phylo.R
3 3
 \docType{methods}
4 4
 \name{scale_color}
5 5
 \alias{scale_color}
... ...
@@ -533,6 +533,30 @@ library("ggtree")
533 533
 gzoom(chiroptera, grep("Plecotus", chiroptera$tip.label))
534 534
 ```
535 535
 
536
+## highlight clade
537
+
538
+`r Githubpkg("GuangchuangYu/ggtree")` implements _`geom_hilight`_ layer, that accepts tree object and internal node number and add a layer of rectangle to hilight the selected clade.
539
+
540
+```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE}
541
+nwk <- system.file("extdata", "sample.nwk", package="ggtree")
542
+tree <- read.tree(nwk)
543
+
544
+ggtree(tree) + geom_text(aes(label=node))
545
+```
546
+
547
+User can use _`geom_text`_ to display all the node numbers, and select interesting clade to hilight.
548
+
549
+```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE}
550
+ggtree(tree) + geom_hilight(tree, node=21, fill="steelblue", alpha=.6) +
551
+     geom_hilight(tree, node=17, fill="darkgreen", alpha=.6)
552
+```
553
+
554
+
555
+```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE}
556
+ggtree(tree, layout="fan") + geom_hilight(tree, node=21, fill="steelblue", alpha=.6) +
557
+     geom_hilight(tree, node=17, fill="darkgreen", alpha=.6)
558
+```
559
+
536 560
 ## scale color based on numerical attribute
537 561
 
538 562
 `r Githubpkg("GuangchuangYu/ggtree")` provides _`scale_color`_ to calculate colors based on numerical attribute of the tree. The output can be used to color lines and annotation text.
... ...
@@ -553,10 +577,6 @@ ggtree(ml, color=cols) + geom_text(aes(label=label), color=cols, hjust=.25)
553 577
 `r Githubpkg("GuangchuangYu/ggtree")` provides _`groupOTU`_ function to group tips and all their related ancestors. It return a cluster index of each line segment in the tree view.
554 578
 
555 579
 ```{r}
556
-nwk <- system.file("extdata", "sample.nwk", package="ggtree")
557
-tree <- read.tree(nwk)
558
-
559
-
560 580
 cluster_index <- groupOTU(tree, focus=c("A", "B", "C", "D", "E"))
561 581
 cluster_index
562 582
 ```
... ...
@@ -597,12 +617,6 @@ ggtree(tree, color=cols[cls_ind], linetype=linetype[cls_ind], size=size[cls_ind]
597 617
 
598 618
 All the tree classes defined in `r Githubpkg("GuangchuangYu/ggtree")`, including _`beast`_, _`paml_rst`_, _`codeml_mlc`_, _`codeml`_, _`hyphy`_ and _`jplace`_ are all supported.
599 619
 
600
-For example:
601
-```{r fig.width=5, fig.height=5, fig.align="center", warning=FALSE}
602
-ind <- groupOTU(ml, c("A", "B", "F", "M"))
603
-cols <- c("black", "blue")
604
-ggtree(ml, color=cols[ind])
605
-```
606 620
 
607 621
 ### iris example
608 622
 
... ...
@@ -623,11 +637,9 @@ ggtree(tree_iris, color=cols[cls_ind]) +
623 637
 ```
624 638
 
625 639
 <!--
626
-```
627
-ggtree(tree_iris) + geom_text(aes(label=node))
628
-```
629 640
 By adding a layer of internal node number, we can easily extract tip labels of a particular clade by the _`get.offspring.tip`_ function.
630 641
 ```{r}
642
+ggtree(tree_iris) + geom_text(aes(label=node))
631 643
 cl1 <- get.offspring.tip(tree_iris, 242)
632 644
 cl2 <- get.offspring.tip(tree_iris, 152) 
633 645
 cl2 <- cl2[!cl2 %in% cl1]