Browse code

Minor change to way calculateUMAP is called from scater to improve speed and get around a potential error

Joshua D. Campbell authored on 07/07/2021 17:25:05
Showing 1 changed files

... ...
@@ -1014,23 +1014,17 @@ addLogLikelihood <- function(llA, llB) {
1014 1014
   }
1015 1015
   sce <- scater::logNormCounts(sce, log = TRUE)
1016 1016
 
1017
-  if (nrow(sce) <= varGenes) {
1018
-    topVariableGenes <- seq_len(nrow(sce))
1019
-  } else if (nrow(sce) > varGenes) {
1020
-    sce.var <- scran::modelGeneVar(sce)
1021
-    topVariableGenes <- order(sce.var$bio,
1022
-      decreasing = TRUE
1023
-    )[seq(varGenes)]
1024
-  }
1025
-  sce <- sce[topVariableGenes, ]
1026
-
1027 1017
   if (!is.null(seed)) {
1028 1018
     with_seed(
1029 1019
       seed,
1030
-      resUmap <- scater::calculateUMAP(sce, n_threads = 1)
1020
+      resUmap <- scater::calculateUMAP(sce, ntop = varGenes,
1021
+                                       n_threads = 1,
1022
+                                       exprs_values = "logcounts")
1031 1023
     )
1032 1024
   } else {
1033
-    resUmap <- scater::calculateUMAP(sce, n_threads = 1)
1025
+    resUmap <- scater::calculateUMAP(sce, ntop = varGenes,
1026
+                                     n_threads = 1,
1027
+                                     exprs_values = "logcounts")
1034 1028
   }
1035 1029
 
1036 1030
   z <- NULL