make_target_violin_plot: make_target_violin_plot

View source: R/plotting.R

make_target_violin_plotR Documentation

make_target_violin_plot

Description

make_target_violin_plot Violin plot of a target gene of interest: per sample, and samples are grouped per group

Usage

make_target_violin_plot(sce, target_oi, receiver_oi, group_oi, group_id, sample_id, celltype_id, batch_oi = NA, background_groups = NULL)

Arguments

sce

SingleCellExperiment object

target_oi

Name of the gene of interest

receiver_oi

Character vector with the names of the receiver cell type of interest

group_oi

Character vector of name of the group of interest

group_id

Name of the meta data column that indicates from which group/condition a cell comes from

sample_id

Name of the colData(sce) column in which the id of the sample is defined

celltype_id

Name of the meta data column that indicates the cell type of a cell

batch_oi

Name of a batch of interest based on which the visualization will be split. Default: NA: no batch.

background_groups

Default NULL: all groups in the group_id metadata column will be chosen. But user can fill in a character vector with the names of all gruops of interest.

Value

ggplot object: Violin plot of a target gene of interest: per sample, and samples are grouped per group

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"))
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
     )
receiver_oi = "Malignant"
group_oi = "High"
target_oi = "RAB31"
p_violin_target = make_target_violin_plot(sce = sce, target_oi = target_oi, receiver_oi = receiver_oi, group_oi = group_oi, group_id = group_id, sample_id, celltype_id = celltype_id)

## End(Not run)

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