Skip to content

Commit

Permalink
nf Convert10Xfolders NormalizeData
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Dec 4, 2024
1 parent 3b07d27 commit 0affc73
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/Seurat.Utils.Metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -526,18 +526,18 @@ addMetaFraction <- function(
layer = "data",
gene.set = FALSE,
verbose = TRUE) {
#
message("Should rather use the default `Seurat::PercentageFeatureSet`")
message("Assay: ", assay)
message("Layer: ", layer)

stopifnot(
is(obj, "Seurat"),
is.character(col.name), is.character(assay), is.character(layer),
is.logical(gene.set), is.logical(verbose),
assay %in% Assays(obj), layer %in% Layers(obj)
)

message("Should rather use the default `Seurat::PercentageFeatureSet`")
message("Assay: ", assay)
message("Layer: ", layer)


stopif(condition = isFALSE(gene.set) && isFALSE(gene.symbol.pattern), "Either gene.set OR gene.symbol.pattern has to be defined (!= FALSE).")
if (!isFALSE(gene.set) && !isFALSE(gene.symbol.pattern) && verbose) print("Both gene.set AND gene.symbol.pattern are defined. Only using gene.set.")

Expand Down
5 changes: 5 additions & 0 deletions R/Seurat.Utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4421,6 +4421,7 @@ PlotUpdateStats <- function(mat = UpdateStatMat, column.names = c("Updated (%)",
#' @param suffix A character string specifying the suffix of the files saved.
#' @param min.cells An integer value specifying the minimum number of cells. Default: 5.
#' @param min.features An integer value specifying the minimum number of features. Default: 200.
#' @param normalize_data Add normalized "data" layer?. Default: `TRUE`.
#' @param updateHGNC A logical value indicating whether to update the HGNC. Default: `TRUE`.
#' @param save Save .qs object? Default: `TRUE`.
#' @param ShowStats A logical value indicating whether to show statistics. Default: `TRUE`.
Expand All @@ -4441,6 +4442,7 @@ Convert10Xfolders <- function(
suffix = strsplit(folderPattern, "_")[[1]][1],
depth = 4,
min.cells = 5, min.features = 200,
normalize_data = TRUE,
updateHGNC = TRUE, ShowStats = TRUE,
writeCBCtable = TRUE,
nthreads = .getNrCores(),
Expand Down Expand Up @@ -4499,6 +4501,9 @@ Convert10Xfolders <- function(
# update --- --- ---
if (updateHGNC) seu <- UpdateGenesSeurat(seu, EnforceUnique = TRUE, ShowStats = TRUE)

# NormalizeData --- --- ---
if (normalize_data) seu <- NormalizeData(seu, normalization.method = "LogNormalize", scale.factor = 10000, verbose = TRUE)

# write out --- --- ---
if (save) qs::qsave(x = seu, file = f.path.out, nthreads = nthreads, preset = preset)

Expand Down
3 changes: 3 additions & 0 deletions man/Convert10Xfolders.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0affc73

Please sign in to comment.