add_empirical_pval_fdr: Add empirical p-values and adjusted p-values to the DE output...

View source: R/muscat_de.R

add_empirical_pval_fdrR Documentation

Add empirical p-values and adjusted p-values to the DE output table.

Description

add_empirical_pval_fdr Add empirical p-values and adjusted p-values to the DE output of Muscat. Credits to Jeroen Gillis (cf satuRn package)

Usage

add_empirical_pval_fdr(de_output_tidy, plot = FALSE)

Arguments

de_output_tidy

Data frame of DE results, containing at least the following columns: cluster_id, contrast, p_val, logFC.

plot

TRUE or FALSE (default): should we plot the z-score distribution?

Value

de_output_tidy dataframe with two columns added: p_emp and p_adj_emp.

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)
sample_id = "tumor"
group_id = "pEMT"
celltype_id = "celltype"
batches = NA
contrasts_oi = c("'High-Low','Low-High'")
senders_oi = SummarizedExperiment::colData(sce)[,celltype_id] %>% unique()
receivers_oi = SummarizedExperiment::colData(sce)[,celltype_id] %>% unique()
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)
de_output_tidy = muscat::resDS(celltype_de$sce, celltype_de$de_output, bind = "row", cpm = FALSE, frq = FALSE) %>% tibble::as_tibble()
de_output_tidy = add_empirical_pval_fdr(de_output_tidy)

## End(Not run)


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