Skip to contents

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)
 },
  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)

...

Arguments passed to Seurat::GetAssayData, e.g., for the slot/layer to use (default: data)

Value

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

Details

If the provided slot/layer is "data", the normalized counts are first exponentiated before aggregation is performed

Examples

if (FALSE) { # \dontrun{
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)
  },
  condition_oi = "LCMV", condition_col = "aggregate", slot = "data"
)
} # }