plot_celltype_severity: Plot cell type severity

View source: R/plot_celltype_severity.R

plot_celltype_severityR Documentation

Plot cell type severity

Description

Plot the phenotype severity scores (generated by GPT-4) aggregated by the cell types each phenotype is significantly associated with.

Usage

plot_celltype_severity(
  results,
  cl = get_cl(),
  q_threshold = 0.05,
  run_enrichment = TRUE,
  top_n = 3,
  types = c("dot", "bar")[1],
  run_prune_ancestors = FALSE,
  nonsig_fill = ggplot2::alpha("grey90", 0.001),
  force_new = FALSE,
  base_size = 8,
  save_path = tempfile(fileext = ".rds"),
  workers = 1
)

Arguments

results

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

cl

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

q_threshold

The q value threshold to subset the results by.

run_enrichment

Instead of simply taking the top N results, run a series of one-sided Wilcoxan rank-sum tests to determine whether the distribution of ordinal severity values (never=0, rarely=1, often=2, always=3) are significantly different between a given cell type and all other cell types. Tests are repeated across each GPT annotation separately using group_by and wilcox_test.

top_n

Top and bottom number of cell types to show per annotation (used in dot plot only).

types

Which types of plots of create.

run_prune_ancestors

Prune redundant ancestral terms if any of their descendants are present. Passes to prune_ancestors.

nonsig_fill

Fill colour for non-significant results.

force_new

Run a new set of enrichment tests even when cached results are found. Only used when run_enrichment=FALSE.

base_size

base font size, given in pts.

save_path

Path to save results to.

workers

Number (>1) or proportion (<1) of worker cores to use.

Value

Named list of ggplot and data.table objects.

Examples

set.seed(2025)
results <- load_example_results()
results <- results[sample(seq(nrow(results)), 5000),]
out <- plot_celltype_severity(results)

neurogenomics/MultiEWCE documentation built on April 17, 2025, 9:27 p.m.