make_DEgene_dotplot_pseudobulk_batch: make_DEgene_dotplot_pseudobulk_batch

View source: R/plotting.R

make_DEgene_dotplot_pseudobulk_batchR Documentation

make_DEgene_dotplot_pseudobulk_batch

Description

make_DEgene_dotplot_pseudobulk_batch Visualize the scaled pseudobulk expression of DE genes per sample, and compare the different groups. Genes in rows, samples in columns

Usage

make_DEgene_dotplot_pseudobulk_batch(genes_oi, celltype_info, prioritization_tables, celltype_oi, batch_oi, grouping_tbl, groups_oi = NULL)

Arguments

genes_oi

Character vector with names of genes to visualize

celltype_info

'celltype_info' or 'receiver_info' slot of the output of the 'multi_nichenet_analysis' function

prioritization_tables

'prioritization_tables' slot of the output of the 'generate_prioritization_tables' or 'multi_nichenet_analysis' function

celltype_oi

Character vector with names of celltype of interest

batch_oi

Name of the batch that needs to be visualized for each sample

grouping_tbl

'grouping_tbl' slot of the output of the 'multi_nichenet_analysis' function

groups_oi

Which groups to show? Default: NULL – will show all groups.

Value

Gene expression dotplot list: pseudobulk version and single-cell version

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 = "batch"
contrasts_oi = c("'High-Low','Low-High'")
contrast_tbl = tibble(contrast = c("High-Low","Low-High"), group = c("High","Low"))
output = multi_nichenet_analysis(
     sce = sce, 
     celltype_id = celltype_id, 
     sample_id = sample_id, 
     group_id = group_id,
     batches = batches,
     lr_network = lr_network, 
     ligand_target_matrix = ligand_target_matrix, 
     contrasts_oi = contrasts_oi, 
     contrast_tbl = contrast_tbl
     
     )
group_oi = "High"
receiver_oi = "Malignant"
targets_oi = output$ligand_activities_targets_DEgenes$de_genes_df %>% inner_join(contrast_tbl) %>% filter(group == group_oi) %>% arrange(p_val) %>% filter(receiver == receiver_oi) %>% pull(gene) %>% unique()
p_target = make_DEgene_dotplot_pseudobulk_batch(genes_oi = targets_oi, celltype_info = output$celltype_info, prioritization_tables = output$prioritization_tables, celltype_oi = receiver_oi, batch_oi = batches, output$grouping_tbl)

## End(Not run)


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