process_geneset_data: process_geneset_data

View source: R/ligand_activities.R

process_geneset_dataR Documentation

process_geneset_data

Description

process_geneset_data Determine ratio's of geneset_oi vs background for a certain logFC/p-val thresholds setting.

Usage

process_geneset_data(contrast_oi, receiver_de, logFC_threshold = 0.5, p_val_adj = FALSE, p_val_threshold = 0.05)

Arguments

contrast_oi

Name of one of the contrasts in the celltype_DE / receiver_DE output tibble.

receiver_de

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

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_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.

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.

Value

Tibble indicating the nr of up- and down genes per contrast/cell type combination, and an indication whether this is in the recommended ranges

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'")
contrast_tbl = tibble(contrast = c("High-Low","Low-High"), group = c("High","Low"))
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
geneset_assessment = contrast_tbl$contrast %>% 
lapply(process_geneset_data, receiver_de) %>% bind_rows() 

## End(Not run)


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