plot_bar_dendro: Plot bar dendrogram

View source: R/plot_bar_dendro.R

plot_bar_dendroR Documentation

Plot bar dendrogram

Description

Create a plot summarising MSTExplorer results as a bar chart with multiple facets showing selected branches from the Human Phenotype Ontology (HPO). Also shows a dendrogram of celltype-celltype relationships using the Cell Ontology (CL).

Usage

plot_bar_dendro(
  results = load_example_results(),
  celltype_col = "cl_name",
  target_branches = get_target_branches(),
  keep_ancestors = names(target_branches),
  hpo = HPOExplorer::get_hpo(),
  cl = KGExplorer::get_ontology(name = "cl", lvl = 1, remove_rings = TRUE),
  facets = "ancestor_name",
  add_test_target_celltypes = TRUE,
  preferred_palettes = "tol",
  legend.position = "none",
  heights = c(0.3, 1, 0.15, 0.3),
  expand_dendro_x = rep(0.01, 2),
  q_threshold = 0.05,
  show_plot = TRUE,
  save_path = NULL,
  height = 16,
  width = 13,
  ...
)

Arguments

results

The cell type-phenotype enrichment results generated by gen_results and merged together with merge_results

celltype_col

Name of the cell type column in the results.

target_branches

A named list of HPO branches each matched with CL cell type branches that correspond to on-target cell types across the two ontologies.

keep_ancestors

Only HPO terms that have these ancestors will be kept.

hpo

Human Phenotype Ontology object, loaded from get_ontology.

cl

Cell Ontology (CL) object from KGExplorer::get_ontology("cl").

facets

A set of variables or expressions quoted by vars() and defining faceting groups on the rows or columns dimension. The variables can be named (the names are passed to labeller).

For compatibility with the classic interface, can also be a formula or character vector. Use either a one sided formula, ~a + b, or a character vector, c("a", "b").

add_test_target_celltypes

Using the significant phenotype-cell type association results, run proportional enrichment tests to determine whether each cell type is overrepresented in a given HPO branch relative to all other HPO branches. Overrepresented cell types will be denoted by "*" above its bar.

preferred_palettes

Preferred palettes to use for each column.

legend.position

the default position of legends ("none", "left", "right", "bottom", "top", "inside")

heights

Passed to wrap_plots.

expand_dendro_x

Passed to scale_x_discrete in the cell type dendrogram.

q_threshold

The q value threshold to subset the results by.

show_plot

Print the plot to the console.

save_path

Save the plot to a file. Set to NULL to not save the plot.

height

Height of the saved plot.

width

Width of the saved plot.

...

Arguments passed on to EWCE::ewce_plot

total_res

Results data.frame generated using bootstrap_enrichment_test or ewce_expression_data functions. Multiple results tables can be merged into one results table, as long as the 'list' column is set to distinguish them. Multiple testing correction is then applied across all merged results.

mtc_method

Method to be used for multiple testing correction. Argument is passed to p.adjust (DEFAULT: "bonferroni).

ctd

CellTypeDataset object. Should be provided so that the dendrogram can be taken from it and added to plots.

annotLevel

An integer indicating which level of ctd to analyse (Default: 1).

make_dendro

Add a dendrogram (requires ctd).

verbose

Print messages.

Value

A bar chart with dendrogram of EWCE results in each cell type.

Examples

results <- load_example_results()
out <- plot_bar_dendro(results = results)

neurogenomics/MultiEWCE documentation built on Sept. 28, 2024, 2:27 a.m.