Browse code

fix package imports

87875172 authored on 23/04/2019 22:38:31
Showing 4 changed files

... ...
@@ -80,6 +80,7 @@ import(Rcpp)
80 80
 import(RcppEigen)
81 81
 import(ggplot2)
82 82
 import(graphics)
83
+import(grid)
83 84
 import(gridExtra, except = c(combine))
84 85
 import(stats)
85 86
 importFrom(MAST,FromMatrix)
... ...
@@ -103,8 +104,7 @@ importFrom(grDevices,colorRampPalette)
103 104
 importFrom(grDevices,colors)
104 105
 importFrom(grDevices,hsv)
105 106
 importFrom(grDevices,rgb2hsv)
106
-importFrom(grid,grid.draw)
107
-importFrom(grid,grid.newpage)
107
+importFrom(grid,grid.pretty)
108 108
 importFrom(grid,unit)
109 109
 importFrom(gridExtra,grid.arrange)
110 110
 importFrom(gtable,gtable)
... ...
@@ -118,6 +118,7 @@ importFrom(methods,new)
118 118
 importFrom(plyr,mapvalues)
119 119
 importFrom(reshape2,melt)
120 120
 importFrom(scales,dscale)
121
+importFrom(scales,hue_pal)
121 122
 importFrom(stringi,stri_list2matrix)
122 123
 importFrom(umap,umap)
123 124
 importFrom(umap,umap.defaults)
... ...
@@ -74,8 +74,7 @@
74 74
 #'     z = clusters(celdaCGMod)$z, y = clusters(celdaCGMod)$y)
75 75
 #' @return list A list containing dendrogram information and the heatmap grob
76 76
 #' @import graphics
77
-#' @importFrom grid grid.newpage
78
-#' @importFrom grid grid.draw
77
+#' @import grid
79 78
 #' @export
80 79
 plotHeatmap <- function(counts,
81 80
     z = NULL,
... ...
@@ -78,6 +78,10 @@ differentialExpression <- function(counts,
78 78
         ngeneson = rep("", (length(cells1) + length(cells2))),
79 79
         stringsAsFactors = FALSE)
80 80
 
81
+    # explicitly load library SummarizedExperiment due to MAST package
82
+    # dependency error
83
+    library(SummarizedExperiment)
84
+    
81 85
     sca <- suppressMessages(MAST::FromMatrix(log_normalized_mat, cdat))
82 86
     cdr2 <- colSums(SummarizedExperiment::assay(sca) > 0)
83 87
     SummarizedExperiment::colData(sca)$cngeneson <- scale(cdr2)
... ...
@@ -552,7 +552,7 @@
552 552
                 width = 2 * textHeight,
553 553
                 gp = gpar(col = borderColor, fill = NA))
554 554
 
555
-            txt <- rev(range(grid.pretty(range(annotation[[i]],
555
+            txt <- rev(range(grid::grid.pretty(range(annotation[[i]],
556 556
                 na.rm = TRUE))))
557 557
 
558 558
             yy <- y - c(1, 7) * textHeight
... ...
@@ -966,6 +966,7 @@ vplayout <- function(x, y) {
966 966
 }
967 967
 
968 968
 ## changed the original clusterMat() in the pheatmap.r
969
+#' @importFrom scales hue_pal
969 970
 .clusterMat <- function(mat, labels, distance, method) {
970 971
     # this funciton is going to change the .clusterMat() in pheatmap
971 972
 
... ...
@@ -1237,7 +1238,8 @@ vplayout <- function(x, y) {
1237 1238
             }
1238 1239
         }
1239 1240
 
1240
-        factorColors <- scales::dscale(factor(seq(1, count)), hue_pal(l = 75))
1241
+        factorColors <- scales::dscale(factor(seq(1, count)),
1242
+            scales::hue_pal(l = 75))
1241 1243
 
1242 1244
         contCounter <- 2
1243 1245
         for (i in seq(length(annotation))) {
... ...
@@ -1497,6 +1499,7 @@ vplayout <- function(x, y) {
1497 1499
 #' }
1498 1500
 #'
1499 1501
 #' pheatmap(test, clusteringCallback = callback)
1502
+#' @importFrom grid grid.pretty
1500 1503
 #' @importFrom RColorBrewer brewer.pal
1501 1504
 semiPheatmap <- function(mat,
1502 1505
     color = colorRampPalette(rev(brewer.pal(n = 7, name = "RdYlBu")))(100),
... ...
@@ -1692,7 +1695,7 @@ semiPheatmap <- function(mat,
1692 1695
         breaks <- .generateBreaks(as.vector(mat), length(color))
1693 1696
     }
1694 1697
     if (legend & .is.na2(legendBreaks)) {
1695
-        legend <- grid.pretty(range(as.vector(breaks)))
1698
+        legend <- grid::grid.pretty(range(as.vector(breaks)))
1696 1699
         names(legend) <- legend
1697 1700
     }
1698 1701
     else if (legend & !.is.na2(legendBreaks)) {