Browse code

message for defunct functions

guangchuang yu authored on 23/03/2017 03:40:26
Showing 6 changed files

... ...
@@ -1,5 +1,8 @@
1 1
 CHANGES IN VERSION 1.7.10
2 2
 ------------------------
3
+ o add message for subview, inset, phylopic, theme_transparent and theme_inset <2017-03-23, Thu>
4
+   + will be defunct in version >= 1.9.0
5
+   + user should use ggimage package to annotate tree with graphic object or image file
3 6
  o update subview to support mainview produced by `ggplot() + layers` <2017-03-13, Mon>
4 7
 
5 8
 CHANGES IN VERSION 1.7.9
... ...
@@ -17,6 +17,8 @@
17 17
 inset <- function(tree_view, insets, width=0.1, height=0.1, hjust=0, vjust=0,
18 18
                   x="node", reverse_x=FALSE, reverse_y=FALSE) {
19 19
 
20
+    message("The inset function will be defunct in next release, please use ggimage::geom_subview() instead.")
21
+
20 22
     df <- tree_view$data[as.numeric(names(insets)),]
21 23
     x <- match.arg(x, c("node", "branch", "edge"))
22 24
 
... ...
@@ -1,6 +1,6 @@
1 1
 ##' download phylopic and convert to grob object
2 2
 ##'
3
-##' 
3
+##'
4 4
 ##' @title get.phylopic
5 5
 ##' @param id phylopic id
6 6
 ##' @param size size of the phylopic
... ...
@@ -34,9 +34,9 @@ download.phylopic <- function(id, size=512, color="black", alpha=1) {
34 34
 
35 35
     channel <- get_fun_from_pkg("EBImage", "channel")
36 36
     readImage <- get_fun_from_pkg("EBImage", "readImage")
37
-    
37
+
38 38
     img <- readImage(imgfile)
39
-       
39
+
40 40
     color <- col2rgb(color) / 255
41 41
 
42 42
     img <- channel(img, 'rgb')
... ...
@@ -44,7 +44,7 @@ download.phylopic <- function(id, size=512, color="black", alpha=1) {
44 44
     img[,,2] <- color[2]
45 45
     img[,,3] <- color[3]
46 46
     img[,,4] <- img[,,4]*alpha
47
-    
47
+
48 48
     return(img)
49 49
 }
50 50
 
... ...
@@ -59,13 +59,13 @@ download.phylopic_internal <- function(id, size=512, outfile=NULL) {
59 59
         outfile <- sub(".*/", "", imgurl)
60 60
     }
61 61
     ## mode = "wb" for Windows platform
62
-    download.file(imgurl, outfile, mode="wb", quiet = TRUE) 
62
+    download.file(imgurl, outfile, mode="wb", quiet = TRUE)
63 63
 }
64 64
 
65 65
 
66 66
 ##' add phylopic layer
67 67
 ##'
68
-##' 
68
+##'
69 69
 ##' @title phylopic
70 70
 ##' @param tree_view tree view
71 71
 ##' @param phylopic_id phylopic id
... ...
@@ -84,6 +84,9 @@ download.phylopic_internal <- function(id, size=512, outfile=NULL) {
84 84
 phylopic <- function(tree_view, phylopic_id,
85 85
                      size=512, color="black", alpha=0.5,
86 86
                      node=NULL, x=NULL, y=NULL, width=.1) {
87
+
88
+    message("The phylopic function will be defunct in next release, please use ggimage::geom_phylopic() instead.")
89
+
87 90
     width <- diff(range(tree_view$data$x)) * width
88 91
     img <- download.phylopic(phylopic_id, size, color, alpha)
89 92
     if ( is.null(node) ) {
... ...
@@ -104,7 +107,7 @@ phylopic <- function(tree_view, phylopic_id,
104 107
         ymin <- y - AR * width/2
105 108
         ymax <- y + AR * width/2
106 109
     }
107
-    
110
+
108 111
     tree_view + annotation_custom(xmin=xmin, ymin=ymin,
109 112
                                   xmax=xmax, ymax=ymax,
110 113
                                   rasterGrob(img))
... ...
@@ -118,7 +121,7 @@ getAR <- function(img) {
118 121
 
119 122
 ##' annotation taxa with images
120 123
 ##'
121
-##' 
124
+##'
122 125
 ##' @title annotation_image
123 126
 ##' @param tree_view tree view
124 127
 ##' @param img_info data.frame with first column of taxa name and second column of image names
... ...
@@ -149,7 +152,7 @@ annotation_image <- function(tree_view, img_info, width=0.1, align=TRUE, linetyp
149 152
         xmin <- x - width/2 + offset
150 153
     }
151 154
     xmax <- xmin + width
152
-    
155
+
153 156
     ymin <- y - ARs * width/2
154 157
     ymax <- y + ARs * width/2
155 158
     image_layers <- lapply(1:length(xmin), function(i) {
... ...
@@ -15,6 +15,8 @@
15 15
 ##' @export
16 16
 ##' @author Guangchuang Yu
17 17
 subview <- function(mainview, subview, x, y, width=.1, height=.1) {
18
+    message("The subview function will be defunct in next release, please use ggimage::geom_subview() instead.")
19
+
18 20
     mapping <- mainview$mapping %>% as.character
19 21
     aes_x <- mapping["x"]
20 22
     aes_y <- mapping["y"]
... ...
@@ -20,7 +20,7 @@
20 20
 theme_tree <- function(bgcolor="white", fgcolor="black", ...) {
21 21
     list(xlab(NULL),
22 22
          ylab(NULL),
23
-	 theme_tree2_internal() + 
23
+	 theme_tree2_internal() +
24 24
          theme(panel.background=element_rect(fill=bgcolor, colour=bgcolor),
25 25
                axis.line.x = element_blank(),
26 26
                axis.text.x = element_blank(),
... ...
@@ -63,7 +63,7 @@ theme_tree2_internal <- function(bgcolor="white", fgcolor="black",
63 63
                                  axis.line.y=element_blank(),
64 64
                                  axis.ticks.y=element_blank(),
65 65
                                  axis.text.y=element_blank(),...) {
66
-    theme_bw() + 
66
+    theme_bw() +
67 67
         theme(legend.position=legend.position,
68 68
               panel.grid.minor=panel.grid.minor,
69 69
               panel.grid.major=panel.grid.major,
... ...
@@ -88,6 +88,8 @@ theme_tree2_internal <- function(bgcolor="white", fgcolor="black",
88 88
 ##' @export
89 89
 ##' @author Guangchuang Yu
90 90
 theme_transparent <- function(...) {
91
+    message("this theme was moved to ggimage::theme_transparent and will be removed in next release")
92
+
91 93
     theme(panel.background = element_rect(
92 94
               fill = "transparent",
93 95
               colour = NA),
... ...
@@ -95,10 +97,10 @@ theme_transparent <- function(...) {
95 97
               fill = "transparent",
96 98
               colour = NA),
97 99
           legend.key = element_rect(
98
-              fill = "transparent", 
100
+              fill = "transparent",
99 101
               colour = NA),
100 102
           legend.background = element_rect(
101
-              fill = "transparent", 
103
+              fill = "transparent",
102 104
               colour = NA), ...)
103 105
 }
104 106
 
... ...
@@ -111,6 +113,7 @@ theme_transparent <- function(...) {
111 113
 ##' @export
112 114
 ##' @author Guangchuang Yu
113 115
 theme_inset <- function(...) {
116
+    message("this theme will be removed in next release")
114 117
     list(xlab(NULL),
115 118
          ylab(NULL),
116 119
          theme_tree(...),
... ...
@@ -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.6.11-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![](https://img.shields.io/badge/devel%20version-1.7.10-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-13085/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-967/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
7
+[![](https://img.shields.io/badge/release%20version-1.6.11-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![](https://img.shields.io/badge/devel%20version-1.7.10-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-13254/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-967/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--03--21-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--03--23-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) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-green.svg?style=flat)](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html)
12 12
 
... ...
@@ -20,7 +20,7 @@ Please cite the following article when using `ggtree`:
20 20
 
21 21
 **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.
22 22
 
23
-[![](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-11-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![](https://img.shields.io/badge/Altmetric-348-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
23
+[![](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-11-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![](https://img.shields.io/badge/Altmetric-351-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
24 24
 
25 25
 ------------------------------------------------------------------------
26 26
 
... ...
@@ -53,7 +53,7 @@ For details, please visit our project website, <https://guangchuangyu.github.io/
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-13085/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-967/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-13254/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![](https://img.shields.io/badge/download-967/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
57 57
 
58 58
          ++-------------------+-------------------+--------------------+-------------------+-----------+
59 59
          |                                                                                    *        |