Browse code

reduce dependency

Guangchuang Yu authored on 27/01/2019 23:14:00
Showing 9 changed files

... ...
@@ -20,15 +20,12 @@ Imports:
20 20
     ape,
21 21
     dplyr,
22 22
     ggplot2 (>= 3.0.0),
23
-    grDevices,
24 23
     grid,
25 24
     magrittr,
26 25
     methods,
27 26
     purrr,
28 27
     rlang,
29 28
     rvcheck (>= 0.1.0),
30
-    scales,
31
-    tibble,
32 29
     tidyr,
33 30
     tidytree (>= 0.1.9),
34 31
     treeio (>= 1.3.14),
... ...
@@ -37,10 +34,13 @@ Suggests:
37 34
     emojifont,
38 35
     ggimage,
39 36
     ggplotify,
37
+    grDevices,
40 38
     knitr,
41 39
     prettydoc,
42 40
     rmarkdown,
43
-    testthat
41
+    scales,
42
+    testthat,
43
+    tibble
44 44
 Remotes:
45 45
     GuangchuangYu/treeio
46 46
 VignetteBuilder: knitr
... ...
@@ -190,7 +190,6 @@ importFrom(ggplot2,xlab)
190 190
 importFrom(ggplot2,xlim)
191 191
 importFrom(ggplot2,ylab)
192 192
 importFrom(ggplot2,ylim)
193
-importFrom(grDevices,colorRampPalette)
194 193
 importFrom(graphics,identify)
195 194
 importFrom(grid,convertX)
196 195
 importFrom(grid,convertY)
... ...
@@ -214,9 +213,6 @@ importFrom(methods,setGeneric)
214 213
 importFrom(methods,setOldClass)
215 214
 importFrom(rlang,.data)
216 215
 importFrom(rvcheck,get_aes_var)
217
-importFrom(rvcheck,get_fun_from_pkg)
218
-importFrom(scales,alpha)
219
-importFrom(tibble,data_frame)
220 216
 importFrom(tidyr,gather)
221 217
 importFrom(tidytree,MRCA)
222 218
 importFrom(tidytree,as_tibble)
... ...
@@ -8,7 +8,7 @@
8 8
 ##' @param ... additional parameters
9 9
 ##' @return geom layer
10 10
 ##' @export
11
-##' @author guangchuang yu
11
+##' @author Guangchuang Yu
12 12
 geom_motif <- function(mapping, data, on, ...) {
13 13
     if (is.null(unlist(mapping)$y)) {
14 14
         seqnames <- as.character(unlist(mapping)$group)
... ...
@@ -107,7 +107,7 @@ scale_x_ggtree <- function(tree_view, breaks=NULL, labels=NULL) {
107 107
     }
108 108
 
109 109
     if (is.null(breaks)) {
110
-        breaks <- hist(x, breaks=5, plot=FALSE)$breaks
110
+        breaks <- graphics::hist(x, breaks=5, plot=FALSE)$breaks
111 111
     }
112 112
     m <- attr(p, "mapping")
113 113
 
... ...
@@ -266,8 +266,7 @@ coplot <- function(tree1, tree2, hjust=0) {
266 266
 ##' @param alpha transparency of color
267 267
 ##' @return updated ggtree object
268 268
 ##' @export
269
-##' @importFrom scales alpha
270
-##' @author guangchuang yu
269
+##' @author Guangchuang Yu
271 270
 set_hilight_legend <- function(p, color, label, alpha=1) {
272 271
 	d <- data.frame(color=color, clade=label, x=0, y=1, alpha=alpha)
273 272
 	p + geom_rect(aes_(fill=~clade, xmin=~x, xmax=~x, ymin=~y, ymax=~y), data=d, inherit.aes=F) +
... ...
@@ -3,13 +3,12 @@
3 3
 
4 4
 ### draw_key_hack
5 5
 
6
-##' @importFrom scales alpha
7 6
 ##' @importFrom grid grobTree
8 7
 ##' @importFrom grid rectGrob
9 8
 ##' @importFrom grid gpar
10 9
 draw_key_hack <- function(data, params, size) {
11 10
   print('draw_key_hack') ##DEBUG
12
-  data$fill <- alpha(data$fill, data$alpha)
11
+  data$fill <- scales::alpha(data$fill, data$alpha)
13 12
   data$alpha <- 1
14 13
 
15 14
   grobTree(
... ...
@@ -1,7 +1,6 @@
1 1
 ##' @importFrom ape ladderize
2 2
 ##' @importFrom treeio as.phylo
3 3
 ##' @importFrom treeio Nnode
4
-##' @importFrom tibble data_frame
5 4
 ##' @importFrom dplyr full_join
6 5
 ##' @importFrom dplyr mutate_
7 6
 ##' @importFrom tidytree as_tibble
... ...
@@ -40,7 +39,7 @@ fortify.phylo <- function(model, data,
40 39
 
41 40
         ypos <- getYcoord(x)
42 41
         N <- Nnode(x, internal.only=FALSE)
43
-        xypos <- data_frame(node=1:N, x=xpos, y=ypos)
42
+        xypos <- tibble::data_frame(node=1:N, x=xpos, y=ypos)
44 43
 
45 44
         df <- as_tibble(model) %>%
46 45
             mutate_(isTip = ~(! node %in% parent))
... ...
@@ -117,7 +117,7 @@ msaplot <- function(p, fasta, offset=0, width=1, color=NULL, window=NULL, bg_lin
117 117
                        data=msa.df, inherit.aes = FALSE) +
118 118
                                scale_fill_manual(values=color)
119 119
 
120
-    breaks <- hist(seq_along(slice), breaks=10, plot=FALSE)$breaks
120
+    breaks <- graphics::hist(seq_along(slice), breaks=10, plot=FALSE)$breaks
121 121
     pos <- start + breaks * width
122 122
     mapping <- data.frame(from=breaks+1, to=pos)
123 123
     attr(p, "mapping") <- mapping
... ...
@@ -93,7 +93,7 @@ roundDigit <- function(d) {
93 93
 
94 94
 
95 95
 ## from ChIPseeker
96
-##' @importFrom grDevices colorRampPalette
96
+## @importFrom grDevices colorRampPalette
97 97
 getCols <- function (n) {
98 98
     col <- c("#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3",
99 99
              "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd",
... ...
@@ -104,12 +104,9 @@ getCols <- function (n) {
104 104
     col3 <- c("#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99",
105 105
               "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a",
106 106
               "#ffff99", "#b15928")
107
-    colorRampPalette(col3)(n)
107
+    grDevices::colorRampPalette(col3)(n)
108 108
 }
109 109
 
110
-##' @importFrom rvcheck get_fun_from_pkg
111
-hist <- get_fun_from_pkg("graphics", "hist")
112
-
113 110
 
114 111
 ##
115 112
 ##
... ...
@@ -22,5 +22,5 @@ geom layer
22 22
 geom layer to draw aligned motif
23 23
 }
24 24
 \author{
25
-guangchuang yu
25
+Guangchuang Yu
26 26
 }
... ...
@@ -22,5 +22,5 @@ updated ggtree object
22 22
 set legend for multiple geom_hilight layers
23 23
 }
24 24
 \author{
25
-guangchuang yu
25
+Guangchuang Yu
26 26
 }