Generate a plot summarising the cell type-phenotype enrichment results generated by gen_results.

summary_plot(
  results = load_example_results(),
  count_var = "hpo_name",
  group_var = "CellType",
  keywords = NULL,
  q_threshold = 5e-04,
  fold_threshold = 1,
  cell_type = NULL,
  ancestor = NULL,
  hpo = HPOExplorer::get_hpo(),
  phenotype_to_genes = HPOExplorer::load_phenotype_to_genes(),
  option = "magma",
  interactive = TRUE,
  verbose = TRUE
)

Arguments

results

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

count_var

Variable to get counts for per group_var.

group_var

Variable to group counts by.

keywords

Keywords supplied to search for phenotypes. Will be used to generate the plot title..

q_threshold

The q value threshold to subset the results by.

fold_threshold

The minimum fold change in specific expression to subset the results by.

cell_type

The cell type of interest to be plotted. Can be a single string (e.g. "Astrocytes") or a character vector of multiple cell types (e..g. c("Astrocytes","Microglia")). Set to NULL if you wish to include all cell-types that are available (after q_threshold and fold_threshold filtering). If >1 cell-type remains, results will be aggregated automatically such that there is only 1 node per phenotype.

ancestor

The ancestor to get all descendants of. If NULL, returns the entirely ontology.

hpo

Human Phenotype Ontology object, loaded from ontologyIndex.

phenotype_to_genes

Output of load_phenotype_to_genes mapping phenotypes to gene annotations.

option

A character string indicating the color map option to use. Eight options are available:

  • "magma" (or "A")

  • "inferno" (or "B")

  • "plasma" (or "C")

  • "viridis" (or "D")

  • "cividis" (or "E")

  • "rocket" (or "F")

  • "mako" (or "G")

  • "turbo" (or "H")

interactive

Make the plot interactive with ggplotly.

verbose

Print messages.

Value

ggplot or plotly object

Examples

ancestor <- "Neurodevelopmental delay"
plt_pheno_count <- summary_plot(count_var = "hpo_name",
                                group_var = "CellType",
                                ancestor = ancestor)
#> Subsetting results by q_threshold and fold_change.
#> Skipping cell_type filter.
#> 649,567 associations remain after filtering.
#> Subsetting phenotypes to only ancestors of: Neurodevelopmental delay
#> Translating all phenotypes to HPO IDs.
#>  All local files already up-to-date!
#> + Returning a vector of phenotypes (same order as input).
#> 16,581 associations remain after filtering.
#> Aggregating results by group_var='CellType'
plt_cell_count <- summary_plot(count_var = "CellType",
                                group_var = "hpo_name",
                                ancestor = ancestor)
#> Subsetting results by q_threshold and fold_change.
#> Skipping cell_type filter.
#> 649,567 associations remain after filtering.
#> Subsetting phenotypes to only ancestors of: Neurodevelopmental delay
#> Translating all phenotypes to HPO IDs.
#>  All local files already up-to-date!
#> + Returning a vector of phenotypes (same order as input).
#> 16,581 associations remain after filtering.
#> Aggregating results by group_var='hpo_name'