get_ligand_activities_targets: Calculate the ligand activities and infer ligand-target links...

View source: R/differential_nichenet.R

get_ligand_activities_targetsR Documentation

Calculate the ligand activities and infer ligand-target links based on a list of niche-specific genes per receiver cell type

Description

get_ligand_activities_targets Calculate the ligand activities and infer ligand-target links based on a list of niche-specific genes per receiver cell type.

Usage

get_ligand_activities_targets(niche_geneset_list, ligand_target_matrix, top_n_target)

Arguments

niche_geneset_list

List of lists/niches giving the geneset of interest for the receiver cell type in each niche.

ligand_target_matrix

The NicheNet ligand-target matrix of the organism of interest denoting regulatory potential scores between ligands and targets (ligands in columns).

top_n_target

To predict active, affected targets of the prioritized ligands, consider only DE genes if they also belong to the a priori top n ("top_n_targets") targets of a ligand. Default = 200.

Value

A tibble of ligands, their activities and targets in each receiver cell type

Examples

## Not run: 
seurat_obj = readRDS(url("https://zenodo.org/record/5840787/files/seurat_obj_subset_integrated_zonation.rds"))
niches = list(
"KC_niche" = list(
  "sender" = c("LSECs_portal","Hepatocytes_portal","Stellate cells_portal"),
  "receiver" = c("KCs")),
"MoMac2_niche" = list(
  "sender" = c("Cholangiocytes","Fibroblast 2"),
  "receiver" = c("MoMac2")),
"MoMac1_niche" = list(
  "sender" = c("Capsule fibroblasts","Mesothelial cells"),
 "receiver" = c("MoMac1"))
DE_receiver = calculate_niche_de(seurat_obj, niches, "receiver")
expression_pct = 0.10
lfc_cutoff = 0.15 # recommended for 10x as min_lfc cutoff.
specificity_score_targets = "min_lfc"
DE_receiver_processed_targets = process_receiver_target_de(DE_receiver_targets = DE_receiver, niches = niches, expression_pct = expression_pct, specificity_score = specificity_score_targets)
background = DE_receiver_processed_targets  %>% pull(target) %>% unique()
geneset_KC = DE_receiver_processed_targets %>% filter(receiver == niches$KC_niche$receiver & target_score >= lfc_cutoff & target_significant == 1 & target_present == 1) %>% pull(target) %>% unique()
geneset_MoMac2 = DE_receiver_processed_targets %>% filter(receiver == niches$MoMac2_niche$receiver & target_score >= lfc_cutoff & target_significant == 1 & target_present == 1) %>% pull(target) %>% unique()
geneset_MoMac1 = DE_receiver_processed_targets %>% filter(receiver == niches$MoMac1_niche$receiver & target_score >= lfc_cutoff & target_significant == 1 & target_present == 1) %>% pull(target) %>% unique()
top_n_target = 250
niche_geneset_list = list(
 "KC_niche" = list(
   "receiver" = "KCs",
   "geneset" = geneset_KC,
   "background" = background),
 "MoMac1_niche" = list(
   "receiver" = "MoMac1",
   "geneset" = geneset_MoMac1 ,
   "background" = background),
 "MoMac2_niche" = list(
   "receiver" = "MoMac2",
   "geneset" = geneset_MoMac2 ,
   "background" = background)
)
ligand_activities_targets = get_ligand_activities_targets(niche_geneset_list = niche_geneset_list, ligand_target_matrix = ligand_target_matrix, top_n_target = top_n_target)

## End(Not run)


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