Browse code

Fixed bug in featureModuleTable with displayName

Joshua D. Campbell authored on 16/07/2021 20:09:35
Showing 1 changed files

... ...
@@ -552,7 +552,9 @@ featureModuleTable <- function(sce,
552 552
       useAssay = useAssay,
553 553
       altExpName = altExpName,
554 554
       type = "proportion")
555
-  allGenes <- topRank(factorizeMatrix$proportions$module, n = nrow(sce))
555
+  altExp <- SingleCellExperiment::altExp(sce, altExpName)
556
+  
557
+  allGenes <- topRank(factorizeMatrix$proportions$module, n = nrow(altExp))
556 558
   maxlen <- max(vapply(allGenes$names, length, integer(1)))
557 559
 
558 560
   if (is.null(displayName)) {
... ...
@@ -563,7 +565,7 @@ featureModuleTable <- function(sce,
563 565
   } else {
564 566
       dn <- lapply(allGenes$index,
565 567
           FUN = function(v) {
566
-            SummarizedExperiment::rowData(sce)[[displayName]][v]
568
+            SummarizedExperiment::rowData(altExp)[[displayName]][v]
567 569
           })
568 570
       res <- vapply(dn,
569 571
           FUN = "[",