Browse code

now mapping parameter will passed to segment layer in geom_tiplab(align=T) <2017-06-19, Mon>

guangchuang yu authored on 19/06/2017 13:28:29
Showing 13 changed files

... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES IN VERSION 1.9.1
2 2
 ------------------------
3
+ o now mapping parameter will passed to segment layer in geom_tiplab(align=T) <2017-06-19, Mon>
3 4
  o geom_cladelabel support `angle="auto"` for circular layout tree <2017-05-05, Fri>
4 5
 
5 6
 CHANGES IN VERSION 1.8.0
6 7
deleted file mode 100644
... ...
@@ -1,281 +0,0 @@
1
-
2
-## ##' read beast output
3
-## ##'
4
-## ##'
5
-## ##' @title read.beast
6
-## ##' @param file beast file
7
-## ##' @return \code{beast} object
8
-## ##' @importFrom ape read.nexus
9
-## ##' @export
10
-## ##' @author Guangchuang Yu \url{http://ygc.name}
11
-## ##' @examples
12
-## ##' file <- system.file("extdata/BEAST", "beast_mcc.tree", package="ggtree")
13
-## ##' read.beast(file)
14
-## read.beast <- function(file) {
15
-##     translation <- read.trans_beast(file)
16
-##     treetext <- read.treetext_beast(file)
17
-##     stats <- read.stats_beast(file)
18
-##     phylo <- read.nexus(file)
19
-
20
-##     if (length(treetext) == 1) {
21
-##         obj <- BEAST(file, treetext, translation, stats, phylo)
22
-##     } else {
23
-##         obj <- lapply(seq_along(treetext), function(i) {
24
-##             BEAST(file, treetext[i], translation, stats[[i]], phylo[[i]])
25
-##         })
26
-##         class(obj) <- "beastList"
27
-##     }
28
-##     return(obj)
29
-## }
30
-
31
-
32
-## BEAST <- function(file, treetext, translation, stats, phylo) {
33
-##     stats$node %<>% gsub("\"*'*", "", .)
34
-
35
-##     fields <- sub("_lower|_upper", "", names(stats)) %>% unique
36
-##     fields %<>% `[`(.!="node")
37
-
38
-##     phylo <- remove_quote_in_tree_label(phylo)
39
-
40
-##     obj <- new("beast",
41
-##                fields      = fields,
42
-##                treetext    = treetext,
43
-##                phylo       = phylo,
44
-##                translation = translation,
45
-##                stats       = stats,
46
-##                file        = filename(file)
47
-##                )
48
-##     return(obj)
49
-## }
50
-
51
-## remove_quote_in_tree_label <- function(phylo) {
52
-##     if (!is.null(phylo$node.label)) {
53
-##         phylo$node.label %<>% gsub("\"*'*", "", .)
54
-##     }
55
-##     if ( !is.null(phylo$tip.label)) {
56
-##         phylo$tip.label %<>% gsub("\"*'*", "", .)
57
-##     }
58
-##     return(phylo)
59
-## }
60
-
61
-
62
-## ##' @rdname get.fields-methods
63
-## ##' @exportMethod get.fields
64
-## setMethod("get.fields", signature(object="beast"),
65
-##           function(object, ...) {
66
-##               get.fields.tree(object)
67
-##           }
68
-##           )
69
-
70
-
71
-## read.treetext_beast <- function(file) {
72
-##     beast <- readLines(file)
73
-
74
-##     ii <- grep("[Bb]egin trees;", beast)
75
-##     jj <- grep("[Ee]nd;", beast)
76
-##     jj <- jj[jj > max(ii)][1]
77
-##     jj <- c(ii[-1], jj)
78
-
79
-##     trees <- sapply(seq_along(ii), function(i) {
80
-##         tree <- beast[(ii[i]+1):(jj[i]-1)]
81
-##         tree <- tree[grep("\\s*[Tt]ree", tree)]
82
-##         ## if (length(tree) > 1) {
83
-##         ##     tree <- paste0(tree, collapse='')
84
-##         ## }
85
-##         sub("[^(]*", "", tree)
86
-##     })
87
-
88
-##     return(trees)
89
-## }
90
-
91
-## read.trans_beast <- function(file) {
92
-##     beast <- readLines(file)
93
-##     i <- grep("TRANSLATE", beast, ignore.case = TRUE)
94
-##     if (length(i) == 0) {
95
-##         return(matrix())
96
-##     }
97
-##     end <- grep(";", beast)
98
-##     j <- end[end %>% `>`(i) %>% which %>% `[`(1)]
99
-##     trans <- beast[(i+1):j]
100
-##     trans %<>% gsub("\\t+", "", .)
101
-##     trans %<>% gsub(",|;", "", .)
102
-##     trans %<>% `[`(nzchar(trans))
103
-##     ## remove quote if strings were quoted
104
-##     trans %<>% gsub("'|\"", "",.)
105
-##     trans %<>% sapply(., strsplit, split="\\s+")
106
-##     trans %<>% do.call(rbind, .)
107
-##     ## trans is a matrix
108
-##     return(trans)
109
-## }
110
-
111
-
112
-## read.stats_beast <- function(file) {
113
-##     beast <- readLines(file)
114
-##     trees <- read.treetext_beast(file)
115
-##     if (length(trees) == 1) {
116
-##         return(read.stats_beast_internal(beast, trees))
117
-##     }
118
-##     lapply(trees, read.stats_beast_internal, beast=beast)
119
-## }
120
-
121
-## read.stats_beast_internal <- function(beast, tree) {
122
-##     tree2 <- gsub("\\[[^\\[]*\\]", "", tree)
123
-##     phylo <- read.tree(text = tree2)
124
-
125
-##     tree2 <- add_pseudo_nodelabel(phylo, tree2)
126
-
127
-##     ## node name corresponding to stats
128
-##     nn <- strsplit(tree2, split=",") %>% unlist %>%
129
-##         strsplit(., split="\\)") %>% unlist %>%
130
-##         gsub("\\(*", "", .) %>%
131
-##         gsub("[:;].*", "", .)
132
-
133
-##     phylo <- read.tree(text = tree2)
134
-##     root <- getRoot(phylo)
135
-##     nnode <- phylo$Nnode
136
-
137
-##     ## phylo2 <- read.nexus(file)
138
-##     ## treeinfo <- fortify.phylo(phylo)
139
-##     ## treeinfo2 <- fortify.phylo(phylo2)
140
-##     ## treeinfo$label2 <- NA
141
-##     ## treeinfo$label2[treeinfo$isTip] <- treeinfo2$node[as.numeric(treeinfo$label[treeinfo$isTip])]
142
-##     ## treeinfo$visited <- FALSE
143
-##     ## root <- getRoot(phylo2)
144
-##     ## treeinfo[root, "visited"] <- TRUE
145
-##     ## currentNode <- 1:Ntip(phylo2)
146
-##     ## while(any(treeinfo$visited == FALSE)) {
147
-##     ##     pNode <- c()
148
-##     ##     for (kk in currentNode) {
149
-##     ##         i <- which(treeinfo$label2 == kk)
150
-##     ##         treeinfo[i, "visited"] <- TRUE
151
-##     ##         j <- which(treeinfo2$node == kk)
152
-##     ##         ip <- treeinfo$parent[i]
153
-##     ##         if (ip != root) {
154
-##     ##             ii <- which(treeinfo$node == ip)
155
-##     ##             if (treeinfo$visited[ii] == FALSE) {
156
-##     ##                 jp <- treeinfo2$parent[j]
157
-##     ##                 jj <- which(treeinfo2$node == jp)
158
-##     ##                 treeinfo[ii, "label2"] <- treeinfo2[jj, "node"]
159
-##     ##                 pNode <- c(pNode, jp)
160
-##     ##             }
161
-##     ##             treeinfo[ii, "visited"] <- TRUE
162
-##     ##         }
163
-##     ##     }
164
-##     ##     currentNode <- unique(pNode)
165
-##     ## }
166
-##     ## treeinfo[root, "label2"] <- root
167
-##     ## ## convert nn to node that encoded in phylo2
168
-##     ## node <- treeinfo$label2[match(nn, treeinfo$label)]
169
-
170
-
171
-##     ####################################################
172
-##     ##                                                ##
173
-##     ##  after doing it in the hard way                ##
174
-##     ##  I finally figure out the following easy way   ##
175
-##     ##                                                ##
176
-##     ####################################################
177
-##     treeinfo <- fortify.phylo(phylo)
178
-
179
-##     if (any(grepl("TRANSLATE", beast, ignore.case = TRUE))) {
180
-##         label2 <- c(treeinfo[treeinfo$isTip, "label"],
181
-##                     root:(root+nnode-1))
182
-##         node <- label2[match(nn, treeinfo$label)]
183
-##     } else {
184
-##         node <- as.character(treeinfo$node[match(nn, treeinfo$label)])
185
-##     }
186
-
187
-##     ## stats <- unlist(strsplit(tree, "\\["))[-1]
188
-##     ## stats <- sub(":.+$", "", stats
189
-##     stats <- strsplit(tree, ":") %>% unlist
190
-##     names(stats) <- node
191
-##     stats <- stats[grep("\\[", stats)]
192
-##     stats <- sub("[^\\[]+\\[", "", stats)
193
-
194
-##     stats <- sub("^&", "", stats)
195
-##     stats <- sub("];*$", "", stats)
196
-
197
-##     stats2 <- lapply(stats, function(x) {
198
-##         y <- unlist(strsplit(x, ","))
199
-##         sidx <- grep("=\\{", y)
200
-##         eidx <- grep("\\}$", y)
201
-
202
-##         flag <- FALSE
203
-##         if (length(sidx) > 0) {
204
-##             flag <- TRUE
205
-##             SETS <- sapply(seq_along(sidx), function(k) {
206
-##                 p <- y[sidx[k]:eidx[k]]
207
-##                 gsub(".*=\\{", "", p) %>% gsub("\\}$", "", .) %>% list
208
-##             })
209
-##             names(SETS) <- gsub("=.*", "", y[sidx])
210
-
211
-##             kk <- sapply(seq_along(sidx), function(k) sidx[k]:eidx[k]) %>% unlist
212
-##             y <- y[-kk]
213
-##         }
214
-
215
-
216
-##         name <- gsub("=.*", "", y)
217
-##         val <- gsub(".*=", "", y) %>% gsub("^\\{", "", .) %>%
218
-##             gsub("\\}$", "", .)
219
-
220
-
221
-##         if (flag) {
222
-##             nn <- c(name, names(SETS))
223
-##         } else {
224
-##             nn <- name
225
-##         }
226
-
227
-##         res <- character(length(nn))
228
-##         names(res) <- nn
229
-
230
-##         for (i in seq_along(name)) {
231
-##             res[i] <- val[i]
232
-##         }
233
-##         if (flag) {
234
-##             j <- i
235
-##             for (i in seq_along(SETS)) {
236
-##                 res[i+j] <- SETS[i]
237
-##             }
238
-##         }
239
-
240
-##         return(res)
241
-##     })
242
-
243
-##     nn <- lapply(stats2, names) %>% unlist %>%
244
-##         unique %>% sort
245
-
246
-##     ## stats3 is a matrix
247
-##     stats3 <- t(sapply(stats2, function(x) {
248
-##         for (ii in nn[!nn %in% names(x)]) {
249
-##             x[ii] <- NA
250
-##         }
251
-##         x[nn]
252
-##     }))
253
-
254
-##     stats3 <- as.data.frame(stats3)
255
-##     if (nrow(stats3) == 1) {
256
-##         ## only has one evidence
257
-##         ## transpose
258
-##         stats3 <- data.frame(X=unlist(stats3[1,]))
259
-##         colnames(stats3) <- nn
260
-##     }
261
-##     colnames(stats3) <- gsub("(\\d+)%", "0.\\1", colnames(stats3))
262
-
263
-##     ## stats3$node <- node
264
-##     stats3$node <- names(stats)
265
-##     return(stats3)
266
-## }
267
-
268
-## add_pseudo_nodelabel <- function(phylo, treetext) {
269
-##     if(is.null(phylo$node.label)) {
270
-##         nnode <- phylo$Nnode
271
-##         nlab <- paste("X", 1:nnode, sep="")
272
-##         for (i in 1:nnode) {
273
-##             treetext <- sub("\\)([:;])", paste0("\\)", nlab[i], "\\1"), treetext)
274
-##         }
275
-##     }
276
-
277
-##    return(treetext)
278
-## }
279
-
280
-
281
-
... ...
@@ -18,7 +18,7 @@
18 18
 ##' require(ape)
