p.adjust_empirical: Get empirical p-values and adjusted p-values.

p.adjust_empiricalR Documentation

Get empirical p-values and adjusted p-values.

Description

p.adjust_empirical Get emperical p-values and adjusted p-values. Credits to Jeroen Gillis (cf satuRn package)

Usage

p.adjust_empirical(pvalues, tvalues, plot = FALSE, celltype = NULL, contrast = NULL)

Arguments

pvalues

Vector of original p-values

tvalues

Vector of original t-values: in case of DE analysis: log fold changes

plot

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

celltype

NULL, or name of the cell type of interest - this will be added to the plot title if plot = TRUE

contrast

NULL, or name of the contrast of interest - thhis will be added to the plot title if plot = TRUE

Value

List with empirical p-values and adjusted p-values + ggplot output and estimated delta and sigma.

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()
emp_res = p.adjust_empirical(de_output_tidy %>% pull(p_val), de_output_tidy  %>% pull(p_val), plot = T)

## End(Not run)


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