Skip to content

Commit

Permalink
bf addMetaFraction
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Dec 4, 2024
1 parent 1da8abc commit 3b07d27
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/Seurat.Utils.Metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,13 @@ addMetaFraction <- function(
layer = "data",
gene.set = FALSE,
verbose = TRUE) {
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)
Expand All @@ -535,7 +542,7 @@ addMetaFraction <- function(
if (!isFALSE(gene.set) && !isFALSE(gene.symbol.pattern) && verbose) print("Both gene.set AND gene.symbol.pattern are defined. Only using gene.set.")

# if (!isFALSE(gene.set)) geneset <- check.genes(genes = gene.set, obj = obj)
total_expr <- Matrix::colSums(GetAssayData(object = obj))
total_expr <- Matrix::colSums(GetAssayData(object = obj, assay = assay, layer = layer))
all.genes <- Features(obj, assay = assay)

genes.matching <- if (!isFALSE(gene.set)) {
Expand Down

0 comments on commit 3b07d27

Please sign in to comment.