make_sample_lr_prod_activity_plots_Omnipath: make_sample_lr_prod_activity_plots_Omnipath

View source: R/plotting.R

make_sample_lr_prod_activity_plots_OmnipathR Documentation

make_sample_lr_prod_activity_plots_Omnipath

Description

make_sample_lr_prod_activity_plots_Omnipath Visualize the scaled product of Ligand-Receptor (pseudobulk) expression per sample, and compare the different groups. In addition, show the NicheNet ligand activities in each receiver-celltype combination, AND the Omnipath curation scores of the LR pairs.

Usage

make_sample_lr_prod_activity_plots_Omnipath(prioritization_tables, prioritized_tbl_oi, widths = NULL)

Arguments

prioritization_tables

Output of 'generate_prioritization_tables' or sublist in the output of 'multi_nichenet_analysis'

prioritized_tbl_oi

Should be the same as in 'make_sample_lr_prod_activity_plots', except, there should be Omnipath LR quality metrics included: curation_effort, n_resources, n_references. See example here, and vignettes, on how to do this.

widths

Vector of 4 elements: Width of the LR exprs product panel, width of the scaled ligand activity panel, width of the cell-type specificity panel & width of the Omnipath panel. Default NULL: automatically defined based on nr of samples vs nr of group-receiver combinations. If manual change: example format: c(6,2,2,1)

Value

Ligand-Receptor Expression Product & Ligand Activities Dotplot/Heatmap

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)
lr_network_all = readRDS("../../../NicheNet_V2/networks/data/ligand_receptor/lr_network_human_allInfo_30112033.rds") %>% mutate(ligand = convert_alias_to_symbols(ligand, organism = "human"), receptor = convert_alias_to_symbols(receptor, organism = "human"))
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"))
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"
prioritized_tbl_oi = output$prioritization_tables$group_prioritization_tbl %>% filter(fraction_expressing_ligand_receptor > 0) %>% filter(group == group_oi) %>% top_n(50, prioritization_score) 
plot_oi = make_sample_lr_prod_activity_plots_Omnipath(output$prioritization_tables, prioritized_tbl_oi %>% inner_join(lr_network_all))
plot_oi

## End(Not run)


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