PctCellsExpressingGenes: PctCellsExpressingGenes

View source: R/Seurat.Utils.Visualization.R

PctCellsExpressingGenesR Documentation

PctCellsExpressingGenes

Description

Calculates the proportion of cells expressing one or more specified genes using a Seurat object as input.

Usage

PctCellsExpressingGenes(
  genes,
  obj,
  assay = "RNA",
  min.expr = 1,
  ident = NULL,
  max.idents = 100
)

Arguments

genes

A character vector specifying the genes of interest. Must be a non-empty character vector.

obj

A Seurat object containing single-cell data.

assay

The assay to use for expression data. Default: "RNA".

min.expr

The minimum expression level to consider a gene as "expressed". Default: 1.

ident

A categorical variable from the metadata of the Seurat object. If NULL, returns overall proportions. Default: NULL.

max.idents

Maximum number of unique values allowed in the ident variable. Default: 100.

Value

A named vector if ident is NULL, containing the proportion of cells co-expressing all genes (AND), the proportion expressing any gene (OR), and the proportion expressing each gene individually. If ident is provided, returns a matrix with rows representing categories and columns representing expression proportions.

Examples

## Not run: 
# Load the Seurat object (example)
library(Seurat)
combined.obj <- readRDS("path/to/your/seurat_object.rds")

# Define genes of interest
# Define genes of interest
genes <- c("TOP2A", "MAP2")
# Call the function
PctCellsExpressingGenes(genes = genes, obj = combined.obj)
# Call the function with ident
#' PctCellsExpressingGenes(genes = genes, obj = combined.obj, ident = "cluster")

## End(Not run)


vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.