Browse code

Update importMitoGeneSet function. Change delayedArray=False for all import function. Minor fixs in QC HTML report

rz2333 authored on 30/12/2020 17:40:20
Showing 28 changed files

... ...
@@ -44,6 +44,7 @@ export(importGeneSetsFromCollection)
44 44
 export(importGeneSetsFromGMT)
45 45
 export(importGeneSetsFromList)
46 46
 export(importGeneSetsFromMSigDB)
47
+export(importMitoGeneSet)
47 48
 export(importMultipleSources)
48 49
 export(importOptimus)
49 50
 export(importSEQC)
... ...
@@ -75,3 +75,18 @@
75 75
 #' @examples
76 76
 #' data("msigdb_table")
77 77
 "msigdb_table"
78
+
79
+#' List of mitochondrial genes of multiple reference
80
+#' 
81
+#' A list of gene set that contains mitochondrial genes of multiple reference
82
+#' (hg38, hg19, mm10 and mm9). It contains multiple types of gene identifier:
83
+#' gene symbol, entrez ID, ensemble ID and ensemble transcript ID. It's used 
84
+#' for the function 'importMitoGeneSet'. 
85
+
86
+#' @name MitoGenes
87
+#' @docType data
88
+#' @format A list
89
+#' @keywords datasets
90
+#' @examples
91
+#' data("MitoGenes")
92
+"MitoGenes"
78 93
\ No newline at end of file
... ...
@@ -1,6 +1,6 @@
1 1
 .importAnnDataSample <- function(sampleDir = './',
2 2
                                  sampleName = 'sample',
3
-                                 delayedArray = TRUE){
3
+                                 delayedArray = FALSE){
4 4
 
5 5
   anndata_file <- file.path(sampleDir, paste0(sampleName,'.h5ad',sep=''))
6 6
   if (!file.exists(anndata_file)){
... ...
@@ -83,7 +83,7 @@
83 83
 #'   with the sample name appended to each colname in colData
84 84
 #' }
85 85
 #' @param delayedArray Boolean. Whether to read the expression matrix as
86
-#'  \link{DelayedArray} object. Default \code{TRUE}.
86
+#'  \link{DelayedArray} object. Default \code{FALSE}.
87 87
 #' @details
88 88
 #' \code{importAnnData} converts scRNA-seq data in the AnnData format to the
89 89
 #' \code{SingleCellExperiment} object. The .X slot in AnnData is transposed to the features x cells
... ...
@@ -107,7 +107,7 @@
107 107
 #' @export
108 108
 importAnnData <- function(sampleDirs = NULL,
109 109
                           sampleNames = NULL,
110
-                          delayedArray = TRUE) {
110
+                          delayedArray = FALSE) {
111 111
 
112 112
   if (length(sampleDirs)!=length(sampleNames)){
113 113
     stop("Number of sampleDirs must be equal to number of SampleNames. Please provide sample names for all input directories")
... ...
@@ -102,7 +102,7 @@
102 102
 #'  \link{readMM} function), or "matrix" (as returned by
103 103
 #'  \link[base]{matrix} function). Default "Matrix".
104 104
 #' @param delayedArray Boolean. Whether to read the expression matrix as
105
-#'  \link[DelayedArray]{DelayedArray-class} object or not. Default \code{TRUE}.
105
+#'  \link[DelayedArray]{DelayedArray-class} object or not. Default \code{FALSE}.
106 106
 #' @return A \code{SingleCellExperiment} object containing the count
107 107
 #'  matrix, the gene annotation, and the cell annotation.
108 108
 #' @examples
... ...
@@ -140,7 +140,7 @@ importBUStools <- function(
140 140
     barcodesFileNames = "genes.barcodes.txt",
141 141
     gzipped = "auto",
142 142
     class = c("Matrix", "matrix"),
143
-    delayedArray = TRUE) {
143
+    delayedArray = FALSE) {
144 144
 
145 145
     class <- match.arg(class)
146 146
 
... ...
@@ -512,7 +512,7 @@
512 512
 #'  \link{readMM} function), or "matrix" (as returned by
513 513
 #'  \link[base]{matrix} function). Default \code{"Matrix"}.
514 514
 #' @param delayedArray Boolean. Whether to read the expression matrix as
515
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
515
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
516 516
 #' @param reference Character vector. The reference genome names. 
517 517
 #'  Default \code{NULL}. If not \code{NULL}, it must gave the length and order as 
518 518
 #'  \code{length(unlist(sampleDirs))} if \code{sampleDirs} is not \code{NULL}.
... ...
@@ -570,7 +570,7 @@ importCellRanger <- function(
570 570
     barcodesFileNames = "barcodes.tsv.gz",
571 571
     gzipped = "auto",
572 572
     class = c("Matrix", "matrix"),
573
-    delayedArray = TRUE) {
573
+    delayedArray = FALSE) {
574 574
 
575 575
     class <- match.arg(class)
576 576
     dataType <- match.arg(dataType)
... ...
@@ -608,7 +608,7 @@ importCellRangerV2 <- function(
608 608
     sampleNames = NULL,
609 609
     dataTypeV2 = c("filtered", "raw"),
610 610
     class = c("Matrix", "matrix"),
611
-    delayedArray = TRUE,
611
+    delayedArray = FALSE,
612 612
     reference = NULL,
613 613
     cellRangerOutsV2 = NULL) {
614 614
 
... ...
@@ -656,7 +656,7 @@ importCellRangerV2 <- function(
656 656
 #'  \link{readMM} function), or "matrix" (as returned by
657 657
 #'  \link[base]{matrix} function). Default "Matrix".
658 658
 #' @param delayedArray Boolean. Whether to read the expression matrix as
659
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
659
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
660 660
 #' @return A \code{SingleCellExperiment} object containing the count
661 661
 #'  matrix, the feature annotations, and the cell annotation for the sample.
662 662
 #' @examples
... ...
@@ -669,7 +669,7 @@ importCellRangerV2Sample <- function(
669 669
     dataDir = NULL,
670 670
     sampleName = NULL,
671 671
     class = c("Matrix", "matrix"),
672
-    delayedArray = TRUE) {
672
+    delayedArray = FALSE) {
673 673
 
674 674
     class <- match.arg(class)
675 675
 
... ...
@@ -701,7 +701,7 @@ importCellRangerV3 <- function(
701 701
     sampleNames = NULL,
702 702
     dataType = c("filtered", "raw"),
703 703
     class = c("Matrix", "matrix"),
704
-    delayedArray = TRUE) {
704
+    delayedArray = FALSE) {
705 705
 
706 706
     class <- match.arg(class)
707 707
     dataType <- match.arg(dataType)
... ...
@@ -740,7 +740,7 @@ importCellRangerV3 <- function(
740 740
 #'  \link{readMM} function), or "matrix" (as returned by
741 741
 #'  \link[base]{matrix} function). Default "Matrix".
742 742
 #' @param delayedArray Boolean. Whether to read the expression matrix as
743
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
743
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
744 744
 #' @return A \code{SingleCellExperiment} object containing the count
745 745
 #'  matrix, the feature annotations, and the cell annotation for the sample.
746 746
 #' @examples
... ...
@@ -753,7 +753,7 @@ importCellRangerV3Sample <- function(
753 753
     dataDir = "./",
754 754
     sampleName = "sample",
755 755
     class = c("Matrix", "matrix"),
756
-    delayedArray = TRUE) {
756
+    delayedArray = FALSE) {
757 757
 
758 758
     class <- match.arg(class)
759 759
 
... ...
@@ -91,7 +91,7 @@
91 91
 #' @param dataType can be "filtered" or "raw". Default \code{"filtered"}.
92 92
 #' @param rdsFileName File name prefix of the DropEst RDS output. default is "cell.counts"
93 93
 #' @param delayedArray Boolean. Whether to read the expression matrix as
94
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
94
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
95 95
 #' @details
96 96
 #' \code{importDropEst} expects either raw counts matrix stored as "cm_raw" or filtered
97 97
 #' counts matrix stored as "cm" in the DropEst rds output.
... ...
@@ -114,7 +114,7 @@ importDropEst <- function(sampleDirs = NULL,
114 114
                           dataType = c('filtered','raw'),
115 115
                           rdsFileName = 'cell.counts',
116 116
                           sampleNames = NULL,
117
-                          delayedArray = TRUE) {
117
+                          delayedArray = FALSE) {
118 118
   dataType <- match.arg(dataType)
119 119
 
120 120
   if (length(sampleDirs)!=length(sampleNames)){
... ...
@@ -41,7 +41,7 @@
41 41
 #' @param featureSep Separater used for the feature annotation file. Default is "\\t".
42 42
 #' @param gzipped Whether the input file is gzipped. Default is "auto" and it will automatically detect whether the file is gzipped. Other options is TRUE or FALSE. 
43 43
 #' @param delayedArray Boolean. Whether to read the expression matrix as
44
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
44
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
45 45
 #' @return a SingleCellExperiment object
46 46
 #' @export
47 47
 
... ...
@@ -428,6 +428,75 @@ importGeneSetsFromMSigDB <- function(inSCE, categoryIDs,
428 428
 }
429 429
 
430 430
 
431
+
432
+#' @title Import mitochondrial gene sets
433
+#' @description Imports mitochondrial gene sets and  stores it in the metadata of the
434
+#' \linkS4class{SingleCellExperiment} object. These gene sets can be used in
435
+#' downstream quality control and analysis functions in \link{singleCellTK}. 
436
+#' @param inSCE Input \linkS4class{SingleCellExperiment} object.
437
+#' @param reference Character. Species available are "hg38", "hg19", "mm9" and "mm10." 
438
+#' @param by Character. Describes the location within \code{inSCE} where the gene 
439
+#' identifiers in the mitochondrial gene sets should be mapped. 
440
+#' If set to \code{"rownames"} then the features will
441
+#' be searched for among \code{rownames(inSCE)}. This can also be
442
+#' set to one of the column names of \code{rowData(inSCE)} in which case the
443
+#' gene identifies will be mapped to that column in the \code{rowData}
444
+#' of \code{inSCE}. See \link{featureIndex} for more information.
445
+#' Default \code{"rownames"}.
446
+#' @param id Types of gene id. Now it supports "symbol", "entrez", "ensemble"
447
+#' and "ensemble_transcriptID". 
448
+#' @param collectionName Character. Name of collection to add gene sets to.
449
+#' If this collection already exists in \code{inSCE}, then these gene sets will
450
+#' be added to that collection. Any gene sets within the collection with the
451
+#' same name will be overwritten.
452
+#' @return A \link[SingleCellExperiment]{SingleCellExperiment} object
453
+#' with gene set from \code{collectionName} output stored to the
454
+#' \link{metadata} slot.
455
+#' @details The gene identifiers of mitochondrial genes will be loaded with 
456
+#' "data(AllMito)". Currently, it supports hg38, hg19, mm9 and mm10 reference. 
457
+#' Also, it supports entrez ID, gene symbol, ensemble ID and ensemble transcript ID. 
458
+#' They will be mapped to the IDs in \code{inSCE} using the \code{by} parameter and
459
+#' stored in a \linkS4class{GeneSetCollection} object from package
460
+#' \link{GSEABase}. This object is stored in
461
+#' \code{metadata(inSCE)$sctk$genesets}, which can be accessed in downstream
462
+#' analysis functions such as \link[singleCellTK]{runCellQC}.
463
+#' @author Rui Hong
464
+#' @seealso \link{importGeneSetsFromList} for importing from lists,
465
+#' \link{importGeneSetsFromGMT} for importing from GMT files, and
466
+# \link{importGeneSetsFromCollection} for importing from
467
+#' \linkS4class{GeneSetCollection} objects.
468
+#' @examples
469
+#' data(scExample)
470
+#' sce <- importMitoGeneSet(inSCE = sce,
471
+#'                          reference = "hg38",
472
+#'                          id = "ensemble",
473
+#'                          collectionName = "hg38_mito",
474
+#'                          by = "rownames")
475
+#' @export
476
+importMitoGeneSet <- function(inSCE, reference, id, by, collectionName) {
477
+  if (!id %in% c("symbol", "entrez", "ensemble", "ensemble_transcriptID")) {
478
+    stop("id should be one of 'symbol', 'entrez', 'ensemble' or 'ensemble_transcriptID'")
479
+  }
480
+  
481
+  if (!reference %in% c("hg38", "hg19", "mm10", "mm9")) {
482
+    stop("Now it only supports hg38, hg19, mm10 and mm9 reference.")
483
+  }
484
+  
485
+  #utils::globalVariables(c("AllMito"))
486
+  MitoGenes <- NULL
487
+  utils::data(MitoGenes, envir = environment())
488
+  target <- paste(reference, id, sep="_")
489
+  if (!target %in% names(MitoGenes)) {
490
+    stop(target, " is not supported now. Please use function 'importGeneSetsFromGMT' or 'importGeneSetsFromList' to load mitochondrial gene sets.")
491
+  }
492
+  
493
+  mitogenes <- MitoGenes[[target]]
494
+  inSCE <- importGeneSetsFromList(inSCE = inSCE, geneSetList = mitogenes,
495
+                                  collectionName = collectionName, 
496
+                                  by = by)
497
+  return(inSCE)
498
+}
499
+
431 500
 #' @title Lists imported GeneSetCollections
432 501
 #' @description Returns a vector of GeneSetCollections that have been
433 502
 #' imported and stored in \code{metadata(inSCE)$sctk$genesets}.
... ...
@@ -2,7 +2,7 @@
2 2
 #' Imports samples from different sources and compiles them into a list of SCE objects
3 3
 #' @param allImportEntries object containing the sources and parameters of all the samples being imported (from the UI)
4 4
 #' @param delayedArray Boolean. Whether to read the expression matrix as
5
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
5
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
6 6
 #' @return A list of \link[SingleCellExperiment]{SingleCellExperiment} object containing
7 7
 #' the droplet or cell data or both,depending on the dataType that users provided.
8 8
 #' @export
... ...
@@ -246,7 +246,7 @@
246 246
 #'  \link{readMM} function), or "matrix" (as returned by
247 247
 #'  \link[base]{matrix} function). Default "Matrix".
248 248
 #' @param delayedArray Boolean. Whether to read the expression matrix as
249
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
249
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
250 250
 #' @return A \link[SingleCellExperiment]{SingleCellExperiment} object
251 251
 #'  containing the count
252 252
 #'  matrix, the gene annotation, and the cell annotation.
... ...
@@ -267,7 +267,7 @@ importOptimus <- function(OptimusDirs,
267 267
   geneMetricsLocation = "call-MergeGeneMetrics/merged-gene-metrics.csv.gz",
268 268
   emptyDropsLocation = "call-RunEmptyDrops/empty_drops_result.csv",
269 269
   class = c("Matrix", "matrix"),
270
-  delayedArray = TRUE) {
270
+  delayedArray = FALSE) {
271 271
 
272 272
   class <- match.arg(class)
273 273
 
... ...
@@ -110,7 +110,7 @@
110 110
 #'  \link{readMM} function), or "matrix" (as returned by
111 111
 #'  \link[base]{matrix} function). Default "Matrix".
112 112
 #' @param delayedArray Boolean. Whether to read the expression matrix as
113
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
113
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
114 114
 #' @return A \code{SingleCellExperiment} object containing the count
115 115
 #'  matrix, the gene annotation, and the cell annotation.
116 116
 #' @examples
... ...
@@ -151,7 +151,7 @@ importSTARsolo <- function(
151 151
     barcodesFileNames = "barcodes.tsv",
152 152
     gzipped = "auto",
153 153
     class = c("Matrix", "matrix"),
154
-    delayedArray = TRUE) {
154
+    delayedArray = FALSE) {
155 155
 
156 156
     class <- match.arg(class)
157 157
 
... ...
@@ -167,7 +167,7 @@
167 167
 #'  \link{readMM} function), or "matrix" (as returned by
168 168
 #'  \link[base]{matrix} function). Default "Matrix".
169 169
 #' @param delayedArray Boolean. Whether to read the expression matrix as
170
-#'  \link{DelayedArray} object or not. Default \code{TRUE}.
170
+#'  \link{DelayedArray} object or not. Default \code{FALSE}.
171 171
 #' @param feNotFirstCol Boolean. \code{TRUE} if first column of
172 172
 #'  sparse_counts_genes.csv
173 173
 #' is row index and it will be removed. \code{FALSE} the first column will
... ...
@@ -217,7 +217,7 @@ importSEQC <- function(
217 217
     prefix = NULL,
218 218
     gzipped = FALSE,
219 219
     class = c("Matrix", "matrix"),
220
-    delayedArray = TRUE,
220
+    delayedArray = FALSE,
221 221
     cbNotFirstCol = TRUE,
222 222
     feNotFirstCol = TRUE,
223 223
     combinedSample = TRUE) {
... ...
@@ -1,6 +1,6 @@
1 1
 #' @title Wrapper for calculating QC metrics with scater.
2
-#' @description A wrapper function for \link[celda]{decontX}. Identify
3
-#'  potential contamination from experimental factors such as ambient RNA.
2
+#' @description A wrapper function for \link[scater]{addPerCellQC}. Calculate
3
+#'  general quality control metrics for each cell in the count matrix.
4 4
 #' @param inSCE Input \link[SingleCellExperiment]{SingleCellExperiment} object.
5 5
 #' @param useAssay A string specifying which assay in the SCE to use. Default \code{"counts"}.
6 6
 #' @param collectionName Character. Name of a \code{GeneSetCollection} obtained by using one of the importGeneSet* functions. Default \code{NULL}.
7 7
new file mode 100644
8 8
Binary files /dev/null and b/data/MitoGenes.rda differ
... ...
@@ -216,7 +216,7 @@ if (numCores > 1) {
216 216
 ### checking output formats
217 217
 if (!all(formats %in% c("SCE", "AnnData", "FlatFile", "HTAN"))) {
218 218
     warning("Output format must be 'SCE', 'AnnData', 'HTAN' or 'FlatFile'. Format ", 
219
-         paste(formats[!format %in% c("SCE", "AnnData", "FlatFile", "HTAN")], sep = ","),
219
+         paste(formats[!formats %in% c("SCE", "AnnData", "FlatFile", "HTAN")], collapse = ","),
220 220
          " is not supported now. ")
221 221
 }
222 222
 
... ...
@@ -531,6 +531,11 @@ for(i in seq_along(process)) {
531 531
             reportDropletQC(inSCE = mergedDropletSCE, output_dir = directory, output_file = paste0("SCTK_", samplename,'_dropletQC.html'), subTitle = subTitle, studyDesign = studyDesign)
532 532
             reportCellQC(inSCE = mergedFilteredSCE, output_dir = directory, output_file = paste0("SCTK_", samplename,'_cellQC.html'), subTitle = subTitle, studyDesign = studyDesign)
533 533
 
534
+            ## generate QC metrics table for mergedFilteredSCE
535
+            QCsummary <- sampleSummaryStats(mergedFilteredSCE, simple=FALSE, sample = colData(mergedFilteredSCE)$sample) #colData(cellSCE)$Study_ID
536
+            write.csv(QCsummary, file.path(directory, 
537
+                                           samplename,
538
+                                           paste0("SCTK_", samplename,'_cellQC_summary.csv')))
534 539
         }
535 540
 
536 541
         if ((dataType == "Droplet") & (!isTRUE(detectCell))) {
... ...
@@ -577,6 +582,11 @@ for(i in seq_along(process)) {
577 582
             getSceParams(inSCE = mergedFilteredSCE, directory = directory, 
578 583
                          samplename = samplename, writeYAML = TRUE,
579 584
                          skip = c("scrublet", "runDecontX", "runBarcodeRanksMetaOutput"))
585
+
586
+            QCsummary <- sampleSummaryStats(mergedFilteredSCE, simple=FALSE, sample = colData(mergedFilteredSCE)$sample) #colData(cellSCE)$Study_ID
587
+            write.csv(QCsummary, file.path(directory, 
588
+                                           samplename,
589
+                                           paste0("SCTK_", samplename,'_cellQC_summary.csv')))
580 590
         }
581 591
 
582 592
     }
... ...
@@ -628,6 +638,12 @@ if (!isTRUE(split)) {
628 638
         } else {
629 639
             warning("'FlatFile' is not in output format. Skip exporting the manifest file.")
630 640
         }
641
+
642
+        ## generate QC summary
643
+        QCsummary <- sampleSummaryStats(cellSCE, simple=FALSE, sample = colData(cellSCE)$sample) 
644
+        write.csv(QCsummary, file.path(directory,
645
+                                       samplename, 
646
+                                       paste0("SCTK_", samplename,'_cellQC_summary.csv')))
631 647
     }
632 648
 
633 649
     if (dataType == "Cell") {
... ...
@@ -658,6 +674,11 @@ if (!isTRUE(split)) {
658 674
 
659 675
         reportCellQC(inSCE = cellSCE, output_dir = directory, output_file = paste0("SCTK_", samplename,'_cellQC.html'), subTitle = subTitle, studyDesign = studyDesign)
660 676
         getSceParams(inSCE = cellSCE, directory = directory, samplename = samplename, writeYAML = TRUE)
677
+
678
+        QCsummary <- sampleSummaryStats(cellSCE, simple=FALSE, sample = colData(cellSCE)$sample) 
679
+        write.csv(QCsummary, file.path(directory,
680
+                                       samplename, 
681
+                                       paste0("SCTK_", samplename,'_cellQC_summary.csv')))
661 682
     }
662 683
 
663 684
     if ((dataType == "Droplet") & (!isTRUE(detectCell))) {
664 685
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/data.R
3
+\docType{data}
4
+\name{MitoGenes}
5
+\alias{MitoGenes}
6
+\title{List of mitochondrial genes of multiple reference}
7
+\format{
8
+A list
9
+}
10
+\usage{
11
+MitoGenes
12
+}
13
+\description{
14
+A list of gene set that contains mitochondrial genes of multiple reference
15
+(hg38, hg19, mm10 and mm9). It contains multiple types of gene identifier:
16
+gene symbol, entrez ID, ensemble ID and ensemble transcript ID. It's used 
17
+for the function 'importMitoGeneSet'.
18
+}
19
+\examples{
20
+data("MitoGenes")
21
+}
22
+\keyword{datasets}
... ...
@@ -4,7 +4,7 @@
4 4
 \alias{importAnnData}
5 5
 \title{Create a SingleCellExperiment Object from Python AnnData .h5ad files}
6 6
 \usage{
7
-importAnnData(sampleDirs = NULL, sampleNames = NULL, delayedArray = TRUE)
7
+importAnnData(sampleDirs = NULL, sampleNames = NULL, delayedArray = FALSE)
8 8
 }
9 9
 \arguments{
10 10
 \item{sampleDirs}{Folder containing the .h5ad file. Can be one of -
... ...
@@ -30,7 +30,7 @@ Can be one of -
30 30
 }}
31 31
 
32 32
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
33
-\link{DelayedArray} object. Default \code{TRUE}.}
33
+\link{DelayedArray} object. Default \code{FALSE}.}
34 34
 }
35 35
 \value{
36 36
 A \code{SingleCellExperiment} object.
... ...
@@ -12,7 +12,7 @@ importBUStools(
12 12
   barcodesFileNames = "genes.barcodes.txt",
13 13
   gzipped = "auto",
14 14
   class = c("Matrix", "matrix"),
15
-  delayedArray = TRUE
15
+  delayedArray = FALSE
16 16
 )
17 17
 }
18 18
 \arguments{
... ...
@@ -46,7 +46,7 @@ object. Can be one of "Matrix" (as returned by
46 46
 \link[base]{matrix} function). Default "Matrix".}
47 47
 
48 48
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
49
-\link[DelayedArray]{DelayedArray-class} object or not. Default \code{TRUE}.}
49
+\link[DelayedArray]{DelayedArray-class} object or not. Default \code{FALSE}.}
50 50
 }
51 51
 \value{
52 52
 A \code{SingleCellExperiment} object containing the count
... ...
@@ -17,7 +17,7 @@ importCellRanger(
17 17
   barcodesFileNames = "barcodes.tsv.gz",
18 18
   gzipped = "auto",
19 19
   class = c("Matrix", "matrix"),
20
-  delayedArray = TRUE
20
+  delayedArray = FALSE
21 21
 )
22 22
 
23 23
 importCellRangerV2(
... ...
@@ -26,7 +26,7 @@ importCellRangerV2(
26 26
   sampleNames = NULL,
27 27
   dataTypeV2 = c("filtered", "raw"),
28 28
   class = c("Matrix", "matrix"),
29
-  delayedArray = TRUE,
29
+  delayedArray = FALSE,
30 30
   reference = NULL,
31 31
   cellRangerOutsV2 = NULL
32 32
 )
... ...
@@ -37,7 +37,7 @@ importCellRangerV3(
37 37
   sampleNames = NULL,
38 38
   dataType = c("filtered", "raw"),
39 39
   class = c("Matrix", "matrix"),
40
-  delayedArray = TRUE
40
+  delayedArray = FALSE
41 41
 )
42 42
 }
43 43
 \arguments{
... ...
@@ -138,7 +138,7 @@ object. Can be one of "Matrix" (as returned by
138 138
 \link[base]{matrix} function). Default \code{"Matrix"}.}
139 139
 
140 140
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
141
-\link{DelayedArray} object or not. Default \code{TRUE}.}
141
+\link{DelayedArray} object or not. Default \code{FALSE}.}
142 142
 
143 143
 \item{dataTypeV2}{Character. The type of output to import for
144 144
 Cellranger version below 3.0.0. Whether to import the filtered or the 
... ...
@@ -8,7 +8,7 @@ importCellRangerV2Sample(
8 8
   dataDir = NULL,
9 9
   sampleName = NULL,
10 10
   class = c("Matrix", "matrix"),
11
-  delayedArray = TRUE
11
+  delayedArray = FALSE
12 12
 )
13 13
 }
14 14
 \arguments{
... ...
@@ -23,7 +23,7 @@ object. Can be one of "Matrix" (as returned by
23 23
 \link[base]{matrix} function). Default "Matrix".}
24 24
 
25 25
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
26
-\link{DelayedArray} object or not. Default \code{TRUE}.}
26
+\link{DelayedArray} object or not. Default \code{FALSE}.}
27 27
 }
28 28
 \value{
29 29
 A \code{SingleCellExperiment} object containing the count
... ...
@@ -8,7 +8,7 @@ importCellRangerV3Sample(
8 8
   dataDir = "./",
9 9
   sampleName = "sample",
10 10
   class = c("Matrix", "matrix"),
11
-  delayedArray = TRUE
11
+  delayedArray = FALSE
12 12
 )
13 13
 }
14 14
 \arguments{
... ...
@@ -23,7 +23,7 @@ object. Can be one of "Matrix" (as returned by
23 23
 \link[base]{matrix} function). Default "Matrix".}
24 24
 
25 25
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
26
-\link{DelayedArray} object or not. Default \code{TRUE}.}
26
+\link{DelayedArray} object or not. Default \code{FALSE}.}
27 27
 }
28 28
 \value{
29 29
 A \code{SingleCellExperiment} object containing the count
... ...
@@ -9,7 +9,7 @@ importDropEst(
9 9
   dataType = c("filtered", "raw"),
10 10
   rdsFileName = "cell.counts",
11 11
   sampleNames = NULL,
12
-  delayedArray = TRUE
12
+  delayedArray = FALSE
13 13
 )
14 14
 }
15 15
 \arguments{
... ...
@@ -23,7 +23,7 @@ importDropEst(
23 23
 Default "sample".}
24 24
 
25 25
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
26
-\link{DelayedArray} object or not. Default \code{TRUE}.}
26
+\link{DelayedArray} object or not. Default \code{FALSE}.}
27 27
 }
28 28
 \value{
29 29
 A \code{SingleCellExperiment} object containing the count matrix,
... ...
@@ -46,7 +46,7 @@ object. Can be one of "Matrix" (as returned by
46 46
 \link[base]{matrix} function). Default "Matrix".}
47 47
 
48 48
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
49
-\link{DelayedArray} object or not. Default \code{TRUE}.}
49
+\link{DelayedArray} object or not. Default \code{FALSE}.}
50 50
 
51 51
 \item{annotFileHeader}{Whether there's a header (colnames) in the cell annotation file. Default is FALSE}
52 52
 
53 53
new file mode 100644
... ...
@@ -0,0 +1,66 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/importGeneSets.R
3
+\name{importMitoGeneSet}
4
+\alias{importMitoGeneSet}
5
+\title{Import mitochondrial gene sets}
6
+\usage{
7
+importMitoGeneSet(inSCE, reference, id, by, collectionName)
8
+}
9
+\arguments{
10
+\item{inSCE}{Input \linkS4class{SingleCellExperiment} object.}
11
+
12
+\item{reference}{Character. Species available are "hg38", "hg19", "mm9" and "mm10."}
13
+
14
+\item{id}{Types of gene id. Now it supports "symbol", "entrez", "ensemble"
15
+and "ensemble_transcriptID".}
16
+
17
+\item{by}{Character. Describes the location within \code{inSCE} where the gene 
18
+identifiers in the mitochondrial gene sets should be mapped. 
19
+If set to \code{"rownames"} then the features will
20
+be searched for among \code{rownames(inSCE)}. This can also be
21
+set to one of the column names of \code{rowData(inSCE)} in which case the
22
+gene identifies will be mapped to that column in the \code{rowData}
23
+of \code{inSCE}. See \link{featureIndex} for more information.
24
+Default \code{"rownames"}.}
25
+
26
+\item{collectionName}{Character. Name of collection to add gene sets to.
27
+If this collection already exists in \code{inSCE}, then these gene sets will
28
+be added to that collection. Any gene sets within the collection with the
29
+same name will be overwritten.}
30
+}
31
+\value{
32
+A \link[SingleCellExperiment]{SingleCellExperiment} object
33
+with gene set from \code{collectionName} output stored to the
34
+\link{metadata} slot.
35
+}
36
+\description{
37
+Imports mitochondrial gene sets and  stores it in the metadata of the
38
+\linkS4class{SingleCellExperiment} object. These gene sets can be used in
39
+downstream quality control and analysis functions in \link{singleCellTK}.
40
+}
41
+\details{
42
+The gene identifiers of mitochondrial genes will be loaded with 
43
+"data(AllMito)". Currently, it supports hg38, hg19, mm9 and mm10 reference. 
44
+Also, it supports entrez ID, gene symbol, ensemble ID and ensemble transcript ID. 
45
+They will be mapped to the IDs in \code{inSCE} using the \code{by} parameter and
46
+stored in a \linkS4class{GeneSetCollection} object from package
47
+\link{GSEABase}. This object is stored in
48
+\code{metadata(inSCE)$sctk$genesets}, which can be accessed in downstream
49
+analysis functions such as \link[singleCellTK]{runCellQC}.
50
+}
51
+\examples{
52
+data(scExample)
53
+sce <- importMitoGeneSet(inSCE = sce,
54
+                         reference = "hg38",
55
+                         id = "ensemble",
56
+                         collectionName = "hg38_mito",
57
+                         by = "rownames")
58
+}
59
+\seealso{
60
+\link{importGeneSetsFromList} for importing from lists,
61
+\link{importGeneSetsFromGMT} for importing from GMT files, and
62
+\linkS4class{GeneSetCollection} objects.
63
+}
64
+\author{
65
+Rui Hong
66
+}
... ...
@@ -10,7 +10,7 @@ importMultipleSources(allImportEntries, delayedArray = FALSE)
10 10
 \item{allImportEntries}{object containing the sources and parameters of all the samples being imported (from the UI)}
11 11
 
12 12
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
13
-\link{DelayedArray} object or not. Default \code{TRUE}.}
13
+\link{DelayedArray} object or not. Default \code{FALSE}.}
14 14
 }
