... | ... |
@@ -13,8 +13,8 @@ Description: A simple framework to facilitate the comparison of pipelines involv |
13 | 13 |
Given such an object, a set of alternative parameters/methods, and benchmark datasets, the `runPipeline` function |
14 | 14 |
then proceeds through all combinations arguments, avoiding recomputing the same step twice and compiling evaluations |
15 | 15 |
on the fly to avoid storing potentially large intermediate data. |
16 |
-Imports: BiocParallel, S4Vectors, ComplexHeatmap, SingleCellExperiment, SummarizedExperiment, Seurat, data.table, |
|
17 |
- matrixStats, Matrix, cluster, aricode, methods, utils, dplyr, grid, scales, scran, viridisLite, clue, randomcoloR, |
|
16 |
+Imports: BiocParallel, S4Vectors, ComplexHeatmap, SingleCellExperiment, SummarizedExperiment, Seurat, matrixStats, |
|
17 |
+ Matrix, cluster, aricode, methods, utils, dplyr, grid, scales, scran, viridisLite, clue, randomcoloR, |
|
18 | 18 |
ggplot2, cowplot, intrinsicDimension, scater, knitr, reshape2, stats, Rtsne, uwot, circlize, RColorBrewer |
19 | 19 |
Suggests: BiocStyle |
20 | 20 |
License: GPL |
... | ... |
@@ -61,8 +61,6 @@ importFrom(circlize,colorRamp2) |
61 | 61 |
importFrom(clue,solve_LSAP) |
62 | 62 |
importFrom(cluster,silhouette) |
63 | 63 |
importFrom(cowplot,plot_grid) |
64 |
-importFrom(data.table,data.table) |
|
65 |
-importFrom(data.table,setorder) |
|
66 | 64 |
importFrom(dplyr,bind_cols) |
67 | 65 |
importFrom(dplyr,bind_rows) |
68 | 66 |
importFrom(grid,gpar) |
... | ... |
@@ -104,13 +104,12 @@ parsePipNames <- function(x, setRowNames=FALSE, addcolumns=NULL){ |
104 | 104 |
#' @return a matrix or data.frame |
105 | 105 |
#' @export |
106 | 106 |
#' |
107 |
-#' @importFrom data.table data.table setorder |
|
108 | 107 |
#' @examples |
109 | 108 |
#' buildCombMatrix(list(param1=LETTERS[1:3], param2=1:2)) |
110 | 109 |
buildCombMatrix <- function(alt, returnIndexMatrix=FALSE){ |
111 |
- eg <- data.table(expand.grid(lapply(alt, FUN=seq_along))) |
|
112 |
- eg <- setorder(eg) |
|
113 |
- if(returnIndexMatrix) return(as.matrix(eg)) |
|
110 |
+ eg <- as.matrix(expand.grid(lapply(rev(alt), FUN=seq_along))) |
|
111 |
+ eg <- eg[,seq(ncol(eg),1)] |
|
112 |
+ if(returnIndexMatrix) return(eg) |
|
114 | 113 |
eg <- as.data.frame(eg) |
115 | 114 |
for(f in names(alt)){ |
116 | 115 |
eg[,f] <- factor(alt[[f]][eg[,f]], levels=alt[[f]]) |
... | ... |
@@ -118,7 +117,6 @@ buildCombMatrix <- function(alt, returnIndexMatrix=FALSE){ |
118 | 117 |
eg |
119 | 118 |
} |
120 | 119 |
|
121 |
-#' @importFrom data.table data.table setorder |
|
122 | 120 |
.checkCombMatrix <- function(eg, alt){ |
123 | 121 |
if(is.null(dim(eg))) |
124 | 122 |
stop("`eg` should be a matrix or data.frame of indices or factors") |
... | ... |
@@ -136,11 +134,15 @@ buildCombMatrix <- function(alt, returnIndexMatrix=FALSE){ |
136 | 134 |
} |
137 | 135 |
} |
138 | 136 |
} |
139 |
- eg <- as.matrix(as.data.frame(setorder(data.table(eg)))) |
|
140 | 137 |
if(any(is.na(eg))) stop("Final `eg` contains missing values!") |
141 |
- eg |
|
138 |
+ .sortcols(eg) |
|
142 | 139 |
} |
143 | 140 |
|
141 |
+.sortcols <- function(x){ |
|
142 |
+ xi <- x[,ncol(x)] |
|
143 |
+ for(i in seq(ncol(x)-1,1)) xi <- xi+max(xi)*x[,i] |
|
144 |
+ x[order(xi),] |
|
145 |
+} |
|
144 | 146 |
|
145 | 147 |
#' getQualitativePalette |
146 | 148 |
#' |
... | ... |
@@ -231,3 +233,4 @@ farthestPoint <- function(y, x=NULL){ |
231 | 233 |
}) |
232 | 234 |
order(d,decreasing=TRUE)[1] |
233 | 235 |
} |
236 |
+ |