Browse code

Updated description in DESCRIPTION. Moved importMultipleSources to its own file and removed some shiny code. Updated docs.

Joshua D. Campbell authored on 12/10/2020 18:25:27
Showing 11 changed files

... ...
@@ -21,7 +21,7 @@ before_install:
21 21
   - Rscript -e 'install.packages("devtools")'
22 22
   - Rscript -e 'devtools::install_version("xgboost", version = "0.90.0.2", repos = "http://cran.us.r-project.org")'
23 23
   - pip install --upgrade pip
24
-  - pip install scipy scrublet scanpy scanorama scgen bbknn
24
+  - pip install scipy scrublet scanpy scanorama bbknn
25 25
 
26 26
 install:
27 27
 - R -e 'devtools::install_deps(dep = TRUE, upgrade="never")'
... ...
@@ -31,11 +31,9 @@ addons:
31 31
     packages:
32 32
       - libv8-dev
33 33
 
34
-r_build_args: "--no-build-vignettes"
35
-r_check_args: "--no-vignettes --no-build-vignettes --as-cran"
34
+r_check_args: "--as-cran"
36 35
 r_github_packages:
37 36
   - jimhester/lintr
38
-  - campbio/celda
39 37
 notifications:
40 38
   slack:
41 39
     secure: sw/He3WX7Fs61DTufgG9hx7fWDhwx57zv+dYB4sr30LgKyIJNbZYSU76ZN4oPwHFGAJ0eyk/22XCuKF8/seSB2ArQuc4kFlsaeWWg1CxDqW9iR0zs91MJL3lJoUOSayy5WcWbsUxD+x8GcB37FCgoTXcveN956bfgrDb2nGrFY6QMSVsnkWi/kiMdzhR4VPzOfmAUZUcr1aDU3WN4ROwbDg89zCfu9HbVKZwyQdYZk7L2Pgg8xGIcGZkaMN1MMD/r0Wc2aVYqCOcn5qO/9CaspEBf7cd6ejVzgAl/LM4dTIPlx9E6ekQGwJXpt1Qxyc0sqVSQWFZvFkWyV3wkqX8pfSXV6ojlP2cGJt+PSQXwLHj0TKWYx7yHbw+55da/b//SVLZVHl+P6VXxQBe2hmFD6sCk3V3uq2CkxzI52bK4Wv4RRncVKIZEpFZOc9P2ik5mf6pICmLHwttlbHeDjJbQ+raYftF704xb1sOxapLwuy+c2SWKPeqOiimfZNgOK+J7JbvQvpnaiHN+3CA3wQXs1auKBwI+swvsZPAzeKssnLv/0AQmX8ckVzvXJzUvl1J73c9V2zG2F44xmIsXwzruEp6leSbeXcLifrfbfQdmaHzq4M/Z83o/fwGRzdWfG7YXDyPIabik7DOMrSUvF+wLGVTjOart8HrA4eVEkKFnRE=
... ...
@@ -1,6 +1,6 @@
1 1
 Package: singleCellTK
2 2
 Type: Package
3
-Title: Interactive Analysis of Single Cell RNA-Seq Data
3
+Title: Comprehensive and Interactive Analysis of Single Cell RNA-Seq Data
4 4
 Version: 1.7.6
5 5
 Author: David Jenkins
