... | ... |
@@ -105,12 +105,22 @@ getValueOrRds <- function(input) |
105 | 105 |
#' @importFrom tools file_ext |
106 | 106 |
nrowHelper <- function(data) |
107 | 107 |
{ |
108 |
+ nrowMtx <- function(file) |
|
109 |
+ { |
|
110 |
+ i <- 1 |
|
111 |
+ while (unname(data.table::fread(file, nrows=i, fill=TRUE)[i,1] == "%")) |
|
112 |
+ { |
|
113 |
+ i <- i + 1 |
|
114 |
+ } |
|
115 |
+ return(unname(as.numeric(data.table::fread(file, nrow=i, fill=TRUE)[i,1]))) |
|
116 |
+ } |
|
117 |
+ |
|
108 | 118 |
if (is(data, "character")) |
109 | 119 |
{ |
110 | 120 |
return(switch(tools::file_ext(data), |
111 | 121 |
"csv" = nrow(data.table::fread(data, select=1)), |
112 | 122 |
"tsv" = nrow(data.table::fread(data, select=1)), |
113 |
- "mtx" = as.numeric(data.table::fread(data, nrows=1, fill=TRUE)[1,1]), |
|
123 |
+ "mtx" = nrowMtx(data), |
|
114 | 124 |
"gct" = as.numeric(strsplit(as.matrix(data.table::fread(data, nrows=1, sep='\t')), "\\s+")[[1]][1]) |
115 | 125 |
)) |
116 | 126 |
} |
... | ... |
@@ -126,12 +136,22 @@ nrowHelper <- function(data) |
126 | 136 |
#' @importFrom tools file_ext |
127 | 137 |
ncolHelper <- function(data) |
128 | 138 |
{ |
139 |
+ ncolMtx <- function(file) |
|
140 |
+ { |
|
141 |
+ i <- 1 |
|
142 |
+ while (unname(data.table::fread(file, nrows=i, fill=TRUE)[i,1] == "%")) |
|
143 |
+ { |
|
144 |
+ i <- i + 1 |
|
145 |
+ } |
|
146 |
+ return(unname(as.numeric(data.table::fread(file, nrow=i, fill=TRUE)[i,2]))) |
|
147 |
+ } |
|
148 |
+ |
|
129 | 149 |
if (is(data, "character")) |
130 | 150 |
{ |
131 | 151 |
return(switch(tools::file_ext(data), |
132 | 152 |
"csv" = ncol(data.table::fread(data, nrows=1)) - 1, |
133 | 153 |
"tsv" = ncol(data.table::fread(data, nrows=1)) - 1, |
134 |
- "mtx" = as.numeric(data.table::fread(data, nrows=1, fill=TRUE)[1,2]), |
|
154 |
+ "mtx" = ncolMtx(data), |
|
135 | 155 |
"gct" = as.numeric(strsplit(as.matrix(data.table::fread(data, nrows=1, sep='\t')), "\\s+")[[1]][2]) |
136 | 156 |
)) |
137 | 157 |
} |
... | ... |
@@ -216,7 +216,7 @@ setGeneric("setParam", function(object, whichParam, value) |
216 | 216 |
#' @examples |
217 | 217 |
#' params <- new("CogapsParams") |
218 | 218 |
#' params <- setDistributedParams(params, 5) |
219 |
-setGeneric("setDistributedParams", function(object, nSets, cut=NULL, |
|
219 |
+setGeneric("setDistributedParams", function(object, nSets=NULL, cut=NULL, |
|
220 | 220 |
minNS=NULL, maxNS=NULL) |
221 | 221 |
{standardGeneric("setDistributedParams")}) |
222 | 222 |
|