15 15
 \value{
16 16
 A list of \link[SingleCellExperiment]{SingleCellExperiment} object containing
... ...
@@ -14,7 +14,7 @@ importOptimus(
14 14
   geneMetricsLocation = "call-MergeGeneMetrics/merged-gene-metrics.csv.gz",
15 15
   emptyDropsLocation = "call-RunEmptyDrops/empty_drops_result.csv",
16 16
   class = c("Matrix", "matrix"),
17
-  delayedArray = TRUE
17
+  delayedArray = FALSE
18 18
 )
19 19
 }
20 20
 \arguments{
... ...
@@ -62,7 +62,7 @@ object. Can be one of "Matrix" (as returned by
62 62
 \link[base]{matrix} function). Default "Matrix".}
63 63
 
64 64
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
65
-\link{DelayedArray} object or not. Default \code{TRUE}.}
65
+\link{DelayedArray} object or not. Default \code{FALSE}.}
66 66
 }
67 67
 \value{
68 68
 A \link[SingleCellExperiment]{SingleCellExperiment} object
... ...
@@ -10,7 +10,7 @@ importSEQC(
10 10
   prefix = NULL,
11 11
   gzipped = FALSE,
12 12
   class = c("Matrix", "matrix"),
13
-  delayedArray = TRUE,
13
+  delayedArray = FALSE,
14 14
   cbNotFirstCol = TRUE,
15 15
   feNotFirstCol = TRUE,
16 16
   combinedSample = TRUE
... ...
@@ -41,7 +41,7 @@ object. Can be one of "Matrix" (as returned by
41 41
 \link[base]{matrix} function). Default "Matrix".}
42 42
 
43 43
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
44
-\link{DelayedArray} object or not. Default \code{TRUE}.}
44
+\link{DelayedArray} object or not. Default \code{FALSE}.}
45 45
 
46 46
 \item{cbNotFirstCol}{Boolean. \code{TRUE} if first column of
47 47
  sparse_counts_barcode.csv
... ...
@@ -13,7 +13,7 @@ importSTARsolo(
13 13
   barcodesFileNames = "barcodes.tsv",
14 14
   gzipped = "auto",
15 15
   class = c("Matrix", "matrix"),
16
-  delayedArray = TRUE
16
+  delayedArray = FALSE
17 17
 )
18 18
 }
19 19
 \arguments{
... ...
@@ -57,7 +57,7 @@ object. Can be one of "Matrix" (as returned by
57 57
 \link[base]{matrix} function). Default "Matrix".}
58 58
 
59 59
 \item{delayedArray}{Boolean. Whether to read the expression matrix as
60
-\link{DelayedArray} object or not. Default \code{TRUE}.}
60
+\link{DelayedArray} object or not. Default \code{FALSE}.}
61 61
 }
62 62
 \value{
63 63
 A \code{SingleCellExperiment} object containing the count