assign_ligands_to_celltype: Assign ligands to cell types

View source: R/application_visualization.R

assign_ligands_to_celltypeR Documentation

Assign ligands to cell types

Description

Assign ligands to a sender cell type, based on the strongest expressing cell type of that ligand. Ligands are only assigned to a cell type if that cell type is the only one to show an expression that is higher than the average + SD. Otherwise, it is assigned to "General".

Usage

assign_ligands_to_celltype(seuratObj, ligands, celltype_col, func.agg=mean, func.assign=function(x) mean(x) + sd(x), slot="data", condition_oi=NULL, condition_col=NULL)

Arguments

seuratObj

Seurat object

ligands

Vector of ligands to assign to cell types

celltype_col

Metadata column name in the Seurat object that contains the cell type information

func.agg

Function to use to aggregate the expression of a ligand across all cells in a cell type (default = mean)

func.assign

Function to use to assign a ligand to a cell type (default = mean + SD)

condition_oi

Condition of interest to subset the Seurat object (default = NULL)

condition_col

Metadata column name in the Seurat object that contains the condition of interest (default = NULL)

slot

Slot in the Seurat object to use (default = "data"). If "data", the normalized counts are first exponentiated before aggregation is performed

Value

A data frame of two columns, the cell type the ligand has been assigned to (ligand_type) and the ligand name (ligand)

Examples

## Not run: 
assign_ligands_to_celltype(seuratObj = seuratObj, ligands = best_upstream_ligands[1:20],
                          celltype_col = "celltype", func.agg = mean, func.assign = function(x) {mean(x)+sd(x)},
                          slot = "data", condition_oi = "LCMV", condition_col = "aggregate")

## End(Not run)


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