6 6
 Authors@R: c(person(given="David", family="Jenkins", email="dfj@bu.edu", role=c("aut","cre"),
... ...
@@ -20,12 +20,9 @@ Depends:
20 20
     SingleCellExperiment,
21 21
     DelayedArray,
22 22
     Biobase
23
-Description: Run common single cell analysis directly through your browser
24
-    including differential expression, downsampling analysis, and clustering.
23
+Description: Run common single cell analysis in the R console or directly through your browser. Includes many functions for import, quality control, normalization, batch correction, clustering, differential expression, and visualization..
25 24
 License: MIT + file LICENSE
26 25
 Encoding: UTF-8
27
-cache:
28
-  - packages: true
29 26
 biocViews: SingleCell, GeneExpression, DifferentialExpression, Alignment,
30 27
     Clustering, ImmunoOncology
31 28
 LazyData: TRUE
... ...
@@ -123,7 +120,6 @@ Remotes:
123 120
     rz2333/mnormt@1.5-6,
124 121
     joshua-d-campbell/liger,
125 122
     joshua-d-campbell/shiny-directory-input,
126
-    campbio/celda@RELEASE_3_11
127 123
 VignetteBuilder: knitr
128 124
 URL: https://compbiomed.github.io/sctk_docs/
129 125
 BugReports: https://github.com/compbiomed/singleCellTK/issues
... ...
@@ -89,9 +89,10 @@
89 89
 #' There are no known R solutions at present. Refer \url{https://github.com/rstudio/reticulate/issues/209}
90 90
 #' @return A \code{SingleCellExperiment} object.
91 91
 #' @examples
92
+#' \dontrun{
92 93
 #' sce <- importAnnData(sampleDirs = system.file("extdata/annData_pbmc_3k", package = "singleCellTK"),
93 94
 #'                      sampleNames = 'pbmc3k_20by20')
94
-
95
+#' }
95 96
 #' @export
96 97
 importAnnData <- function(sampleDirs = NULL,
97 98
                           sampleNames = NULL,
98 99
new file mode 100644
... ...
@@ -0,0 +1,84 @@
1
+
2
+#' Imports samples from different sources and compiles them into a list of SCE objects
3
+#' @param allImportEntries object containing the sources and parameters of all the samples being imported (from the UI)
4
+#' @return A list of \link[SingleCellExperiment]{SingleCellExperiment} object containing
5
+#' the droplet or cell data or both,depending on the dataType that users provided.
6
+#' @export
7
+importMultipleSources <- function(allImportEntries) {
8
+  sceObjs <- list()
9
+  for (entry in allImportEntries$samples) {
10
+    if (entry$type == "cellRanger2") {
11
+      if (is.null(entry$params$cellRangerDirs)) {
12
+        newSce <- importCellRangerV2Sample(
13
+          dataDir = entry$params$dataDir,
14
+          sampleName = entry$params$sampleName,
15
+        )
16
+      } else {
17
+        newSce <- importCellRangerV2(
18
+          cellRangerDirs = entry$params$cellRangerDirs,
19
+          sampleDirs = entry$params$sampleDirs,
20
+          sampleNames = entry$params$sampleNames,
21
+        )
22
+      }
23
+      
24
+    } else if (entry$type == "cellRanger3") {
25
+      if (is.null(entry$params$cellRangerDirs)) {
26
+        newSce <- importCellRangerV3Sample(
27
+          dataDir = entry$params$dataDir,
28
+          sampleName = entry$params$sampleName,
29
+        )
30
+      } else {
31
+        newSce <- importCellRangerV3(
32
+          cellRangerDirs = entry$params$cellRangerDirs,
33
+          sampleDirs = entry$params$sampleDirs,
34
+          sampleNames = entry$params$sampleNames,
35
+        )
36
+      }
37
+    } else if (entry$type == "starSolo") {
38
+      newSce <- importSTARsolo(
39
+        STARsoloDirs = entry$params$STARsoloDirs,
40
+        samples = entry$params$amples
41
+      )
42
+    } else if (entry$type == "busTools") {
43
+      newSce <- importBUStools(
44
+        BUStoolsDirs = entry$params$BUStoolsDirs,
45
+        samples = entry$params$samples,
46
+      )
47
+    } else if (entry$type == "seqc") {
48
+      newSce <- importSEQC(
49
+        seqcDirs = entry$params$seqcDirs,
50
+        samples = entry$params$samples,
51
+        prefix = entry$params$prefix,
52
+      )
53
+    } else if (entry$type == "optimus") {
54
+      newSce <- importOptimus(
55
+        OptimusDirs = entry$params$OptimusDirs,
56
+        samples = entry$params$samples
57
+      )
58
+    } else if (entry$type == "files") {
59
+      newSce <- importFromFiles(assayFile = entry$params$assayFile,
60
+                                annotFile = entry$params$annotFile,
61
+                                featureFile = entry$params$featureFile,
62
+                                assayName = entry$params$assayName)
63
+    } else if (entry$type == "example") {
64
+      newSce <- importExampleData(dataset = entry$params$dataset)
65
+    } else if (entry$type == "rds") {
66
+      importedrds <- readRDS(entry$params$rdsFile)
67
+      if (base::inherits(importedrds, "SummarizedExperiment")) {
68
+        newSce <- importedrds
69
+      } else if (base::inherits(importedrds, "Seurat")) {
70
+        newSce <- convertSeuratToSCE(importedrds)
71
+      } else {
72
+        stop("The '.rds' file should contain a 'SingleCellExperiment' or 'Seurat' object.")
73
+      }
74
+    }
75
+    sceObjs = c(sceObjs, list(newSce))
76
+  }
77
+  
78
+  return(combineSCE(sceList = sceObjs,
79
+                    by.r = NULL,
80
+                    by.c = Reduce(intersect, lapply(sceObjs, function(x) { colnames(colData(x))})),
81
+                    combined = T)
82
+  )
83
+}
84
+
... ...
@@ -393,87 +393,3 @@ qcInputProcess <- function(preproc,
393 393
     stop(paste0("'", preproc, "' not supported."))
394 394
 }
395 395
 
396
-
397
-#' Imports samples from different sources and compiles them into a list of SCE objects
398
-#' @param allImportEntries object containing the sources and parameters of all the samples being imported (from the UI)
399
-#' @return A list of \link[SingleCellExperiment]{SingleCellExperiment} object containing
400
-#' the droplet or cell data or both,depending on the dataType that users provided.
401
-#' @export
402
-importMultipleSources <- function(allImportEntries) {
403
-  sceObjs <- list()
404
-  for (entry in allImportEntries$samples) {
405
-    if (entry$type == "cellRanger2") {
406
-      if (is.null(entry$params$cellRangerDirs)) {
407
-        newSce <- importCellRangerV2Sample(
408
-          dataDir = entry$params$dataDir,
409
-          sampleName = entry$params$sampleName,
410
-        )
411
-      } else {
412
-        newSce <- importCellRangerV2(
413
-          cellRangerDirs = entry$params$cellRangerDirs,
414
-          sampleDirs = entry$params$sampleDirs,
415
-          sampleNames = entry$params$sampleNames,
416
-        )
417
-      }
418
-
419
-    } else if (entry$type == "cellRanger3") {
420
-      if (is.null(entry$params$cellRangerDirs)) {
421
-        newSce <- importCellRangerV3Sample(
422
-          dataDir = entry$params$dataDir,
423
-          sampleName = entry$params$sampleName,
424
-        )
425
-      } else {
426
-        newSce <- importCellRangerV3(
427
-          cellRangerDirs = entry$params$cellRangerDirs,
428
-          sampleDirs = entry$params$sampleDirs,
429
-          sampleNames = entry$params$sampleNames,
430
-        )
431
-      }
432
-    } else if (entry$type == "starSolo") {
433
-      newSce <- importSTARsolo(
434
-        STARsoloDirs = entry$params$STARsoloDirs,
435
-        samples = entry$params$amples
436
-      )
437
-    } else if (entry$type == "busTools") {
438
-      newSce <- importBUStools(
439
-        BUStoolsDirs = entry$params$BUStoolsDirs,
440
-        samples = entry$params$samples,
441
-      )
442
-    } else if (entry$type == "seqc") {
443
-      newSce <- importSEQC(
444
-        seqcDirs = entry$params$seqcDirs,
445
-        samples = entry$params$samples,
446
-        prefix = entry$params$prefix,
447
-      )
448
-    } else if (entry$type == "optimus") {
449
-      newSce <- importOptimus(
450
-        OptimusDirs = entry$params$OptimusDirs,
451
-        samples = entry$params$samples
452
-      )
453
-    } else if (entry$type == "files") {
454
-      newSce <- importFromFiles(assayFile = entry$params$assayFile,
455
-                                annotFile = entry$params$annotFile,
456
-                                featureFile = entry$params$featureFile,
457
-                                assayName = entry$params$assayName)
458
-    } else if (entry$type == "example") {
459
-      newSce <- withConsoleMsgRedirect(importExampleData(dataset = entry$params$dataset))
460
-    } else if (entry$type == "rds") {
461
-      importedrds <- readRDS(entry$params$rdsFile)
462
-      if (base::inherits(importedrds, "SummarizedExperiment")) {
463
-        newSce <- importedrds
464
-      } else if (base::inherits(importedrds, "Seurat")) {
465
-        newSce <- convertSeuratToSCE(importedrds)
466
-      } else {
467
-        shiny::showNotification("The '.rds' file should contain a 'SingleCellExperiment' or 'Seurat' object.", type = "error")
468
-      }
469
-    }
470
-    sceObjs = c(sceObjs, list(newSce))
471
-  }
472
-
473
-  return(combineSCE(sceList = sceObjs,
474
-                    by.r = NULL,
475
-                    by.c = Reduce(intersect, lapply(sceObjs, function(x) { colnames(colData(x))})),
476
-                    combined = T)
477
-         )
478
-}
479
-
... ...
@@ -13,8 +13,8 @@ exportSCE(
13 13
 )
14 14
 }
15 15
 \arguments{
16
-\item{inSCE}{A \link[SingleCellExperiment]{SingleCellExperiment} object 
17
-that contains the data. QC metrics are stored in colData of the 
16
+\item{inSCE}{A \link[SingleCellExperiment]{SingleCellExperiment} object
17
+that contains the data. QC metrics are stored in colData of the
18 18
 singleCellExperiment object.}
19 19
 
20 20
 \item{samplename}{Sample name. This will be used as name of subdirectories
... ...
@@ -22,7 +22,7 @@ and the prefix of flat file output. Default is 'sample'.}
22 22
 
23 23
 \item{directory}{Output directory. Default is './'.}
24 24
 
25
-\item{type}{Type of data. The type of data stored in SingleCellExperiment object. 
25
+\item{type}{Type of data. The type of data stored in SingleCellExperiment object.
26 26
 It can be 'Droplets'(raw droplets matrix) or 'Cells' (cells matrix).}
27 27
 
28 28
 \item{format}{The format of output. It currently supports flat files, rds files
... ...
@@ -29,7 +29,7 @@ cell count matrix data}
29 29
 \item{dataType}{Type of the input data. It can be one of "Droplet", "Cell" or "Both".}
30 30
 }
31 31
 \value{
32
-A \link[SingleCellExperiment]{SingleCellExperiment} object which combines all 
32
+A \link[SingleCellExperiment]{SingleCellExperiment} object which combines all
33 33
 objects in sceList. The colData is merged.
34 34
 }
35 35
 \description{
... ...
@@ -25,7 +25,7 @@ getSceParams(
25 25
 
26 26
 \item{samplename}{The sample name of the \link[SingleCellExperiment]{SingleCellExperiment} objects.}
27 27
 
28
-\item{writeYAML}{Whether output yaml file to store parameters. Default if TRUE. If FALSE, 
28
+\item{writeYAML}{Whether output yaml file to store parameters. Default if TRUE. If FALSE,
29 29
 return character object.}
30 30
 }
31 31
 \description{
... ...
@@ -55,6 +55,8 @@ Additionally there might be errors in converting some python objects in the unst
55 55
 There are no known R solutions at present. Refer \url{https://github.com/rstudio/reticulate/issues/209}
56 56
 }
57 57
 \examples{
58
+\dontrun{
58 59
 sce <- importAnnData(sampleDirs = system.file("extdata/annData_pbmc_3k", package = "singleCellTK"),
59 60
                      sampleNames = 'pbmc3k_20by20')
60 61
 }
62
+}
... ...
@@ -1,5 +1,5 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/sctkQCUtils.R
2
+% Please edit documentation in R/importMultipleSources.R
3 3
 \name{importMultipleSources}
4 4
 \alias{importMultipleSources}
5 5
 \title{Imports samples from different sources and compiles them into a list of SCE objects}
... ...
@@ -59,6 +59,9 @@ test_that(desc = "Testing importOptimus", {
59 59
 }) 
60 60
 
61 61
 test_that(desc = "Testing importAnnData", {
62
+  if (!reticulate::py_module_available("anndata")){
63
+    skip("'anndata' not available. Skipping testing importAnnData")
64
+  }
62 65
   sce <- importAnnData(sampleDirs = system.file("extdata/annData_pbmc_3k", package = "singleCellTK"),
63 66
                        sampleNames = 'pbmc3k_20by20')
64 67
   expect_true(validObject(sce))