get_ligand_activities_targets_DEgenes: get_ligand_activities_targets_DEgenes

View source: R/ligand_activities.R

get_ligand_activities_targets_DEgenesR Documentation

get_ligand_activities_targets_DEgenes

Description

get_ligand_activities_targets_DEgenes Predict NicheNet ligand activities and ligand-target links for the receiver cell types. Uses 'nichenetr::predict_ligand_activities()' and 'nichenetr::get_weighted_ligand_target_links()' under the hood.

Usage

get_ligand_activities_targets_DEgenes(receiver_de, receivers_oi,  ligand_target_matrix, logFC_threshold = 0.50, p_val_threshold = 0.05, p_val_adj = FALSE, top_n_target = 250, verbose = FALSE, n.cores = 1)

Arguments

receiver_de

Differential expression analysis output for the receiver cell types. 'de_output_tidy' slot of the output of 'perform_muscat_de_analysis'.

receivers_oi

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

ligand_target_matrix

Prior knowledge model of ligand-target regulatory potential (matrix with ligands in columns and targets in rows). See https://github.com/saeyslab/nichenetr.

logFC_threshold

For defining the gene set of interest for NicheNet ligand activity: what is the minimum logFC a gene should have to belong to this gene set? Default: 0.25/

p_val_threshold

For defining the gene set of interest for NicheNet ligand activity: what is the maximam p-value a gene should have to belong to this gene set? Default: 0.05.

p_val_adj

For defining the gene set of interest for NicheNet ligand activity: should we look at the p-value corrected for multiple testing? Default: FALSE.

top_n_target

For defining NicheNet ligand-target links: which top N predicted target genes. See 'nichenetr::get_weighted_ligand_target_links()'.

verbose

Indicate which different steps of the pipeline are running or not. Default: FALSE.

n.cores

The number of cores used for parallel computation of the ligand activities per receiver cell type. Default: 1 - no parallel computation.

Value

List with two data frames: one data frame containing the ligand activities and ligand-target links, one containing the DE gene information.

Examples

## Not run: 
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)
ligand_target_matrix = readRDS(url("https://zenodo.org/record/3260758/files/ligand_target_matrix.rds"))
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
batches = NA
contrasts_oi = c("'High-Low','Low-High'")
receivers_oi = SummarizedExperiment::colData(sce)[,celltype_id] %>% unique() 
celltype_info = get_avg_frac_exprs_abund(sce = sce, sample_id = sample_id, celltype_id =  celltype_id, group_id = group_id)
celltype_de = perform_muscat_de_analysis(
   sce = sce,
   sample_id = sample_id,
   celltype_id = celltype_id,
   group_id = group_id,
   batches = batches,
   contrasts = contrasts_oi)
receiver_de = celltype_de$de_output_tidy
ligand_activities_targets_DEgenes = get_ligand_activities_targets_DEgenes(
   receiver_de = receiver_de,
   receivers_oi = receivers_oi,
   ligand_target_matrix = ligand_target_matrix)

## End(Not run)


saeyslab/multinichenetr documentation built on Jan. 15, 2025, 7:55 p.m.