Skip to contents

process_table_to_ic First, only keep information of ligands for senders_oi, and information of receptors for receivers_oi. Then, combine information for senders and receivers by linking ligands to receptors based on the prior knowledge ligand-receptor network.

Usage

process_table_to_ic(table_object, table_type = "expression", lr_network, senders_oi = NULL, receivers_oi = NULL)

Arguments

table_object

Output of get_exprs_avg, calculate_de, or FindMarkers

table_type

"expression", "celltype_DE", or "group_DE": indicates whether the table contains expression, celltype markers, or condition-specific information

lr_network

Prior knowledge Ligand-Receptor network (columns: ligand, receptor)

senders_oi

Default NULL: all celltypes will be considered as senders. If you want to select specific senders of interest: you can add this here as character vector.

receivers_oi

Default NULL: all celltypes will be considered as receivers If you want to select specific receivers of interest: you can add this here as character vector.

Value

Dataframe combining sender and receiver information linked to each other through joining by the ligand-receptor network.

Examples

if (FALSE) { # \dontrun{
library(dplyr)
lr_network <- readRDS(url("https://zenodo.org/record/3260758/files/lr_network.rds"))
lr_network <- lr_network %>%
  dplyr::rename(ligand = from, receptor = to) %>%
  dplyr::distinct(ligand, receptor)
seurat_obj <- readRDS(url("https://zenodo.org/record/3531889/files/seuratObj.rds"))
seurat_obj$celltype <- make.names(seuratObj$celltype)
# Calculate LCMV-specific average expression
expression_info <- get_exprs_avg(seurat_obj, "celltype", condition_oi = "LCMV", condition_colname = "aggregate")
# Calculate LCMV-specific cell-type markers
DE_table <- calculate_de(seurat_obj, "celltype", condition_oi = "LCMV", condition_colname = "aggregate")
# Calculate LCMV-specific genes across cell types
condition_markers <- FindMarkers(
  object = seuratObj, ident.1 = "LCMV", ident.2 = "SS",
  group.by = "aggregate", min.pct = 0, logfc.threshold = 0
) %>% rownames_to_column("gene")
processed_expr_info <- process_table_to_ic(expression_info, table_type = "expression", lr_network)
processed_DE_table <- process_table_to_ic(DE_table,
  table_type = "celltype_DE", lr_network,
  senders_oi = c("CD4.T", "Treg", "Mono", "NK", "B", "DC"), receivers_oi = "CD8.T"
)
processed_condition_markers <- process_table_to_ic(condition_markers, table_type = "condition_DE", lr_network)
} # }