Browse code

move scale-color-subtree to ggtreeDendro

Guangchuang Yu authored on 23/09/2022 02:52:18
Showing7 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: ggtree
2 2
 Type: Package
3 3
 Title: an R package for visualization of tree and annotation data
4
-Version: 3.5.3
4
+Version: 3.5.3.001
5 5
 Authors@R: c(
6 6
        person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), 
7 7
             comment = c(ORCID = "0000-0002-6485-8781")),
... ...
@@ -21,7 +21,6 @@ S3method(fortify,treedataList)
21 21
 S3method(fortify,twins)
22 22
 S3method(ggplot_add,cladelab)
23 23
 S3method(ggplot_add,cladelabel)
24
-S3method(ggplot_add,color_subtree)
25 24
 S3method(ggplot_add,facet_plot)
26 25
 S3method(ggplot_add,facet_xlim)
27 26
 S3method(ggplot_add,geom_range)
... ...
@@ -269,8 +268,6 @@ importFrom(rlang,abort)
269 268
 importFrom(rlang,as_name)
270 269
 importFrom(rlang,quo_name)
271 270
 importFrom(scales,alpha)
272
-importFrom(stats,as.hclust)
273
-importFrom(stats,cutree)
274 271
 importFrom(tidyr,gather)
275 272
 importFrom(tidytree,MRCA)
276 273
 importFrom(tidytree,ancestor)
... ...
@@ -24,6 +24,11 @@
24 24
   - <https://github.com/thomasp85/ggraph/commit/14de66f1225336179b4598cb42a4beda95682211>
25 25
 
26 26
 -->
27
+
28
+# ggtree 3.5.3.001
29
+
30
++ move `scale_color_subtree()` to the 'ggtreeDendro' package (2022-09-23, Fri)
31
+
27 32
 # ggtree 3.5.3
28 33
 
29 34
 + update `fortify` method for `pvclust` object (2022-08-15, Mon)
... ...
@@ -1,3 +1,25 @@
1
+## defunct since v=3.5.3
2
+
3
+##' scale tree color by subtree (e.g., output of cutree, kmeans, or other clustering algorithm)
4
+##'
5
+##' 
6
+##' @title scale_color_subtree
7
+##' @rdname scale-color-subtree
8
+##' @param group taxa group information
9
+##' @return updated tree view
10
+##' @export
11
+##' @author Guangchuang Yu
12
+scale_color_subtree <- function(group) {
13
+    message("This scale function was moved to the ggtreeDendro package\n",
14
+        "please use 'ggtreeDendro::scale_color_subtree' instead.\n")
15
+    NULL
16
+}
17
+
18
+##' @rdname scale-color-subtree
19
+##' @export
20
+scale_colour_subtree <- scale_color_subtree
21
+
22
+
1 23
 ## ##' annotation taxa with images
2 24
 ## ##'
3 25
 ## ##'
... ...
@@ -174,11 +174,7 @@ ggexpand_internal <- function(plot, ratio, direction, var) {
174 174
     return(res)
175 175
 }
176 176
 
177
-##' @method ggplot_add color_subtree
178
-##' @export
179
-ggplot_add.color_subtree <- function(object, plot, object_name) {
180
-    scale_color_subtree_(plot, object)
181
-}
177
+
182 178
 
183 179
 ##' @method ggplot_add tree_inset
184 180
 ##' @export
... ...
@@ -1,38 +1,4 @@
1
-##' scale tree color by subtree (e.g., output of cutree, kmeans, or other clustering algorithm)
2
-##'
3
-##' 
4
-##' @title scale_color_subtree
5
-##' @rdname scale-color-subtree
6
-##' @param group taxa group information
7
-##' @return updated tree view
8
-##' @export
9
-##' @author Guangchuang Yu
10
-scale_color_subtree <- function(group) {
11
-    if (inherits(group, 'kmeans')) {
12
-        group <- group$cluster
13
-    } 
14
-
15
-    structure(group,
16
-              class = 'color_subtree'
17
-              )
18
-}
19 1
 
20
-##' @rdname scale-color-subtree
21
-##' @importFrom stats as.hclust
22
-##' @importFrom stats cutree
23
-##' @export
24
-scale_colour_subtree <- scale_color_subtree
25
-
26
-scale_color_subtree_ <- function(p, group) {
27
-
28
-    if (is.numeric(group) && length(group) == 1) {
29
-        group <- cutree(as.hclust(as.phylo(p$data)), group)
30
-    } 
31
-
32
-    g <- split(names(group), group)
33
-    groupOTU(p, g, group_name = 'subtree') +
34
-        aes_(color = ~subtree)
35
-}
36 2
 
37 3
 ##' scale color by a numerical tree attribute
38 4
 ##'
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/method-scale-color.R
2
+% Please edit documentation in R/defunct.R
3 3
 \name{scale_color_subtree}
4 4
 \alias{scale_color_subtree}
5 5
 \alias{scale_colour_subtree}