Skip to content

Commit

Permalink
test-featureSelection fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayarav committed Jan 29, 2024
1 parent 515115c commit bbdcc35
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion R/plotTopHVG.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ plotTopHVG <- function(inSCE,
hvgNumber <- length(hvgList)
} else if (!is.null(hvgNumber)) {
hvgList <- getTopHVG(inSCE = inSCE, method = method, hvgNumber = hvgNumber,
featureDisplay = NULL)
featureDisplay = NULL, useFeatureSubset = NULL)
}
if (is.null(hvgNumber) || hvgNumber == 0) {
redIdx <- logical()
Expand Down
34 changes: 17 additions & 17 deletions tests/testthat/test-featureSelection.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ test_that(desc = "Testing FindHVG", {
sce <- setTopHVG(sce, "modelGeneVar", hvgNumber = 2000, altExp = TRUE, featureSubsetName = NULL)
nHVG <- length(getTopHVG(sce, useFeatureSubset = "HVG_modelGeneVar2000"))

# testthat::expect_true(is.logical(rowData(sce)$HVG_modelGeneVar2000))
# testthat::expect_equal(nrow(altExp(sce, "HVG_modelGeneVar2000")), nHVG)
# testthat::expect_equal(metadata(sce)$sctk$featureSubsets$HVG_modelGeneVar2000$useAssay,
# "seuratNormData")
#
# hvgs <- getTopHVG(sce, "mean.var.plot", hvgNumber = 2000,
# featureDisplay = "feature_name")
# testthat::expect_false(all(startsWith(hvgs, "ENSG00000")))
# hvgs <- getTopHVG(sce, "vst", hvgNumber = 2000)
# vm1 <- plotTopHVG(sce, "dispersion")
# vm2 <- plotTopHVG(sce, "modelGeneVar", hvgNumber = 30, labelsCount = 10,
# featureDisplay = "feature_name")
# vm3 <- plotTopHVG(sce, method = "mean.var.plot",
# useFeatureSubset = "HVG_modelGeneVar2000")
# testthat::expect_true(inherits(vm1, "ggplot"))
# testthat::expect_true(inherits(vm2, "ggplot"))
# testthat::expect_true(inherits(vm3, "ggplot"))
testthat::expect_true(is.logical(rowData(sce)$HVG_modelGeneVar2000))
testthat::expect_equal(nrow(altExp(sce, "HVG_modelGeneVar2000")), nHVG)
testthat::expect_equal(metadata(sce)$sctk$featureSubsets$HVG_modelGeneVar2000$useAssay,
"seuratNormData")

hvgs <- getTopHVG(sce, "mean.var.plot", hvgNumber = 2000,
featureDisplay = "feature_name", useFeatureSubset = NULL)
testthat::expect_false(all(startsWith(hvgs, "ENSG00000")))
hvgs <- getTopHVG(sce, "vst", hvgNumber = 2000, useFeatureSubset = NULL)
vm1 <- plotTopHVG(sce, "dispersion", hvgNumber = NULL)
vm2 <- plotTopHVG(sce, "modelGeneVar", hvgNumber = 30, labelsCount = 10,
featureDisplay = "feature_name")
vm3 <- plotTopHVG(sce, method = "mean.var.plot",
useFeatureSubset = "HVG_modelGeneVar2000", hvgNumber = NULL)
testthat::expect_true(inherits(vm1, "ggplot"))
testthat::expect_true(inherits(vm2, "ggplot"))
testthat::expect_true(inherits(vm3, "ggplot"))
})

0 comments on commit bbdcc35

Please sign in to comment.