Browse code

remove paml_rst, codeml_mlc, codeml and jplace fortify methods according to the change of treeio (v = 1.3.3)

guangchuang yu authored on 07/12/2017 07:21:58
Showing19 changed files

... ...
@@ -2,7 +2,7 @@ Package: ggtree
2 2
 Type: Package
3 3
 Title: an R package for visualization and annotation of phylogenetic trees with
4 4
     their covariates and other associated data
5
-Version: 1.11.2
5
+Version: 1.11.3
6 6
 Authors@R: c(
7 7
 	   person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")),
8 8
 	   person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com",   role = c("aut", "ths")),
... ...
@@ -36,6 +36,10 @@ check2: build
36 36
 	cd ..;\
37 37
 	R CMD check $(PKGNAME)_$(PKGVERS).tar.gz
38 38
 
39
+check3: rd build2
40
+	cd ..;\
41
+	R CMD check --ignore-vignettes $(PKGNAME)_$(PKGVERS).tar.gz
42
+
39 43
 bioccheck:
40 44
 	cd ..;\
41 45
 	Rscript -e 'BiocCheck::BiocCheck("$(PKGNAME)_$(PKGVERS).tar.gz")'
... ...
@@ -4,20 +4,12 @@ S3method(as.binary,phylo)
4 4
 S3method(as.data.frame,phylo)
5 5
 S3method(as_data_frame,phylo)
6 6
 S3method(as_data_frame,treedata)
7
-S3method(fortify,codeml)
8
-S3method(fortify,codeml_mlc)
9
-S3method(fortify,hyphy)
10
-S3method(fortify,jplace)
11 7
 S3method(fortify,multiPhylo)
12 8
 S3method(fortify,obkData)
13
-S3method(fortify,paml_rst)
14
-S3method(fortify,phangorn)
15
-S3method(fortify,phylip)
16 9
 S3method(fortify,phylo)
17 10
 S3method(fortify,phylo4)
18 11
 S3method(fortify,phylo4d)
19 12
 S3method(fortify,phyloseq)
20
-S3method(fortify,r8s)
21 13
 S3method(fortify,treedata)
22 14
 S3method(identify,gg)
23 15
 S3method(print,beastList)
... ...
@@ -195,9 +187,10 @@ importFrom(scales,alpha)
195 187
 importFrom(tibble,as_data_frame)
196 188
 importFrom(tibble,data_frame)
197 189
 importFrom(tidyr,gather)
190
+importFrom(treeio,Nnode)
191
+importFrom(treeio,Ntip)
198 192
 importFrom(treeio,as.phylo)
199 193
 importFrom(treeio,as.treedata)
200
-importFrom(treeio,get.placements)
201 194
 importFrom(treeio,groupClade)
202 195
 importFrom(treeio,groupOTU)
203 196
 importFrom(utils,modifyList)
... ...
@@ -1,3 +1,7 @@
1
+CHANGES IN VERSION 1.11.3
2
+------------------------
3
+ o remove paml_rst, codeml_mlc, codeml and jplace fortify methods according to the change of treeio (v = 1.3.3) <2017-12-07, Thu>
4
+
1 5
 CHANGES IN VERSION 1.11.2
2 6
 ------------------------
3 7
  o keep tree order (previously using postorder) <2017-12-06-Wed>
... ...
@@ -1,4 +1,3 @@
1
-
2 1
 ##' collapse binary tree to polytomy by applying 'fun' to 'feature'
3 2
 ##'
4 3
 ##'
... ...
@@ -19,11 +18,11 @@ as.polytomy <- function(tree, feature, fun) {
19 18
     phylo <- get.tree(tree)
20 19
 
21 20
     if (feature == 'node.label') {
22
-        feat <- df[!df$isTip, 'label']
21
+        feat <- df$label[!df$isTip]
23 22
     } else if (feature == 'tip.label') {
24
-        feat <- df[df$isTip, 'label']
23
+        feat <- df$label[df$isTip]
25 24
     } else {
26
-        feat <- df[, feature]
25
+        feat <- df[[feature]]
27 26
     }
28 27
 
29 28
     idx <- which(fun(feat))
... ...
@@ -133,12 +133,12 @@ expand <- function(tree_view=NULL, node) {
133 133
     root <- which(df$node == df$parent)
134 134
     pp <- node
135 135
     while(any(pp != root)) {
136
-        df[pp, "y"] <- mean(df[getChild.df(df, pp), "y"])
137
-        pp <- df[pp, "parent"]
136
+        df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
137
+        pp <- df$parent[pp]
138 138
     }
139 139
     j <- getChild.df(df, pp)
140 140
     j <- j[j!=pp]
141
-    df[pp, "y"] <- mean(df[j, "y"])
141
+    df[pp, "y"] <- mean(df$y[j])
142 142
 
143 143
     ## re-calculate branch mid position
144 144
     df <- calculate_branch_mid(df)
... ...
@@ -166,17 +166,17 @@ rotate <- function(tree_view=NULL, node) {
166 166
     tip <- sp[df$isTip[sp_idx]]
167 167
     sp.df <- df[sp_idx,]
168 168
     ii <- with(sp.df, match(tip, node))
169
-    jj <- ii[order(sp.df[ii, "y"])]
170
-    sp.df[jj,"y"] <- rev(sp.df[jj, "y"])
169
+    jj <- ii[order(sp.df$y[ii])]
170
+    sp.df[jj,"y"] <- rev(sp.df$y[jj])
171 171
     sp.df[-jj, "y"] <- NA
172 172
     sp.df <- re_assign_ycoord_df(sp.df, tip)
173 173
 
174 174
     df[sp_idx, "y"] <- sp.df$y
175 175
     ## df$node == node is TRUE when node was root
176
-    df[df$node == node, "y"] <- mean(df[df$parent == node & df$node != node, "y"])
176
+    df[df$node == node, "y"] <- mean(df$y[df$parent == node & df$node != node])
177 177
     pnode <- df$parent[df$node == node]
178 178
     if (pnode != node && !is.na(pnode)) {
179
-        df[df$node == pnode, "y"] <- mean(df[df$parent == pnode, "y"])
179
+        df[df$node == pnode, "y"] <- mean(df$y[df$parent == pnode])
180 180
     }
181 181
 
182 182
     tree_view$data <- calculate_angle(df)
... ...
@@ -275,9 +275,9 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) {
275 275
 
276 276
     ## new_span <- span * scale
277 277
     old.sp.df <- sp.df
278
-    sp.df$y <- df[node, "y"] + (sp.df$y - df[node, "y"]) * scale
278
+    sp.df$y <- df$y[node] + (sp.df$y - df$y[node]) * scale
279 279
     if (! vertical_only) {
280
-        sp.df$x <- df[node, "x"] + (sp.df$x - df[node, "x"]) * scale
280
+        sp.df$x <- df$x[node] + (sp.df$x - df$x[node]) * scale
281 281
     }
282 282
 
283 283
     scale_diff.up <- max(sp.df$y) - max(old.sp.df$y)
... ...
@@ -285,12 +285,12 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) {
285 285
 
286 286
     ii <- df$y > max(old.sp.df$y)
287 287
     if (sum(ii) > 0) {
288
-        df[ii, "y"] <- df[ii, "y"] + scale_diff.up
288
+        df[ii, "y"] <- df$y[ii] + scale_diff.up
289 289
     }
290 290
 
291 291
     jj <- df$y < min(old.sp.df$y)
292 292
     if (sum(jj) > 0) {
293
-        df[jj, "y"] <- df[jj, "y"] + scale_diff.lw
293
+        df[jj, "y"] <- df$y[jj] + scale_diff.lw
294 294
     }
295 295
 
296 296
     df[sp,] <- sp.df
... ...
@@ -320,13 +320,13 @@ scaleClade <- function(tree_view=NULL, node, scale=1, vertical_only=TRUE) {
320 320
 
321 321
 reassign_y_from_node_to_root <- function(df, node) {
322 322
     root <- which(df$node == df$parent)
323
-    pp <- df[node, "parent"]
323
+    pp <- df$parent[node]
324 324
     while(any(pp != root)) {
325
-        df[pp, "y"] <- mean(df[getChild.df(df, pp), "y"])
326
-        pp <- df[pp, "parent"]
325
+        df[pp, "y"] <- mean(df$y[getChild.df(df, pp)])
326
+        pp <- df$parent[pp]
327 327
     }
328 328
     j <- getChild.df(df, pp)
329 329
     j <- j[j!=pp]
330
-    df[pp, "y"] <- mean(df[j, "y"])
330
+    df[pp, "y"] <- mean(df$y[j])
331 331
     return(df)
332 332
 }
... ...
@@ -220,169 +220,132 @@ rm.singleton.newick <- function(nwk, outfile = NULL) {
220 220
 ## }
221 221
 
222 222
 
223
-##' @method fortify codeml
224
-##' @export
225
-fortify.codeml <- function(model, data,
226
-                           layout        = "rectangular",
227
-                           yscale        = "none",
228
-                           ladderize     = TRUE,
229
-                           right         = FALSE,
230
-                           branch.length = "mlc.branch.length",
231
-                           ndigits       = NULL,
232
-                           mrsd          = NULL,
233
-                           ...) {
234
-
235
-    dNdS <- model@mlc@dNdS
236
-    if (branch.length == "branch.length") {
237
-        message("branch.length setting to mlc.branch.length by default...")
238
-        branch.length <- "mlc.branch.length"
239
-    }
240
-    length <- match.arg(branch.length,
241
-                        c("none",
242
-                          "mlc.branch.length",
243
-                          "rst.branch.length",
244
-                          colnames(dNdS)[-c(1,2)])
245
-                        )
246
-
247
-    if (length == "rst.branch.length") {
248
-        phylo <- get.tree(model@rst)
249
-    } else {
250
-        if (length == "mlc.branch.length") {
251
-            length <- "branch.length"
252
-        }
253
-        mlc <- set_branch_length(model@mlc, length)
254
-        phylo <- get.tree(mlc)
255
-    }
256
-
257
-    df <- fortify(phylo, data, layout, ladderize, right,
258
-                  branch.length=length, mrsd=mrsd, ...)
259
-
260
-    res <- merge_phylo_anno.codeml_mlc(df, dNdS, ndigits)
261
-    df <- merge_phylo_anno.paml_rst(res, model@rst)
262
-    df <- scaleY(phylo, df, yscale, layout, ...)
263
-
264
-    append_extraInfo(df, model)
265
-}
266
-
267
-
268
-##' @method fortify codeml_mlc
269
-##' @export
270
-fortify.codeml_mlc <- function(model, data,
271
-                               layout        = "rectangular",
272
-                               yscale        = "none",
273
-                               ladderize     = TRUE,
274
-                               right         = FALSE,
275
-                               branch.length = "branch.length",
276
-                               ndigits       = NULL,
277
-                               mrsd          = NULL,
278
-                               ...) {
279
-
280
-    model <- set_branch_length(model, branch.length)
281
-    phylo <- get.tree(model)
282
-    df <- fortify(phylo, data, layout, ladderize, right,
283
-                  branch.length=branch.length, mrsd=mrsd, ...)
284
-
285
-    dNdS <- model@dNdS
286
-
287
-    df <- merge_phylo_anno.codeml_mlc(df, dNdS, ndigits)
288
-    df <- scaleY(phylo, df, yscale, layout, ...)
289
-
290
-    append_extraInfo(df, model)
291
-}
223
+## ##' @method fortify codeml
224
+## ##' @export
225
+## fortify.codeml <- function(model, data,
226
+##                            layout        = "rectangular",
227
+##                            yscale        = "none",
228
+##                            ladderize     = TRUE,
229
+##                            right         = FALSE,
230
+##                            branch.length = "mlc.branch.length",
231
+##                            ndigits       = NULL,
232
+##                            mrsd          = NULL,
233
+##                            ...) {
234
+
235
+##     dNdS <- model@mlc@dNdS
236
+##     if (branch.length == "branch.length") {
237
+##         message("branch.length setting to mlc.branch.length by default...")
238
+##         branch.length <- "mlc.branch.length"
239
+##     }
240
+##     length <- match.arg(branch.length,
241
+##                         c("none",
242
+##                           "mlc.branch.length",
243
+##                           "rst.branch.length",
244
+##                           colnames(dNdS)[-c(1,2)])
245
+##                         )
246
+
247
+##     if (length == "rst.branch.length") {
248
+##         phylo <- get.tree(model@rst)
249
+##     } else {
250
+##         if (length == "mlc.branch.length") {
251
+##             length <- "branch.length"
252
+##         }
253
+##         mlc <- set_branch_length(model@mlc, length)
254
+##         phylo <- get.tree(mlc)
255
+##     }
292 256
 
293
-merge_phylo_anno.codeml_mlc <- function(df, dNdS, ndigits = NULL) {
294
-    if (!is.null(ndigits)) {
295
-        idx <- which(! colnames(dNdS) %in% c("node", "parent"))
296
-        for (ii in idx) {
297
-            if (is.numeric(dNdS[, ii])) {
298
-                dNdS[, ii] <- round(dNdS[,ii], ndigits)
299
-            }
300
-        }
301
-    }
257
+##     df <- fortify(phylo, data, layout, ladderize, right,
258
+##                   branch.length=length, mrsd=mrsd, ...)
302 259
 
303
-    res <- merge(df, dNdS,
304
-                 by.x  = c("node", "parent"),
305
-                 by.y  = c("node", "parent"),
306
-                 all.x = TRUE)
260
+##     res <- merge_phylo_anno.codeml_mlc(df, dNdS, ndigits)
261
+##     df <- merge_phylo_anno.paml_rst(res, model@rst)
262
+##     df <- scaleY(phylo, df, yscale, layout, ...)
307 263
 
308
-    res[match(df$node, res$node),]
309
-}
264
+##     append_extraInfo(df, model)
265
+## }
310 266
 
311
-fortify.codeml_mlc_ <- function(model, data,
312
-                                layout        = "rectangular",
313
-                                ladderize     = TRUE,
314
-                                right         = FALSE,
315
-                                branch.length = "branch.length",
316
-                                ...) {
317 267
 
318
-}
268
+## ##' @method fortify codeml_mlc
269
+## ##' @export
270
+## fortify.codeml_mlc <- function(model, data,
271
+##                                layout        = "rectangular",
272
+##                                yscale        = "none",
273
+##                                ladderize     = TRUE,
274
+##                                right         = FALSE,
275
+##                                branch.length = "branch.length",
276
+##                                ndigits       = NULL,
277
+##                                mrsd          = NULL,
278
+##                                ...) {
319 279
 
280
+##     model <- set_branch_length(model, branch.length)
281
+##     phylo <- get.tree(model)
282
+##     df <- fortify(phylo, data, layout, ladderize, right,
283
+##                   branch.length=branch.length, mrsd=mrsd, ...)
320 284
 
285
+##     dNdS <- model@dNdS
321 286
 
322
-##' @method fortify paml_rst
323
-##' @export
324
-fortify.paml_rst <- function(model, data,
325
-                             layout    = "rectangular",
326
-                             yscale    = "none",
327
-                             ladderize = TRUE,
328
-                             right     = FALSE,
329
-                             mrsd      = NULL,
330
-                             ...) {
331
-    df <- fortify.phylo(model@phylo, data, layout, ladderize, right, mrsd=mrsd, ...)
332
-    df <- merge_phylo_anno.paml_rst(df, model)
333
-    df <- scaleY(model@phylo, df, yscale, layout, ...)
287
+##     df <- merge_phylo_anno.codeml_mlc(df, dNdS, ndigits)
288
+##     df <- scaleY(phylo, df, yscale, layout, ...)
334 289
 
335
-    append_extraInfo(df, model)
336
-}
290
+##     append_extraInfo(df, model)
291
+## }
337 292
 
338
-merge_phylo_anno.paml_rst <- function(df, model) {
339
-    types <- get.fields(model)
340
-    types <- types[grepl('subs', types)]
341
-    for (type in types) {
342
-        anno <- get.subs(model, type=type)
343
-        colnames(anno)[2] <- type
344
-        df <- df %add2% anno
345
-    }
346
-    return(df)
347
-}
293
+## merge_phylo_anno.codeml_mlc <- function(df, dNdS, ndigits = NULL) {
294
+##     if (!is.null(ndigits)) {
295
+##         idx <- which(! colnames(dNdS) %in% c("node", "parent"))
296
+##         for (ii in idx) {
297
+##             if (is.numeric(dNdS[, ii])) {
298
+##                 dNdS[, ii] <- round(dNdS[,ii], ndigits)
299
+##             }
300
+##         }
301
+##     }
348 302
 
303
+##     res <- merge(df, dNdS,
304
+##                  by.x  = c("node", "parent"),
305
+##                  by.y  = c("node", "parent"),
306
+##                  all.x = TRUE)
349 307
 
350
-##' @method fortify phangorn
351
-##' @export
352
-fortify.phangorn <- fortify.paml_rst
308
+##     res[match(df$node, res$node),]
309
+## }
353 310
 
354 311
 
355
-##' @method fortify hyphy
356
-##' @export
357
-fortify.hyphy <- fortify.paml_rst
312
+## ##' @method fortify paml_rst
313
+## ##' @export
314
+## fortify.paml_rst <- function(model, data,
315
+##                              layout    = "rectangular",
316
+##                              yscale    = "none",
317
+##                              ladderize = TRUE,
318
+##                              right     = FALSE,
319
+##                              mrsd      = NULL,
320
+##                              ...) {
321
+##     df <- fortify.phylo(model@phylo, data, layout, ladderize, right, mrsd=mrsd, ...)
322
+##     df <- merge_phylo_anno.paml_rst(df, model)
323
+##     df <- scaleY(model@phylo, df, yscale, layout, ...)
358 324
 
325
+##     append_extraInfo(df, model)
326
+## }
359 327
 
360
-##' @method fortify jplace
361
-##' @importFrom ape read.tree
362
-##' @importFrom treeio get.placements
363
-##' @export
364
-fortify.jplace <- function(model, data,
365
-                           layout    = "rectangular",
366
-                           yscale    = "none",
367
-                           ladderize = TRUE,
368
-                           right     = FALSE,
369
-                           mrsd      = NULL,
370
-                           ...) {
371
-    df <- extract.treeinfo.jplace(model, layout, ladderize, right, mrsd=mrsd, ...)
372
-    place <- get.placements(model, by="best")
328
+## merge_phylo_anno.paml_rst <- function(df, model) {
329
+##     types <- get.fields(model)
330
+##     types <- types[grepl('subs', types)]
331
+##     for (type in types) {
332
+##         anno <- get.subs(model, type=type)
333
+##         colnames(anno)[2] <- type
334
+##         df <- df %add2% anno
335
+##     }
336
+##     return(df)
337
+## }
373 338
 
374
-    nplace <- split(place, place$edge_num) %>% lapply(nrow)
375
-    nplace.df <- data.frame(edgeNum = names(nplace), nplace=unlist(nplace))
376 339
 
377
-    ## df <- merge(df, place, by.x="edgeNum", by.y="edge_num", all.x=TRUE)
378
-    df <- merge(df, nplace.df, by.x="edgeNum", by.y="edgeNum", all.x=TRUE)
340
+## ##' @method fortify phangorn
341
+## ##' @export
342
+## fortify.phangorn <- fortify.paml_rst
379 343
 
380
-    df$nplace[is.na(df$nplace)] <- 0
381 344
 
382
-    df <- scaleY(model@phylo, df, yscale, layout, ...)
345
+## ##' @method fortify hyphy
346
+## ##' @export
347
+## fortify.hyphy <- fortify.paml_rst
383 348
 
384
-    append_extraInfo(df, model)
385
-}
386 349
 
387 350
 scaleY <- function(phylo, df, yscale, layout, ...) {
388 351
     if (yscale == "none") {
... ...
@@ -447,72 +410,72 @@ fortify.phylo4d <- function(model, data,
447 410
 
448 411
 
449 412
 
450
-##' fortify a phylo to data.frame
451
-##'
452
-##'
453
-##' @rdname fortify
454
-##' @title fortify
455
-##' @param model phylo object
456
-##' @param data not use here
457
-##' @param layout layout
458
-##' @param ladderize ladderize, logical
459
-##' @param right logical
460
-##' @param mrsd most recent sampling date
461
-##' @param as.Date logical whether using Date class in time tree
462
-##' @param ... additional parameter
463
-##' @return data.frame
464
-##' @importFrom ape ladderize
465
-##' @importFrom ape reorder.phylo
466
-##' @importFrom ggplot2 fortify
467
-##' @method fortify phylo
468
-##' @export
469
-##' @author Yu Guangchuang
470
-fortify.phylo <- function(model, data,
471
-                          layout    = "rectangular",
472
-                          ladderize = TRUE,
473
-                          right     = FALSE,
474
-                          mrsd      = NULL,
475
-                          as.Date   = FALSE, ...) {
476
-    ## tree <- reorder.phylo(model, 'postorder')
477
-    tree <- model
478
-
479
-    if (ladderize == TRUE) {
480
-        tree <- ladderize(tree, right=right)
481
-    }
413
+## ##' fortify a phylo to data.frame
414
+## ##'
415
+## ##'
416
+## ##' @rdname fortify
417
+## ##' @title fortify
418
+## ##' @param model phylo object
419
+## ##' @param data not use here
420
+## ##' @param layout layout
421
+## ##' @param ladderize ladderize, logical
422
+## ##' @param right logical
423
+## ##' @param mrsd most recent sampling date
424
+## ##' @param as.Date logical whether using Date class in time tree
425
+## ##' @param ... additional parameter
426
+## ##' @return data.frame
427
+## ##' @importFrom ape ladderize
428
+## ##' @importFrom ape reorder.phylo
429
+## ##' @importFrom ggplot2 fortify
430
+## ##' @method fortify phylo
431
+## ##' @export
432
+## ##' @author Yu Guangchuang
433
+## fortify.phylo <- function(model, data,
434
+##                           layout    = "rectangular",
435
+##                           ladderize = TRUE,
436
+##                           right     = FALSE,
437
+##                           mrsd      = NULL,
438
+##                           as.Date   = FALSE, ...) {
439
+##     ## tree <- reorder.phylo(model, 'postorder')
440
+##     tree <- model
441
+
442
+##     if (ladderize == TRUE) {
443
+##         tree <- ladderize(tree, right=right)
444
+##     }
482 445
 
483
-    if (! is.null(tree$edge.length)) {
484
-        if (anyNA(tree$edge.length)) {
485
-            warning("'edge.length' contains NA values...\n## setting 'edge.length' to NULL automatically when plotting the tree...")
486
-            tree$edge.length <- NULL
487
-        }
488
-    }
446
+##     if (! is.null(tree$edge.length)) {
447
+##         if (anyNA(tree$edge.length)) {
448
+##             warning("'edge.length' contains NA values...\n## setting 'edge.length' to NULL automatically when plotting the tree...")
449
+##             tree$edge.length <- NULL
450
+##         }
451
+##     }
489 452
 
490
-    df <- as.data.frame(tree, layout=layout, ...)
491
-    idx <- is.na(df$parent)
492
-    df$parent[idx] <- df$node[idx]
493
-    rownames(df) <- df$node
494
-    cn <- colnames(df)
495
-    colnames(df)[grep("length", cn)] <- "branch.length"
496
-    if(layout == "slanted") {
497
-        df <- add_angle_slanted(df)
498
-    }
499
-    aa <- names(attributes(tree))
500
-    group <- aa[ ! aa %in% c("names", "class", "order", "reroot", "node_map")]
501
-    if (length(group) > 0) {
502
-        for (group_ in group) {
503
-            ## groupOTU & groupClade
504
-            group_info <- attr(tree, group_)
505
-            if (length(group_info) == nrow(df)) {
506
-                df[, group_] <- group_info
507
-            }
508
-        }
509
-    }
453
+##     df <- as.data.frame(tree, layout=layout, ...)
454
+##     idx <- is.na(df$parent)
455
+##     df$parent[idx] <- df$node[idx]
456
+##     rownames(df) <- df$node
457
+##     cn <- colnames(df)
458
+##     colnames(df)[grep("length", cn)] <- "branch.length"
459
+##     if(layout == "slanted") {
460
+##         df <- add_angle_slanted(df)
461
+##     }
462
+##     aa <- names(attributes(tree))
463
+##     group <- aa[ ! aa %in% c("names", "class", "order", "reroot", "node_map")]
464
+##     if (length(group) > 0) {
465
+##         for (group_ in group) {
466
+##             ## groupOTU & groupClade
467
+##             group_info <- attr(tree, group_)
468
+##             if (length(group_info) == nrow(df)) {
469
+##                 df[, group_] <- group_info
470
+##             }
471
+##         }
472
+##     }
510 473
 
511
-    if (!is.null(mrsd)) {
512
-        df <- scaleX_by_time_from_mrsd(df, mrsd, as.Date)
513
-    }
514
-    return(df)
515
-}
474
+##     if (!is.null(mrsd)) {
475
+##         df <- scaleX_by_time_from_mrsd(df, mrsd, as.Date)
476
+##     }
477
+##     return(df)
478
+## }
516 479
 
517 480
 ##' convert phylo to data.frame
518 481
 ##'
... ...
@@ -592,29 +555,6 @@ as.data.frame.phylo_ <- function(x, layout="rectangular",
592 555
     return(res)
593 556
 }
594 557
 
595
-## ##' @method fortify nhx
596
-## ##' @export
597
-## fortify.nhx <- function(model, data, layout= "rectangular",
598
-##                         ladderize=TRUE, right=FALSE, mrsd=NULL, ...) {
599
-##     df <- fortify(get.tree(model), layout=layout, ladderize=ladderize, right=right, mrsd=mrsd, ...)
600
-##     df <- merge(df, model@nhx_tags, by.x="node", by.y="node", all.x=TRUE)
601
-##     append_extraInfo(df, model)
602
-## }
603
-
604
-
605
-## ##' @method fortify raxml
606
-## ##' @export
607
-## fortify.raxml <- function(model, data, layout= "rectangular",
608
-##                           ladderize=TRUE, right=FALSE, mrsd=NULL, ...) {
609
-##     df <- fortify(get.tree(model), layout=layout, ladderize=ladderize, right=right, mrsd=mrsd, ...)
610
-##     df <- merge(df, model@bootstrap, by.x="node", by.y="node", all.x=TRUE)
611
-##     append_extraInfo(df, model)
612
-## }
613
-
614
-## ##' @method fortify apeBootstrap
615
-## ##' @export
616
-## fortify.apeBootstrap <- fortify.raxml
617
-
618 558
 
619 559
 ##' @method fortify multiPhylo
620 560
 ##' @export
... ...
@@ -633,38 +573,9 @@ fortify.multiPhylo <-  function(model, data,
633 573
     df <- do.call("rbind", df.list)
634 574
     df$.id <- rep(names(df.list), times=sapply(df.list, nrow))
635 575
     df$.id <- factor(df$.id, levels=names(df.list))
636
-
637
-    ## nNode <- sapply(df.list, nrow)
638
-    ## nNode2 <- cumsum(c(0, nNode[-length(nNode)]))
639
-    ## df$parent <- df$parent + rep(nNode2, times=nNode)
640 576
     return(df)
641 577
 }
642 578
 
643
-##' @method fortify phylip
644
-##' @export
645
-fortify.phylip <- function(model, data,
646
-                           layout        = "rectangular",
647
-                           ladderize     = TRUE,
648
-                           right         = FALSE,
649
-                           branch.length = "TREE",
650
-                           mrsd          = NULL, ...) {
651
-    trees <- get.tree(model)
652
-    fortify(trees, layout=layout, ladderize = ladderize, right=right, mrsd=mrsd, ...)
653
-}
654
-
655
-##' @method fortify r8s
656
-##' @export
657
-fortify.r8s <- function(model, data,
658
-                        layout        = "rectangular",
659
-                        ladderize     = TRUE,
660
-                        right         = FALSE,
661
-                        branch.length = "TREE",
662
-                        mrsd          = NULL, ...) {
663
-    trees <- get.tree(model)
664
-    branch.length %<>% match.arg(names(trees))
665
-    phylo <- trees[[branch.length]]
666
-    fortify(phylo, layout=layout, ladderize = ladderize, right=right, mrsd=mrsd, ...)
667
-}
668 579
 
669 580
 ##' @method fortify obkData
670 581
 ##' @export
... ...
@@ -94,16 +94,16 @@ groupClade.ggtree <- function(object, nodes, group_name) {
94 94
     df <- object$data
95 95
     df[, group_name] <- 0
96 96
     for (node in nodes) {
97
-        df <- groupClade.df(df, node, group_name)
97
+        df <- groupClade.tbl(df, node, group_name)
98 98
     }
99
-    df[, group_name] <- factor(df[, group_name])
99
+    df[, group_name] <- factor(df[[group_name]])
100 100
     object$data <- df
101 101
     return(object)
102 102
 }
103 103
 
104
-groupClade.df <- function(df, node, group_name) {
104
+groupClade.tbl <- function(df, node, group_name) {
105 105
     foc <- c(node, get.offspring.df(df, node))
106 106
     idx <- match(foc, df$node)
107
-    df[idx, group_name] <- max(df[, group_name]) + 1
107
+    df[idx, group_name] <- max(df[[group_name]]) + 1
108 108
     return(df)
109 109
 }
... ...
@@ -191,30 +191,30 @@ setMethod("groupOTU", signature(object="ggtree"),
191 191
 
192 192
 groupOTU.ggtree <- function(object, focus, group_name, ...) {
193 193
     df <- object$data
194
-    df[, group_name] <- 0
195
-    object$data <- groupOTU.df(df, focus, group_name, ...)
194
+    df[[group_name]] <- 0
195
+    object$data <- groupOTU.tbl(df, focus, group_name, ...)
196 196
     return(object)
197 197
 }
198 198
 
199 199
 
200
-groupOTU.df <- function(df, focus, group_name, ...) {
200
+groupOTU.tbl <- function(df, focus, group_name, ...) {
201 201
     if (is(focus, "list")) {
202 202
         for (i in 1:length(focus)) {
203
-            df <- gfocus.df(df, focus[[i]], group_name, names(focus)[i], ...)
203
+            df <- gfocus.tbl(df, focus[[i]], group_name, names(focus)[i], ...)
204 204
         }
205 205
     } else {
206
-        df <- gfocus.df(df, focus, group_name, ...)
206
+        df <- gfocus.tbl(df, focus, group_name, ...)
207 207
     }
208
-    df[, group_name] <- factor(df[, group_name])
208
+    df[[group_name]] <- factor(df[[group_name]])
209 209
     return(df)
210 210
 }
211 211
 
212
-gfocus.df <- function(df, focus, group_name, focus_label=NULL, overlap="overwrite") {
212
+gfocus.tbl <- function(df, focus, group_name, focus_label=NULL, overlap="overwrite") {
213 213
     overlap <- match.arg(overlap, c("origin", "overwrite", "abandon"))
214 214
 
215 215
     focus <- df$node[which(df$label %in% focus)]
216 216
     if (is.null(focus_label))
217
-        focus_label <- max(suppressWarnings(as.numeric(df[, group_name])), na.rm=TRUE) + 1
217
+        focus_label <- max(suppressWarnings(as.numeric(df[[group_name]])), na.rm=TRUE) + 1
218 218
 
219 219
     if (length(focus) == 1) {
220 220
         hit <- match(focus, df$node)
... ...
@@ -231,7 +231,7 @@ gfocus.df <- function(df, focus, group_name, focus_label=NULL, overlap="overwrit
231 231
         hit <- match(foc, df$node)
232 232
     }
233 233
 
234
-    foc <- df[, group_name]
234
+    foc <- df[[group_name]]
235 235
     if (overlap == "origin") {
236 236
         sn <- hit[is.na(foc[hit]) | foc[hit] == 0]
237 237
     } else if (overlap == "abandon") {
... ...
@@ -78,12 +78,12 @@ setMethod("gzoom", signature(object="ggtree"),
78 78
 ##               gzoom.phylo(get.tree(object), focus, subtree, widths)
79 79
 ##           })
80 80
 
81
-##' @rdname gzoom-methods
82
-##' @exportMethod gzoom
83
-setMethod("gzoom", signature(object="codeml"),
84
-          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
85
-              gzoom.phylo(get.tree(object), focus, subtree, widths)
86
-          })
81
+## ##' @rdname gzoom-methods
82
+## ##' @exportMethod gzoom
83
+## setMethod("gzoom", signature(object="codeml"),
84
+##           function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
85
+##               gzoom.phylo(get.tree(object), focus, subtree, widths)
86
+##           })
87 87
 
88 88
 ##' zoom selected subtree
89 89
 ##'
... ...
@@ -96,12 +96,12 @@ setMethod("gzoom", signature(object="treedata"),
96 96
           })
97 97
 
98 98
 
99
-##' @rdname gzoom-methods
100
-##' @exportMethod gzoom
101
-setMethod("gzoom", signature(object="paml_rst"),
102
-          function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
103
-              gzoom.phylo(get.tree(object), focus, subtree, widths)
104
-          })
99
+## ##' @rdname gzoom-methods
100
+## ##' @exportMethod gzoom
101
+## setMethod("gzoom", signature(object="paml_rst"),
102
+##           function(object, focus, subtree=FALSE, widths=c(.3, .7)) {
103
+##               gzoom.phylo(get.tree(object), focus, subtree, widths)
104
+##           })
105 105
 
106 106
 
107 107
 ##' @rdname gzoom-methods
... ...
@@ -18,12 +18,12 @@ setMethod("scale_color", signature(object="treedata"),
18 18
               scale_color_(object, by, ...)
19 19
           })
20 20
 
21
-##' @rdname scale_color-methods
22
-##' @exportMethod scale_color
23
-setMethod("scale_color", signature(object="paml_rst"),
24
-          function(object, by, ...) {
25
-              scale_color_(object, by, ...)
26
-          })
21
+## ##' @rdname scale_color-methods
22
+## ##' @exportMethod scale_color
23
+## setMethod("scale_color", signature(object="paml_rst"),
24
+##           function(object, by, ...) {
25
+##               scale_color_(object, by, ...)
26
+##           })
27 27
 
28 28
 
29 29
 ##' @rdname scale_color-methods
30 30
deleted file mode 100644
... ...
@@ -1,175 +0,0 @@
1
-## ##' @rdname show-methods
2
-## ##' @importFrom ape print.phylo
3
-## ##' @exportMethod show
4
-## setMethod("show", signature(object = "beast"),
5
-##           function(object) {
6
-##               cat("'beast' S4 object that stored information of\n\t",
7
-##                   paste0("'", object@file, "'.\n\n"))
8
-##               cat("...@ tree: ")
9
-##               print.phylo(get.tree(object))
10
-##               cat("\nwith the following features available:\n")
11
-##               print_fields(object)
12
-##           })
13
-
14
-## ##' @rdname show-methods
15
-## ##' @exportMethod show
16
-## setMethod("show", signature(object = "codeml"),
17
-##           function(object) {
18
-##               cat("'codeml' S4 object that stored information of\n\t",
19
-##                   paste0("'", object@rst@rstfile, "' and \n\t'",
20
-##                          object@mlc@mlcfile, "'."),
21
-##                   "\n\n")
22
-##               cat("...@ tree:")
23
-##               print.phylo(get.tree(object))
24
-##               cat("\nwith the following features available:\n")
25
-##               print_fields(object, len=4)
26
-##           })
27
-
28
-## ##' @rdname show-methods
29
-## ##' @exportMethod show
30
-## setMethod("show", signature(object = "codeml_mlc"),
31
-##           function(object) {
32
-##               cat("'codeml_mlc' S4 object that stored information of\n\t",
33
-##                   paste0("'", object@mlcfile, "'."),
34
-##                   "\n\n")
35
-
36
-##               cat("...@ tree:")
37
-##               print.phylo(get.tree(object))
38
-
39
-##               cat("\nwith the following features available:\n")
40
-##               cat("\t", paste0("'",
41
-##                                  paste(get.fields(object), collapse="',\t'"),
42
-##                                  "'."),
43
-##                   "\n")
44
-##           }
45
-##           )
46
-
47
-## ##' show method for \code{jplace} instance
48
-## ##'
49
-## ##'
50
-## ##' @name show
51
-## ##' @docType methods
52
-## ##' @rdname show-methods
53
-## ##'
54
-## ##' @title show method
55
-## ##' @param object one of \code{jplace}, \code{beast} object
56
-## ##' @return print info
57
-## ##' @importFrom methods show
58
-## ##' @exportMethod show
59
-## ##' @usage show(object)
60
-## ##' @author Guangchuang Yu \url{http://ygc.name}
61
-## ##' @examples
62
-## ##' jp <- system.file("extdata", "sample.jplace", package="ggtree")
63
-## ##' jp <- read.jplace(jp)
64
-## ##' show(jp)
65
-## setMethod("show", signature(object = "jplace"),
66
-##           function(object) {
67
-##               cat("'jplace' S4 object that stored information of\n\t",
68
-##                   paste0("'", object@file, "'."),
69
-##                   "\n\n")
70
-
71
-##               cat("...@ tree: ")
72
-
73
-##               phylo <- get.tree(object)
74
-##               phylo$node.label <- NULL
75
-##               phylo$tip.label %<>% gsub("\\@\\d+", "", .)
76
-
77
-##               print.phylo(phylo)
78
-
79
-##               cat("\nwith the following features availables:\n")
80
-##               cat("\t", paste0("'",
81
-##                                paste(get.fields(object), collapse="',\t'"),
82
-##                                "'."),
83
-##                   "\n")
84
-##           }
85
-##           )
86
-
87
-
88
-## ##' @rdname show-methods
89
-## ##' @exportMethod show
90
-## setMethod("show", signature(object = "nhx"),
91
-##           function(object) {
92
-##               cat("'nhx' S4 object that stored information of\n\t",
93
-##                   paste0("'", object@file, "'.\n\n"))
94
-##               cat("...@ tree: ")
95
-##               print.phylo(get.tree(object))
96
-##               cat("\nwith the following features available:\n")
97
-##               print_fields(object)
98
-##           })
99
-
100
-
101
-## ##' @rdname show-methods
102
-## ##' @exportMethod show
103
-## setMethod("show", signature(object = "phylip"),
104
-##           function(object) {
105
-##               cat("'phylip' S4 object that stored information of\n\t",
106
-##                   paste0("'", object@file, "'.\n\n"))
107
-##               cat("...@ tree: ")
108
-##               print.phylo(get.tree(object))
109
-##               msg <- paste0("\nwith sequence alignment available (", length(object@sequence),
110
-##                             " sequences of length ", nchar(object@sequence)[1], ")\n")
111
-##               cat(msg)
112
-##           })
113
-
114
-## ##' @rdname show-methods
115
-## ##' @exportMethod show
116
-## setMethod("show", signature(object = "paml_rst"),
117
-##           function(object) {
118
-##               cat("'paml_rst' S4 object that stored information of\n\t",
119
-##                   paste0("'", object@rstfile, "'.\n\n"))
120
-##               ## if (length(object@tip.fasfile) != 0) {
121
-##               ##     cat(paste0(" and \n\t'", object@tip.fasfile, "'.\n\n"))
122
-##               ## } else {
123
-##               ##     cat(".\n\n")
124
-##               ## }
125
-##               fields <- get.fields(object)
126
-
127
-##               if (nrow(object@marginal_subs) == 0) {
128
-##                   fields <- fields[fields != "marginal_subs"]
129
-##                   fields <- fields[fields != "marginal_AA_subs"]
130
-##               }
131
-##               if (nrow(object@joint_subs) == 0) {
132
-##                   fields <- fields[fields != "joint_subs"]
133
-##                   fields <- fields[fields != "joint_AA_subs"]
134
-##               }
135
-
136
-##               cat("...@ tree:")
137
-##               print.phylo(get.tree(object))
138
-##               cat("\nwith the following features available:\n")
139
-##               cat("\t", paste0("'",
140
-##                                paste(fields, collapse="',\t'"),
141
-##                                "'."),
142
-##                   "\n")
143
-##           })
144
-
145
-
146
-
147
-## ##' @rdname show-methods
148
-## ##' @importFrom ape print.phylo
149
-## ##' @exportMethod show
150
-## setMethod("show", signature(object = "r8s"),
151
-##           function(object) {
152
-##               cat("'r8s' S4 object that stored information of\n\t",
153
-##                   paste0("'", object@file, "'.\n\n"))
154
-##               cat("...@ tree: ")
155
-##               print.phylo(get.tree(object))
156
-##               ## cat("\nwith the following features available:\n")
157
-##               ## print_fields(object)
158
-##           })
159
-
160
-
161
-## ##' @rdname show-methods
162
-## ##' @importFrom ape print.phylo
163
-## ##' @exportMethod show
164
-## setMethod("show", signature(object = "phangorn"),
165
-##           function(object) {
166
-##               cat("'phangorn' S4 object that stored ancestral sequences inferred by 'phangorn::ancestral.pml'", ".\n\n")
167
-##               cat("...@ tree: ")
168
-##               print.phylo(get.tree(object))
169
-##               fields <- get.fields(object)
170
-##               cat("\nwith the following features available:\n")
171
-##               cat("\t", paste0("'",
172
-##                                paste(fields, collapse="',\t'"),
173
-##                                "'."),
174
-##                   "\n")
175
-##           })
... ...
@@ -1,27 +1,63 @@
1 1
 ##' @importFrom ggplot2 fortify
2 2
 ##' @method fortify treedata
3 3
 ##' @export
4
-fortify.treedata <- function(model, data, layout="rectangular", yscale="none",
5
-                             ladderize=TRUE, right=FALSE, branch.length ="branch.length",
6
-                             mrsd=NULL, as.Date = FALSE, ...) {
4
+fortify.treedata <- function(model, data,
5
+                             layout        = "rectangular",
6
+                             yscale        = "none",
7
+                             ladderize     = TRUE,
8
+                             right         = FALSE,
9
+                             branch.length = "branch.length",
10
+                             mrsd          = NULL,
11
+                             as.Date       = FALSE, ...) {
7 12
 
8 13
     model <- set_branch_length(model, branch.length)
9 14
 
10
-    x <- reorder.phylo(get.tree(model), "postorder")
15
+    fortify.phylo(model, data,
16
+                  layout        = layout,
17
+                  yscale        = yscale,
18
+                  ladderize     = ladderize,
19
+                  right         = right,
20
+                  branch.length = branch.length,
21
+                  mrsd          = mrsd,
22
+                  as.Date       = as.Date, ...)
23
+}
24
+
25
+##' @importFrom ape ladderize
26
+##' @method fortify phylo
27
+##' @export
28
+fortify.phylo <- function(model, data,
29
+                          layout        = "rectangular",
30
+                          ladderize     = TRUE,
31
+                          right         = FALSE,
32
+                          branch.length = "branch.length",
33
+                          mrsd          = NULL,
34
+                          as.Date       = FALSE,
35
+                          yscale        = "none",
36
+                          ...) {
37
+
38
+    x <- as.phylo(model) ## reorder.phylo(get.tree(model), "postorder")
11 39
     if (ladderize == TRUE) {
12 40
         x <- ladderize(x, right=right)
13 41
     }
42
+
43
+    if (! is.null(x$edge.length)) {
44
+        if (anyNA(x$edge.length)) {
45
+            warning("'edge.length' contains NA values...\n## setting 'edge.length' to NULL automatically when plotting the tree...")
46
+            x$edge.length <- NULL
47
+        }
48
+    }
49
+
14 50
     if (is.null(x$edge.length) || branch.length == "none") {
15 51
         xpos <- getXcoord_no_length(x)
16 52
     } else {
17 53
         xpos <- getXcoord(x)
18 54
     }
55
+
19 56
     ypos <- getYcoord(x)
20 57
     N <- Nnode(x, internal.only=FALSE)
21 58
     xypos <- data_frame(node=1:N, x=xpos, y=ypos)
22 59
 
23
-    df <- as_data_frame(model, branch.length="branch.length") # already set by set_branch_length
24
-    ##rownames(df) <- as.character(df$node)
60
+    df <- as_data_frame(model)
25 61
 
26 62
     res <- full_join(df, xypos, by = "node")
27 63
 
... ...
@@ -41,15 +77,14 @@ fortify.treedata <- function(model, data, layout="rectangular", yscale="none",
41 77
     scaleY(as.phylo(model), res, yscale, layout, ...)
42 78
 }
43 79
 
80
+
44 81
 ##' @method as_data_frame treedata
45 82
 ##' @importFrom tibble as_data_frame
46 83
 ##' @export
47
-## @importFrom treeio Nnode
48
-## @importFrom treeio Ntip
49
-as_data_frame.treedata <- function(x, branch.length = "branch.length", ...) {
50
-    tree <- set_branch_length(x, branch.length)
51
-
52
-    res <- as_data_frame(tree@phylo)
84
+##' @importFrom treeio Nnode
85
+##' @importFrom treeio Ntip
86
+as_data_frame.treedata <- function(x, ...) {
87
+    res <- as_data_frame(x@phylo)
53 88
     tree_anno <- as_data_frame(get_tree_data(x))
54 89
     if (nrow(tree_anno) > 0) {
55 90
         by <- "node"
... ...
@@ -109,24 +144,17 @@ as_data_frame.phylo <- function(x, ...) {
109 144
 }
110 145
 
111 146
 get_tree_data <- function(tree_object) {
112
-    if (is(tree_object, "codeml")) {
113
-        tree_anno <- tree_object@mlc@dNdS
114
-    } else if (is(tree_object, "codeml_mlc")) {
115
-        tree_anno <- tree_object@dNdS
116
-    } else if (is(tree_object, "beast")) {
117
-        tree_anno <- tree_object@stats
118
-    } else {
119
-        tree_anno <- tree_object@data
120
-    }
147
+    tree_anno <- tree_object@data
148
+    extraInfo <- tree_object@extraInfo
121 149
 
122
-    if (has.extraInfo(tree_object)) {
123
-        if (nrow(tree_anno) > 0) {
124
-            tree_anno <- merge(tree_anno, tree_object@extraInfo, by="node")
125
-        } else {
126
-            return(tree_object@extraInfo)
127
-        }
150
+    if (nrow(tree_anno) == 0) {
151
+        return(extraInfo)
128 152
     }
129
-    return(tree_anno)
153
+    if (nrow(extraInfo) == 0) {
154
+        return(tree_anno)
155
+    }
156
+
157
+    full_join(tree_anno, extraInfo, by = "node")
130 158
 }
131 159
 
132 160
 
... ...
@@ -915,7 +943,7 @@ getChild.df <- function(df, node) {
915 943
     if (length(i) == 0) {
916 944
         return(0) # it has no children, hence tip node.
917 945
     }
918
-    res <- df[i, "node"]
946
+    res <- df$node[i]
919 947
     res <- res[res != node] ## node may root
920 948
     return(res)
921 949
 }
... ...
@@ -1676,6 +1704,8 @@ set_branch_length <- function(tree_object, branch.length) {
1676 1704
 
1677 1705
 ##     return(phylo)
1678 1706
 ## }
1707
+
1708
+
1679 1709
 re_assign_ycoord_df <- function(df, currentNode) {
1680 1710
     while(anyNA(df$y)) {
1681 1711
         pNode <- with(df, parent[match(currentNode, node)]) %>% unique
... ...
@@ -1,13 +1,8 @@
1 1
 has.slot <- treeio:::has.slot
2 2
 getNodeNum <- treeio:::getNodeNum
3
-Ntip <- treeio:::Ntip
4
-Nnode <- treeio:::Nnode
5 3
 getRoot <- treeio:::getRoot
6 4
 has.field <- treeio:::has.field
7
-is.character_beast <- treeio:::is.character_beast
8 5
 append_extraInfo <- treeio:::append_extraInfo
9
-get.subs <- treeio:::get.subs
10
-
11 6
 get.tree <- treeio::get.tree
12 7
 drop.tip <- treeio::drop.tip
13 8
 get.fields <- treeio::get.fields
... ...
@@ -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
-[![releaseVersion](https://img.shields.io/badge/release%20version-1.10.0-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.11.2-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) [![total](https://img.shields.io/badge/downloads-21911/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1156/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
7
+[![releaseVersion](https://img.shields.io/badge/release%20version-1.10.0-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.11.2-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) [![total](https://img.shields.io/badge/downloads-22066/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1218/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--12--05-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--12--07-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) [![Backers on Open Collective](https://opencollective.com/ggtree/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/ggtree/sponsors/badge.svg)](#sponsors)
12 12
 
... ...
@@ -27,7 +27,7 @@ Please cite the following article when using `ggtree`:
27 27
 
28 28
 **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ***Methods in Ecology and Evolution***. 2017, 8(1):28-36.
29 29
 
30
-[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![Altmetric](https://img.shields.io/badge/Altmetric-333-green.svg?style=flat)](https://www.altmetric.com/details/10533079) [![citation](https://img.shields.io/badge/cited%20by-52-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
30
+[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![Altmetric](https://img.shields.io/badge/Altmetric-334-green.svg?style=flat)](https://www.altmetric.com/details/10533079) [![citation](https://img.shields.io/badge/cited%20by-52-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627)
31 31
 
32 32
 ------------------------------------------------------------------------
33 33
 
... ...
@@ -37,7 +37,7 @@ Please cite the following article when using `ggtree`:
37 37
 
38 38
 ### Download stats
39 39
 
40
-[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree) [![total](https://img.shields.io/badge/downloads-21911/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1156/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
40
+[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree) [![total](https://img.shields.io/badge/downloads-22066/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1218/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
41 41
 
42 42
 <img src="docs/images/dlstats.png" width="890"/>
43 43
 
44 44
Binary files a/docs/images/dlstats.png and b/docs/images/dlstats.png differ
45 45
deleted file mode 100644
... ...
@@ -1,35 +0,0 @@
1
-% Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/method-fortify.R
3
-\name{fortify.phylo}
4
-\alias{fortify.phylo}
5
-\title{fortify}
6
-\usage{
7
-\method{fortify}{phylo}(model, data, layout = "rectangular",
8
-  ladderize = TRUE, right = FALSE, mrsd = NULL, as.Date = FALSE, ...)
9
-}
10
-\arguments{
11
-\item{model}{phylo object}
12
-
13
-\item{data}{not use here}
14
-
15
-\item{layout}{layout}
16
-
17
-\item{ladderize}{ladderize, logical}
18
-
19
-\item{right}{logical}
20
-
21
-\item{mrsd}{most recent sampling date}
22
-
23
-\item{as.Date}{logical whether using Date class in time tree}
24
-
25
-\item{...}{additional parameter}
26
-}
27
-\value{
28
-data.frame
29
-}
30
-\description{
31
-fortify a phylo to data.frame
32
-}
33
-\author{
34
-Yu Guangchuang
35
-}
... ...
@@ -5,9 +5,7 @@
5 5
 \alias{gzoom}
6 6
 \alias{gzoom}
7 7
 \alias{gzoom,ggtree-method}
8
-\alias{gzoom,codeml-method}
9 8
 \alias{gzoom,treedata-method}
10
-\alias{gzoom,paml_rst-method}
11 9
 \alias{gzoom,phylo-method}
12 10
 \title{gzoom method}
13 11
 \usage{
... ...
@@ -16,15 +14,9 @@ gzoom(object, focus, subtree = FALSE, widths = c(0.3, 0.7), ...)
16 14
 \S4method{gzoom}{ggtree}(object, focus, widths = c(0.3, 0.7),
17 15
   xmax_adjust = 0)
18 16
 
19
-\S4method{gzoom}{codeml}(object, focus, subtree = FALSE, widths = c(0.3,
20
-  0.7))
21
-
22 17
 \S4method{gzoom}{treedata}(object, focus, subtree = FALSE, widths = c(0.3,
23 18
   0.7))
24 19
 
25
-\S4method{gzoom}{paml_rst}(object, focus, subtree = FALSE, widths = c(0.3,
26
-  0.7))
27
-
28 20
 \S4method{gzoom}{phylo}(object, focus, subtree = FALSE, widths = c(0.3,
29 21
   0.7))
30 22
 }
... ...
@@ -4,7 +4,6 @@
4 4
 \name{scale_color}
5 5
 \alias{scale_color}
6 6
 \alias{scale_color,treedata-method}
7
-\alias{scale_color,paml_rst-method}
8 7
 \alias{scale_color,phylo-method}
9 8
 \title{scale_color method}
10 9
 \usage{
... ...
@@ -12,8 +11,6 @@ scale_color(object, by, ...)
12 11
 
13 12
 \S4method{scale_color}{treedata}(object, by, ...)
14 13
 
15
-\S4method{scale_color}{paml_rst}(object, by, ...)
16
-
17 14
 \S4method{scale_color}{phylo}(object, by, ...)
18 15
 }
19 16
 \arguments{