19 19
 ##' tr <- rtree(10)
20 20
 ##' ggtree(tr) + geom_tiplab()
21
-geom_tiplab <- function(mapping=NULL, hjust = 0,  align = FALSE, linetype = "dotted", linesize=1, geom="text", offset = 0, ...) {
21
+geom_tiplab <- function(mapping=NULL, hjust = 0,  align = FALSE, linetype = "dotted", linesize=1, geom="text",  offset=0, ...) {
22 22
     geom <- match.arg(geom, c("text", "label"))
23 23
     if (geom == "text") {
24 24
         text_geom <- geom_text2
... ...
@@ -43,6 +43,12 @@ geom_tiplab <- function(mapping=NULL, hjust = 0,  align = FALSE, linetype = "dot
43 43
     show_segment <- FALSE
44 44
     if (align && (!is.na(linetype) && !is.null(linetype))) {
45 45
         show_segment <- TRUE
46
+        segment_mapping <- aes(x = max(x, na.rm=TRUE),
47
+                               xend = x + diff(range(x, na.rm=TRUE))/200,
48
+                               y = y, yend = y,
49
+                               subset=isTip)
50
+        if (!is.null(mapping))
51
+            segment_mapping <- modifyList(segment_mapping, mapping)
46 52
     }
47 53
 
48 54
     list(
... ...
@@ -50,10 +56,14 @@ geom_tiplab <- function(mapping=NULL, hjust = 0,  align = FALSE, linetype = "dot
50 56
                   hjust = hjust, nudge_x = offset, ...)
51 57
         ,
52 58
         if (show_segment)
53
-            geom_tipsegment(mapping = aes(subset=isTip),
54
-                            offset = offset,
55
-                            linetype = linetype,
56
-                            size = linesize, ...)
59
+            geom_segment2(mapping = segment_mapping,
60
+                          linetype = linetype,
61
+                          size = linesize, ...)
62
+
63
+            ## geom_tipsegment(mapping = segment_mapping,
64
+            ##                 offset = offset,
65
+            ##                 linetype = linetype,
66
+            ##                 size = linesize, ...)
57 67
     )
58 68
 }
59 69
 
... ...
@@ -88,47 +98,47 @@ geom_tiplab2 <- function(mapping=NULL, hjust=0, ...) {
88 98
          )
89 99
 }
90 100
 
91
-geom_tipsegment <- function(mapping=NULL, data=NULL,
92
-                            geom=GeomSegmentGGtree, position = "identity",
93
-                            offset,  ...,
94
-                            show.legend=NA, inherit.aes=FALSE,
95
-                            na.rm=TRUE) {
96
-
97
-    default_aes <- aes_(x=~x, y=~y)
98
-    if (is.null(mapping)) {
99
-        mapping <- default_aes
100
-    } else {
101
-        mapping <- modifyList(default_aes, mapping)
102
-    }
103
-
104
-    layer(stat=StatTipSegment,
105
-          data = data,
106
-          mapping = mapping,
107
-          geom = geom,
108
-          position = position,
109
-          show.legend = show.legend,
110
-          inherit.aes = inherit.aes,
111
-          params = list(offset = offset,
112
-                        na.rm = na.rm,
113
-                        ...),
114
-          check.aes = FALSE
115
-          )
116
-}
117
-
118
-StatTipSegment <- ggproto("StatTipSegment", Stat,
119
-                        compute_group = function(self, data, scales, params, offset) {
120
-                            get_tipsegment_position(data, offset)
121
-                        },
122
-                        required_aes = c("x", "y")
123
-                        )
124
-
125
-
126
-get_tipsegment_position <- function(data, offset, adjustRatio=1/200) {
127
-    adjust <- diff(range(data$x, na.rm=TRUE)) * adjustRatio
128
-    xend <- data$x + adjust
129
-    x <- max(data$x, na.rm = TRUE)  + offset
130
-    y <- data$y
131
-    data.frame(x=x, xend=xend, y=y, yend=y)
132
-}
101
+## geom_tipsegment <- function(mapping=NULL, data=NULL,
102
+##                             geom=GeomSegmentGGtree, position = "identity",
103
+##                             offset,  ...,
104
+##                             show.legend=NA, inherit.aes=FALSE,
105
+##                             na.rm=TRUE) {
106
+
107
+##     default_aes <- aes_(x=~x, y=~y)
108
+##     if (is.null(mapping)) {
109
+##         mapping <- default_aes
110
+##     } else {
111
+##         mapping <- modifyList(default_aes, mapping)
112
+##     }
113
+
114
+##     layer(stat=StatTipSegment,
115
+##           data = data,
116
+##           mapping = mapping,
117
+##           geom = geom,
118
+##           position = position,
119
+##           show.legend = show.legend,
120
+##           inherit.aes = inherit.aes,
121
+##           params = list(offset = offset,
122
+##                         na.rm = na.rm,
123
+##                         ...),
124
+##           check.aes = FALSE
125
+##           )
126
+## }
127
+
128
+## StatTipSegment <- ggproto("StatTipSegment", Stat,
129
+##                         compute_group = function(self, data, scales, params, offset) {
130
+##                             get_tipsegment_position(data, offset)
131
+##                         },
132
+##                         required_aes = c("x", "y")
133
+##                         )
134
+
135
+
136
+## get_tipsegment_position <- function(data, offset, adjustRatio=1/200) {
137
+##     adjust <- diff(range(data$x, na.rm=TRUE)) * adjustRatio
138
+##     xend <- data$x + adjust
139
+##     x <- max(data$x, na.rm = TRUE)  + offset
140
+##     y <- data$y
141
+##     data.frame(x=x, xend=xend, y=y, yend=y)
142
+## }
133 143
 
134 144
 
... ...
@@ -1078,6 +1078,7 @@ getXcoord2 <- function(x, root, parent, child, len, start=0, rev=FALSE) {
1078 1078
     if (rev == TRUE) {
1079 1079
         direction <- -1
1080 1080
     }
1081
+
1081 1082
     while(anyNA(x)) {
1082 1083
         idx <- which(parent %in% currentNode)
1083 1084
         newNode <- child[idx]
... ...
@@ -1186,9 +1187,15 @@ getYcoord <- function(tr, step=1) {
1186 1187
     y[tip.idx] <- 1:Ntip * step
1187 1188
     y[-tip.idx] <- NA
1188 1189
 
1190
+    ## use lookup table
1191
+    pvec <- integer(max(tr$edge))
1192
+    pvec[child] = parent
1193
+
1189 1194
     currentNode <- 1:Ntip
1190 1195
     while(anyNA(y)) {
1191
-        pNode <- unique(parent[child %in% currentNode])
1196
+        ## pNode <- unique(parent[child %in% currentNode])
1197
+        pNode <- unique(pvec[currentNode])
1198
+
1192 1199
         ## piping of magrittr is slower than nested function call.
1193 1200
         ## pipeR is fastest, may consider to use pipeR
1194 1201
         ##
... ...
@@ -4,9 +4,9 @@ ggtree: an R package for visualization and annotation of phylogenetic trees with
4 4
 
5 5
 <img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" />
6 6
 
7
-[![](https://img.shields.io/badge/release%20version-1.8.1-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![](https://img.shields.io/badge/devel%20version-1.9.0-green.svg?style=flat)](https://github.com/guangchuangyu/ggtree) [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [![](https://img.shields.io/badge/download-14976/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-1074/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
7
+[![](https://img.shields.io/badge/release%20version-1.8.1-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![](https://img.shields.io/badge/devel%20version-1.9.1-green.svg?style=flat)](https://github.com/guangchuangyu/ggtree) [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [![](https://img.shields.io/badge/download-16372/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-1117/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
8 8
 
9
-[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--05--06-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
9
+[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--06--19-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
10 10
 
11 11
 [![platform](http://www.bioconductor.org/shields/availability/devel/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [![Build Status](http://www.bioconductor.org/shields/build/devel/bioc/ggtree.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [![Linux/Mac Travis Build Status](https://img.shields.io/travis/GuangchuangYu/ggtree/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/GuangchuangYu/ggtree) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/Guangchuangyu/ggtree/master.svg?label=Windows)](https://ci.appveyor.com/project/GuangchuangYu/ggtree)
12 12
 
... ...
@@ -33,50 +33,50 @@ Please cite the following article when using `ggtree`:
33 33
 
34 34
 ### Citation
35 35
 
36
-[![citation](https://img.shields.io/badge/cited%20by-16-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
36
+[![citation](https://img.shields.io/badge/cited%20by-22-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
37 37
 
38 38
        +-+---------+---------+---------+---------+---------+---+
39
-    15 +                                                   *   +
39
+    20 +                                                   *   +
40 40
        |                                                       |
41 41
        |                                                       |
42
+    15 +                                                       +
42 43
        |                                                       |
43
-    10 +                                                       +
44 44
        |                                                       |
45
+    10 +                                                       +
45 46
        |                                                       |
46 47
        |                                                       |
47 48
      5 +                                                       +
48
-       |                                                       |
49 49
        |                                                       |
50 50
        | *                                                     |
51
-       +-+---------+---------+---------+---------+---------+---+
51
+     0 +-+---------+---------+---------+---------+---------+---+
52 52
        2016     2016.2    2016.4    2016.6    2016.8     2017   
53 53
 
54 54
 ### Download stats
55 55
 
56
-[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-14976/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-1074/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
56
+[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-16372/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-1117/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
57 57
 
58
-         ++------------------+------------------+------------------+-----------------+-----------------+
59
-    3000 +                                                                                    *        +
58
+         ++------------------+-----------------+-----------------+-----------------+------------------++
59
+    3000 +                                                                                  *          +
60 60
          |                                                                                             |
61 61
          |                                                                                             |
62 62
     2500 +                                                                                             +
63 63
          |                                                                                             |
64 64
          |                                                                                             |
65 65
          |                                                                                             |
66
-    2000 +                                                                                        *    +
67
-         |                                                                        *     *  *           |
68
-         |                                                                  *  *                       |
66
+    2000 +                                                                                     *   *   +
67
+         |                                                                      *     *  *             |
68
+         |                                                                *  *                         |
69 69
     1500 +                                                                                             +
70 70
          |                                                                                             |
71
-         |                                                        *                                    |
72
-         |                                               *            *  *           *                 |
73
-    1000 +                                                  *  *                                       +
74
-         |                                  *      *                                                   |
75
-         |                               *      *     *                                                |
71
+         |                                                       *                                     |
72
+         |                                              *           *  *           *                   |
73
+    1000 +                                                 *  *                                        +
74
+         |                                  *     *                                                    |
75
+         |                               *     *     *                                                 |
76 76
          |                            *                                                                |
77
-     500 +                   *     *                                                                   +
78
-         |                *     *                                                                      |
77
+     500 +                  *      *                                                                   +
78
+         |               *     *                                                                       |
79 79
          |            *                                                                                |
80 80
        0 +   *  *  *                                                                                   +
81
-         ++------------------+------------------+------------------+-----------------+-----------------+
82
-        2015              2015.5              2016              2016.5             2017
81
+         ++------------------+-----------------+-----------------+-----------------+------------------++
82
+        2015              2015.5             2016             2016.5             2017            2017.5
... ...
@@ -220,7 +220,7 @@
220 220
 <p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p>
221 221
 <p><a href="https://github.com/GuangchuangYu/featured_img">Let us know</a> if you have
222 222
 published using <code>ggtree</code> and your publication will be featured here.</p>
223
-<p><a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat" /></a></p>
223
+<p><a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat" /></a></p>
224 224
 <p><link rel='stylesheet' href=https://guangchuangyu.github.io/resume/css/morris.css>
225 225
 <script src='https://guangchuangyu.github.io/resume/css/jquery.min.js' type='text/javascript'></script>
226 226
 <script src='https://guangchuangyu.github.io/resume/css/raphael-min.js' type='text/javascript'></script>
... ...
@@ -234,12 +234,12 @@ published using <code>ggtree</code> and your publication will be featured here.<
234 234
     height: 300px;
235 235
   }<br />
236 236
   </style>
237
-<div id="chart5a529be8ff3" class="rChart morris"></p>
237
+<div id="chart5f2d37e8c08a" class="rChart morris"></p>
238 238
 </div>
239 239
 
240 240
 <script type='text/javascript'>
241 241
     var chartParams = {
242
- "element": "chart5a529be8ff3",
242
+ "element": "chart5f2d37e8c08a",
243 243
 "width":            800,
244 244
 "height":            400,
245 245
 "xkey": "year",
... ...
@@ -254,11 +254,11 @@ published using <code>ggtree</code> and your publication will be featured here.<
254 254
 },
255 255
 {
256 256
  "year": 2017,
257
-"cites":             15,
257
+"cites":             21,
258 258
 "pubid": "HtEfBTGE9r8C" 
259 259
 } 
260 260
 ],
261
-"id": "chart5a529be8ff3",
261
+"id": "chart5f2d37e8c08a",
262 262
 "labels": "cites" 
263 263
 },
264 264
       chartType = "Bar"
... ...
@@ -218,7 +218,7 @@
218 218
 <!-- AddToAny END -->
219 219
 
220 220
 <p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"></p>
221
-<p><a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat" /></a></p>
221
+<p><a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat" /></a></p>
222 222
 <!-- citation:=HtEfBTGE9r8C:=7268358477862164627 -->
223 223
 
224 224
 <h2 id="journal-articles"><i class="fa fa-mortar-board"></i> Journal Articles</h2>
... ...
@@ -232,10 +232,10 @@
232 232
 <p><img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /></p>
233 233
 <p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css">
234 234
 <link rel="stylesheet" href="https://guangchuangyu.github.io/css/academicons.min.css"></p>
235
-<p><a href="https://bioconductor.org/packages/ggtree"><img alt="" src="https://img.shields.io/badge/release%20version-1.8.0-blue.svg?style=flat" /></a>
236
-<a href="https://github.com/guangchuangyu/ggtree"><img alt="" src="https://img.shields.io/badge/devel%20version-1.9.0-blue.svg?style=flat" /></a>
237
-<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="" src="https://img.shields.io/badge/download-14716/total-blue.svg?style=flat" /></a>
238
-<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="" src="https://img.shields.io/badge/download-1385/month-blue.svg?style=flat" /></a></p>
235
+<p><a href="https://bioconductor.org/packages/ggtree"><img alt="" src="https://img.shields.io/badge/release%20version-1.8.1-blue.svg?style=flat" /></a>
236
+<a href="https://github.com/guangchuangyu/ggtree"><img alt="" src="https://img.shields.io/badge/devel%20version-1.9.1-blue.svg?style=flat" /></a>
237
+<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="" src="https://img.shields.io/badge/download-16372/total-blue.svg?style=flat" /></a>
238
+<a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img alt="" src="https://img.shields.io/badge/download-1117/month-blue.svg?style=flat" /></a></p>
239 239
 <p>The <code>ggtree</code> package extending the <em>ggplot2</em> package. It based on
240 240
 grammar of graphics and takes all the good parts of <em>ggplot2</em>. <em>ggtree</em>
241 241
 is designed for not only viewing phylogenetic tree but also displaying
... ...
@@ -256,8 +256,8 @@ University of Hong Kong.</p>
256 256
 <h2 id="citation"><i class="fa fa-book"></i> Citation</h2>
257 257
 <p>Please cite the following article when using <code>ggtree</code>:</p>
258 258
 <p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img alt="" src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" /></a>
259
-<a href="https://www.altmetric.com/details/10533079"><img alt="" src="https://img.shields.io/badge/Altmetric-347-blue.svg?style=flat" /></a>
260
-<a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat" /></a></p>
259
+<a href="https://www.altmetric.com/details/10533079"><img alt="" src="https://img.shields.io/badge/Altmetric-346-blue.svg?style=flat" /></a>
260
+<a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img alt="citation" src="https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat" /></a></p>
261 261
 <p><strong>G Yu</strong>, DK Smith, H Zhu, Y Guan, TTY Lam<sup>*</sup>. ggtree: an R
262 262
 package for visualization and annotation of phylogenetic trees with
263 263
 their covariates and other associated data. <strong><em>Methods in Ecology and
... ...
@@ -217,7 +217,7 @@
217 217
         }, 
218 218
         {
219 219
             "location": "/featuredArticles/", 
220
-            "text": "Let us know\n if you have\npublished using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n  .rChart {\n    display: block;\n    margin-left: auto; \n    margin-right: auto;\n    width: 800px;\n    height: 300px;\n  }<br />\n  \n\n\n\n\n\n\n\n\n    var chartParams = {\n \"element\": \"chart5a529be8ff3\",\n\"width\":            800,\n\"height\":            400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\":              1,\n\"pubid\": \"HtEfBTGE9r8C\" \n},\n{\n \"year\": 2017,\n\"cites\":             15,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chart5a529be8ff3\",\n\"labels\": \"cites\" \n},\n      chartType = \"Bar\"\n    new Morris[chartType](chartParams)\n\n\n\n\n\n\n\n\n\n\n 2017\n\n\nPhylogenetic analysis of the human antibody repertoire reveals\nquantitative signatures of immune senescence and\naging\n. \nPNAS\n, 2017\n\n\nHorses in Denmark Are a Reservoir of Diverse Clones of\nMethicillin-Resistant and -Susceptible Staphylococcus\naureus\n.\n\nFrontiers in Microbiology\n, 2017, 8:543\n\n\nGut metagenomes of type 2 diabetic patients have characteristic\nsingle-nucleotide polymorphism distribution in \nBacteroides\ncoprocola\n.\n\nMicrobiome\n, 2017, 5:15\n\n\n 2016\n\n\nFunction and Phylogeny of Bacterial Butyryl Coenzyme A:Acetate\nTransferases and Their Diversity in the Proximal Colon of\nSwine\n. \nApplied and\nEnvironmental Microbiology\n. 2016, 82(22):6788-6798.", 
220
+            "text": "Let us know\n if you have\npublished using \nggtree\n and your publication will be featured here.\n\n\n\n\n\n\n\n\n\n\n\n\n\n  .rChart {\n    display: block;\n    margin-left: auto; \n    margin-right: auto;\n    width: 800px;\n    height: 300px;\n  }<br />\n  \n\n\n\n\n\n\n\n\n    var chartParams = {\n \"element\": \"chart5f2d37e8c08a\",\n\"width\":            800,\n\"height\":            400,\n\"xkey\": \"year\",\n\"ykeys\": [\n \"cites\" \n],\n\"data\": [\n {\n \"year\": 2016,\n\"cites\":              1,\n\"pubid\": \"HtEfBTGE9r8C\" \n},\n{\n \"year\": 2017,\n\"cites\":             21,\n\"pubid\": \"HtEfBTGE9r8C\" \n} \n],\n\"id\": \"chart5f2d37e8c08a\",\n\"labels\": \"cites\" \n},\n      chartType = \"Bar\"\n    new Morris[chartType](chartParams)\n\n\n\n\n\n\n\n\n\n\n 2017\n\n\nPhylogenetic analysis of the human antibody repertoire reveals\nquantitative signatures of immune senescence and\naging\n. \nPNAS\n, 2017\n\n\nHorses in Denmark Are a Reservoir of Diverse Clones of\nMethicillin-Resistant and -Susceptible Staphylococcus\naureus\n.\n\nFrontiers in Microbiology\n, 2017, 8:543\n\n\nGut metagenomes of type 2 diabetic patients have characteristic\nsingle-nucleotide polymorphism distribution in \nBacteroides\ncoprocola\n.\n\nMicrobiome\n, 2017, 5:15\n\n\n 2016\n\n\nFunction and Phylogeny of Bacterial Butyryl Coenzyme A:Acetate\nTransferases and Their Diversity in the Proximal Colon of\nSwine\n. \nApplied and\nEnvironmental Microbiology\n. 2016, 82(22):6788-6798.", 
221 221
             "title": "Featured Articles"
222 222
         }, 
223 223
         {
... ...
@@ -4,7 +4,7 @@
4 4
     
5 5
     <url>
6 6
      <loc>https://guangchuangyu.github.io/ggtree/</loc>
7
-     <lastmod>2017-04-30</lastmod>
7
+     <lastmod>2017-06-19</lastmod>
8 8
      <changefreq>daily</changefreq>
9 9
     </url>
10 10
     
... ...
@@ -12,7 +12,7 @@
12 12
     
13 13
     <url>
14 14
      <loc>https://guangchuangyu.github.io/ggtree/documentation/</loc>
15
-     <lastmod>2017-04-30</lastmod>
15
+     <lastmod>2017-06-19</lastmod>
16 16
      <changefreq>daily</changefreq>
17 17
     </url>
18 18
     
... ...
@@ -20,7 +20,7 @@
20 20
     
21 21
     <url>
22 22
      <loc>https://guangchuangyu.github.io/ggtree/faq/</loc>
23
-     <lastmod>2017-04-30</lastmod>
23
+     <lastmod>2017-06-19</lastmod>
24 24
      <changefreq>daily</changefreq>
25 25
     </url>
26 26
     
... ...
@@ -28,7 +28,7 @@
28 28
     
29 29
     <url>
30 30
      <loc>https://guangchuangyu.github.io/ggtree/featuredArticles/</loc>
31
-     <lastmod>2017-04-30</lastmod>
31
+     <lastmod>2017-06-19</lastmod>
32 32
      <changefreq>daily</changefreq>
33 33
     </url>
34 34
     
... ...
@@ -36,7 +36,7 @@
36 36
     
37 37
     <url>
38 38
      <loc>https://guangchuangyu.github.io/ggtree/gallery/</loc>
39
-     <lastmod>2017-04-30</lastmod>
39
+     <lastmod>2017-06-19</lastmod>
40 40
      <changefreq>daily</changefreq>
41 41
     </url>
42 42
     
... ...
@@ -45,55 +45,55 @@
45 45
         
46 46
     <url>
47 47
      <loc>https://guangchuangyu.github.io/ggtree/ChIPseeker/</loc>
48
-     <lastmod>2017-04-30</lastmod>
48
+     <lastmod>2017-06-19</lastmod>
49 49
      <changefreq>daily</changefreq>
50 50
     </url>
51 51
         
52 52
     <url>
53 53
      <loc>https://guangchuangyu.github.io/ggtree/clusterProfiler/</loc>
54
-     <lastmod>2017-04-30</lastmod>
54
+     <lastmod>2017-06-19</lastmod>
55 55
      <changefreq>daily</changefreq>
56 56
     </url>
57 57
         
58 58
     <url>
59 59
      <loc>https://guangchuangyu.github.io/ggtree/DOSE/</loc>
60
-     <lastmod>2017-04-30</lastmod>
60
+     <lastmod>2017-06-19</lastmod>
61 61
      <changefreq>daily</changefreq>
62 62
     </url>
63 63
         
64 64
     <url>
65 65
      <loc>https://guangchuangyu.github.io/ggtree/emojifont/</loc>
66
-     <lastmod>2017-04-30</lastmod>
66
+     <lastmod>2017-06-19</lastmod>
67 67
      <changefreq>daily</changefreq>
68 68
     </url>
69 69
         
70 70
     <url>
71 71
      <loc>https://guangchuangyu.github.io/ggtree/ggtree/</loc>
72
-     <lastmod>2017-04-30</lastmod>
72
+     <lastmod>2017-06-19</lastmod>
73 73
      <changefreq>daily</changefreq>
74 74
     </url>
75 75
         
76 76
     <url>
77 77
      <loc>https://guangchuangyu.github.io/ggtree/GOSemSim/</loc>
78
-     <lastmod>2017-04-30</lastmod>
78
+     <lastmod>2017-06-19</lastmod>
79 79
      <changefreq>daily</changefreq>
80 80
     </url>
81 81
         
82 82
     <url>
83 83
      <loc>https://guangchuangyu.github.io/ggtree/meshes/</loc>
84
-     <lastmod>2017-04-30</lastmod>
84
+     <lastmod>2017-06-19</lastmod>
85 85
      <changefreq>daily</changefreq>
86 86
     </url>
87 87
         
88 88
     <url>
89 89
      <loc>https://guangchuangyu.github.io/ggtree/ReactomePA/</loc>
90
-     <lastmod>2017-04-30</lastmod>
90
+     <lastmod>2017-06-19</lastmod>
91 91
      <changefreq>daily</changefreq>
92 92
     </url>
93 93
         
94 94
     <url>
95 95
      <loc>https://guangchuangyu.github.io/ggtree/treeio/</loc>
96
-     <lastmod>2017-04-30</lastmod>
96
+     <lastmod>2017-06-19</lastmod>
97 97
      <changefreq>daily</changefreq>
98 98
     </url>
99 99
         
... ...
@@ -24,7 +24,7 @@ output:
24 24
 [Let us know](https://github.com/GuangchuangYu/featured_img) if you have
25 25
 published using `ggtree` and your publication will be featured here.
26 26
 
27
-[![citation](https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
27
+[![citation](https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
28 28
 
29 29
 <link rel='stylesheet' href=https://guangchuangyu.github.io/resume/css/morris.css>
30 30
 <script src='https://guangchuangyu.github.io/resume/css/jquery.min.js' type='text/javascript'></script>
... ...
@@ -39,13 +39,13 @@ published using `ggtree` and your publication will be featured here.
39 39
     height: 300px;
40 40
   }  
41 41
   </style>
42
-<div id="chart5a529be8ff3" class="rChart morris">
42
+<div id="chart5f2d37e8c08a" class="rChart morris">
43 43
 
44 44
 </div>
45 45
 
46 46
 <script type='text/javascript'>
47 47
     var chartParams = {
48
- "element": "chart5a529be8ff3",
48
+ "element": "chart5f2d37e8c08a",
49 49
 "width":            800,
50 50
 "height":            400,
51 51
 "xkey": "year",
... ...
@@ -60,11 +60,11 @@ published using `ggtree` and your publication will be featured here.
60 60
 },
61 61
 {
62 62
  "year": 2017,
63
-"cites":             15,
63
+"cites":             21,
64 64
 "pubid": "HtEfBTGE9r8C" 
65 65
 } 
66 66
 ],
67
-"id": "chart5a529be8ff3",
67
+"id": "chart5f2d37e8c08a",
68 68
 "labels": "cites" 
69 69
 },
70 70
       chartType = "Bar"
... ...
@@ -21,7 +21,7 @@ output:
21 21
 <!-- AddToAny END -->
22 22
 <link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css">
23 23
 
24
-[![citation](https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
24
+[![citation](https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
25 25
 
26 26
 <!-- citation:=HtEfBTGE9r8C:=7268358477862164627 -->
27 27
 <i class="fa fa-mortar-board"></i> Journal Articles
... ...
@@ -27,10 +27,10 @@ ggtree: visualization and annotation of phylogenetic trees
27 27
 <link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css">
28 28
 <link rel="stylesheet" href="https://guangchuangyu.github.io/css/academicons.min.css">
29 29
 
30
-[![](https://img.shields.io/badge/release%20version-1.8.0-blue.svg?style=flat)](https://bioconductor.org/packages/ggtree)
31
-[![](https://img.shields.io/badge/devel%20version-1.9.0-blue.svg?style=flat)](https://github.com/guangchuangyu/ggtree)
32
-[![](https://img.shields.io/badge/download-14716/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
33
-[![](https://img.shields.io/badge/download-1385/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
30
+[![](https://img.shields.io/badge/release%20version-1.8.1-blue.svg?style=flat)](https://bioconductor.org/packages/ggtree)
31
+[![](https://img.shields.io/badge/devel%20version-1.9.1-blue.svg?style=flat)](https://github.com/guangchuangyu/ggtree)
32
+[![](https://img.shields.io/badge/download-16372/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
33
+[![](https://img.shields.io/badge/download-1117/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
34 34
 
35 35
 The `ggtree` package extending the *ggplot2* package. It based on
36 36
 grammar of graphics and takes all the good parts of *ggplot2*. *ggtree*
... ...
@@ -60,8 +60,8 @@ University of Hong Kong.
60 60
 Please cite the following article when using `ggtree`:
61 61
 
62 62
 [![](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628)
63
-[![](https://img.shields.io/badge/Altmetric-347-blue.svg?style=flat)](https://www.altmetric.com/details/10533079)
64
-[![citation](https://img.shields.io/badge/cited%20by-16-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
63
+[![](https://img.shields.io/badge/Altmetric-346-blue.svg?style=flat)](https://www.altmetric.com/details/10533079)
64
+[![citation](https://img.shields.io/badge/cited%20by-22-blue.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
65 65
 
66 66
 **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an R
67 67
 package for visualization and annotation of phylogenetic trees with