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

plot_celltype_severity(
  results,
  cl = KGExplorer::filter_ontology(KGExplorer::get_ontology("cl"), keep_descendants =
    "cell"),
  q_threshold = 0.05,
  top_n = 3,
  types = c("bar", "dot")
)

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.

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.

Value

Named list of ggplot and data.table objects.

Examples

results <- load_example_results()
out <- plot_celltype_severity(results)
#> Mapping cell types to cell ontology terms.
#> Adding stage information.
#> Translating ontology terms to ids.
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2024-12-12
#> 383 phenotypes do not have matching HPO IDs.
#> Reading in GPT annotations for 16,753 phenotypes.
#> Creating bar plot.
#> Creating dot plot.
#> Translating ontology terms to ids.
#> Loading cached ontology: /github/home/.cache/R/KGExplorer/cl.rds
#> Keeping descendants of 1 term(s).
#> 2,801 terms remain after filtering.
#> Translating ontology terms to ids.
#> 
#> going through 1000 / 2801 nodes ...
#> 
#> going through 2000 / 2801 nodes ...
#> 
#> going through 2801 / 2801 nodes ... Done.
#> Converted ontology to: dendrogram