get_exprs_avg: Calculate average of gene expression per cell type.

View source: R/prioritization.R

get_exprs_avgR Documentation

Calculate average of gene expression per cell type.

Description

get_exprs_avg Calculate average of gene expression per cell type. If condition_oi is provided, only consider cells from that condition.

Usage

get_exprs_avg(
  seurat_obj,
  celltype_colname,
  condition_oi = NULL,
  condition_colname = NULL,
  assay_oi = NULL,
  ...
)

Arguments

seurat_obj

Seurat object

celltype_colname

Name of the meta data column that indicates the cell type of a cell

condition_oi

If provided, subset seurat_obj so average expression is only calculated for cells belonging to condition_oi

condition_colname

Name of the meta data column that indicates from which group/condition a cell comes from

assay_oi

Which assay need to be used for DE calculation. If NULL, will use DefaultAssay

...

Arguments passed to Seurat::AverageExpression, usually for slot/layer to use (default: data)

Value

Data frame with average gene expression per cell type.

Examples

## Not run: 
seurat_obj = readRDS(url("https://zenodo.org/record/3531889/files/seuratObj.rds"))
seurat_obj$celltype <- make.names(seuratObj$celltype)
# Calculate average expression across conditions
expression_info = get_exprs_avg(seurat_obj, "celltype")
# Calculate LCMV-specific average expression
expression_info = get_exprs_avg(seurat_obj, "celltype", condition_oi = "LCMV", condition_colname = "aggregate")

## End(Not run)


saeyslab/nichenetr documentation built on April 27, 2024, 9:24 p.m.