Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for BioC release #755

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions R/getTopHVG.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ getTopHVG <- function(inSCE,
geneIdx <- featureIndex(topGenes, inSCE)
topGenes <- rowData(inSCE)[[featureDisplay]][geneIdx]
}

topGenes <- topGenes[!is.na(topGenes)]
topGenes <- topGenes[1:hvgNumber]

return(topGenes)
}

Expand Down
2 changes: 2 additions & 0 deletions R/seuratFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,8 @@ runSeuratFindMarkers <- function(inSCE,
#' @param features Specify the features to compute the plot against.
#' @param groupVariable Specify the column name from the colData slot that
#' should be used as grouping variable.
#' @param reducedDimName Specify the name of the dimensional reduction to be used.
#' Default is "seuratNormData".
#' @param splitBy Specify the column name from the colData slot that should be
#' used to split samples.
#' Default is \code{NULL}.
Expand Down
23 changes: 16 additions & 7 deletions exec/SCTK_runQC.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ if (is.null(subTitles)) {

if ("HTAN" %in% formats) {
if (!("FlatFile" %in% formats)) {
message("Notice: HTAN specified as output without FlatFile. Automatically including FlatFile export.")
message("Note: HTAN specified as output without FlatFile. Automatically including FlatFile export.")
formats <- append(formats, "FlatFile")
}
}
Expand Down Expand Up @@ -334,18 +334,26 @@ if (!is.null(gmt)) {
level3Meta <- list()
level4Meta <- list()

if (!is.null(flatFiles)) {
flatFiles <- split(flatFiles, ceiling(seq_along(flatFiles)/6))
}

for(i in seq_along(process)) {

# pop elements from FlatFile input list
if ("FlatFile" %in% process[i]) {
if (dataType %in% c("Droplet", "Cell")) {
flatFileInput <- flatFiles[c(1, 2, 3)]
flatFiles <- flatFiles[-c(1, 2, 3)]
}
else {
flatFileInput <- flatFiles[c(1, 2, 3, 4, 5, 6)]
flatFiles <- flatFiles[-c(1, 2, 3, 4, 5, 6)]
}
}

preproc <- process[i]
samplename <- sample[i]
path <- basepath[i]
raw <- RawDir[i]
fil <- FilterDir[i]
ref <- Reference[i]
flatFiles <- flatFiles[[i]]
rawFile <- RawFile[i]
filFile <- FilterFile[i]
subTitle <- subTitles[i]
Expand All @@ -357,7 +365,7 @@ for(i in seq_along(process)) {
ref,
rawFile,
filFile,
flatFiles,
flatFileInput,
dataType)
dropletSCE <- INPUT[[1]]
cellSCE <- INPUT[[2]]
Expand All @@ -366,6 +374,7 @@ for(i in seq_along(process)) {

cellQCAlgos <- c("QCMetrics", "scDblFinder", "cxds", "bcds", "scrublet", "doubletFinder",
"cxds_bcds_hybrid", "decontX", "decontX_bg", "soupX", "soupX_bg") #scrublet


# Checking to see if the input is a file instead of a directory, for RDS and H5AD reading
# also check to see if the sample name is specified, and if so, set it
Expand Down
13 changes: 7 additions & 6 deletions tests/testthat/test-featureSelection.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ test_that(desc = "Testing FindHVG", {
testthat::expect_true(all(metricNames.mvp %in% names(rowData(sce))))

# Test accessor functions
sce <- setTopHVG(sce, "modelGeneVar", hvgNumber = 2000, altExp = TRUE, featureSubsetName = NULL)
nHVG <- length(getTopHVG(sce, useFeatureSubset = "HVG_modelGeneVar2000"))
sce <- setTopHVG(sce, "modelGeneVar", hvgNumber = 50, altExp = TRUE, featureSubsetName = NULL)
#sce <- setTopHVG(sce, "modelGeneVar", hvgNumber = 2000, altExp = TRUE, featureSubsetName = NULL)
nHVG <- length(getTopHVG(sce, hvgNumber = 50, useFeatureSubset = "HVG_modelGeneVar50"))

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,
testthat::expect_true(is.logical(rowData(sce)$HVG_modelGeneVar50))
testthat::expect_equal(nrow(altExp(sce, "HVG_modelGeneVar50")), nHVG)
testthat::expect_equal(metadata(sce)$sctk$featureSubsets$HVG_modelGeneVar50$useAssay,
"seuratNormData")

hvgs <- getTopHVG(sce, "mean.var.plot", hvgNumber = 2000,
Expand All @@ -39,7 +40,7 @@ test_that(desc = "Testing FindHVG", {
vm2 <- plotTopHVG(sce, "modelGeneVar", hvgNumber = 30, labelsCount = 10,
featureDisplay = "feature_name")
vm3 <- plotTopHVG(sce, method = "mean.var.plot",
useFeatureSubset = "HVG_modelGeneVar2000", hvgNumber = NULL)
useFeatureSubset = "HVG_modelGeneVar50", hvgNumber = NULL)
testthat::expect_true(inherits(vm1, "ggplot"))
testthat::expect_true(inherits(vm2, "ggplot"))
testthat::expect_true(inherits(vm3, "ggplot"))
Expand Down
Loading