... | ... |
@@ -48,9 +48,13 @@ exportSCEtoAnnData <- function(sce, |
48 | 48 |
" correct Python environment.") |
49 | 49 |
return(sce)} |
50 | 50 |
|
51 |
- if (!is(SummarizedExperiment::assay(sce), 'dgCMatrix')) { |
|
52 |
- SummarizedExperiment::assay(sce) <- .convertToMatrix(SummarizedExperiment::assay(sce)) |
|
51 |
+ AssayName <- SummarizedExperiment::assayNames(sce) |
|
52 |
+ for (assay in AssayName){ |
|
53 |
+ if (!is(SummarizedExperiment::assay(sce, assay), 'dgCMatrix')) { |
|
54 |
+ SummarizedExperiment::assay(sce, assay) <- .convertToMatrix(SummarizedExperiment::assay(sce, assay)) |
|
55 |
+ } |
|
53 | 56 |
} |
57 |
+ |
|
54 | 58 |
|
55 | 59 |
dir.create(outputDir, showWarnings = FALSE, recursive = TRUE) |
56 | 60 |
annData <- .sce2adata(sce,useAssay) |
... | ... |
@@ -597,8 +597,8 @@ importCellRanger <- function( |
597 | 597 |
#' # 2.1.0/pbmc4k |
598 | 598 |
#' # All genes are kept. 840 cell barcodes are extracted. |
599 | 599 |
#' sce <- importCellRangerV2( |
600 |
-#' cellRangerDirs = system.file("extdata/", package = "singleCellTK"), |
|
601 |
-#' sampleDirs = "pbmc_4k_v2_200x800", |
|
600 |
+#' cellRangerDirs = system.file("extdata/pbmc_4k_v2_200x800", package = "singleCellTK"), |
|
601 |
+#' sampleDirs = "pbmc_800", |
|
602 | 602 |
#' sampleNames = "pbmc4k_800", |
603 | 603 |
#' reference = 'GRCh38', |
604 | 604 |
#' dataTypeV2 = "filtered") |
... | ... |
@@ -662,7 +662,7 @@ importCellRangerV2 <- function( |
662 | 662 |
#' matrix, the feature annotations, and the cell annotation for the sample. |
663 | 663 |
#' @examples |
664 | 664 |
#' sce <- importCellRangerV2Sample( |
665 |
-#' dataDir = system.file("extdata/pbmc_4k_v2_200x800/outs/", |
|
665 |
+#' dataDir = system.file("extdata/pbmc_4k_v2_200x800/pbmc_800/outs/", |
|
666 | 666 |
#' "filtered_gene_bc_matrices/GRCh38", package = "singleCellTK"), |
667 | 667 |
#' sampleName = "pbmc800") |
668 | 668 |
#' @export |
... | ... |
@@ -271,14 +271,15 @@ distinctColors <- function(n, hues = c("red", "cyan", "orange", "blue", |
271 | 271 |
rn <- rownames(x) |
272 | 272 |
limit <- (2^32/2-1) |
273 | 273 |
dimN <- dim(x) |
274 |
- chuS <- floor(floor(limit/dimN[1])) |
|
275 |
- chuN <- ceiling(dimN[2]/chuS) |
|
274 |
+ chuS <- floor(floor(limit/dimN[1])) # size of chunk |
|
275 |
+ chuN <- ceiling(dimN[2]/chuS) # number of chunks |
|
276 | 276 |
Mat <- list() |
277 | 277 |
|
278 | 278 |
for (i in 1:chuN) { |
279 | 279 |
start <- (i-1)*chuS + 1 |
280 | 280 |
end <- min(i*chuS, dimN[2]) |
281 |
- Mat[[i]] <- methods::as(x[, start:end], "Matrix") |
|
281 |
+ Mat[[i]] <- methods::as(x[, start:end], "dgTMatrix") |
|
282 |
+ Mat[[i]] <- methods::as(Mat[[i]], "dgCMatrix") #efficient way |
|
282 | 283 |
} |
283 | 284 |
x <- do.call(base::cbind, Mat) |
284 | 285 |
colnames(x) <- cn |
... | ... |
@@ -61,7 +61,6 @@ opt <- arguments$options |
61 | 61 |
process <- unlist(strsplit(opt$preproc, ',')) |
62 | 62 |
sample <- unlist(strsplit(opt$sample, ',')) |
63 | 63 |
directory <- unlist(strsplit(opt$directory, ',')) |
64 |
-reference <- unlist(strsplit(opt$ref, ',')) |
|
65 | 64 |
gmt <- opt$gmt |
66 | 65 |
sep <- opt$delim |
67 | 66 |
if (!is.null(opt$base_path)) { |
... | ... |
@@ -79,7 +78,11 @@ if (!is.null(opt$raw_expr_path)) { |
79 | 78 |
} else { |
80 | 79 |
RawDir <- opt$raw_expr_path |
81 | 80 |
} |
82 |
- |
|
81 |
+if (!is.null(opt$ref)) { |
|
82 |
+ reference <- unlist(strsplit(opt$ref, ',')) |
|
83 |
+} else { |
|
84 |
+ reference <- opt$ref |
|
85 |
+} |
|
83 | 86 |
## checking argument |
84 | 87 |
if (is.null(basepath)) { |
85 | 88 |
if (is.null(FilterDir) || is.null(RawDir)) { |
... | ... |
@@ -203,7 +203,7 @@ sce <- importCellRanger( |
203 | 203 |
# All genes are kept. 840 cell barcodes are extracted. |
204 | 204 |
sce <- importCellRangerV2( |
205 | 205 |
cellRangerDirs = system.file("extdata/", package = "singleCellTK"), |
206 |
- sampleDirs = "pbmc_4k_v2_800", |
|
206 |
+ sampleDirs = "pbmc_4k_v2_200x800", |
|
207 | 207 |
sampleNames = "pbmc4k_800", |
208 | 208 |
reference = 'GRCh38', |
209 | 209 |
dataTypeV2 = "filtered") |
... | ... |
@@ -36,7 +36,7 @@ Read the filtered barcodes, features, and matrices for all |
36 | 36 |
} |
37 | 37 |
\examples{ |
38 | 38 |
sce <- importCellRangerV2Sample( |
39 |
- dataDir = system.file("extdata/pbmc_4k_v2_800/outs/", |
|
39 |
+ dataDir = system.file("extdata/pbmc_4k_v2_200x800/outs/", |
|
40 | 40 |
"filtered_gene_bc_matrices/GRCh38", package = "singleCellTK"), |
41 | 41 |
sampleName = "pbmc800") |
42 | 42 |
} |