Plot the phenotype severity scores (generated by GPT-4) aggregated by the cell types each phenotype is significantly associated with.
The cell type-phenotype enrichment results generated by gen_results and merged together with merge_results
Cell Ontology (CL) object from
KGExplorer::get_ontology("cl")
.
The q value threshold to subset the results
by.
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 and bottom number of cell types to show per annotation (used in dot plot only).
Which types of plots of create.
Prune redundant ancestral terms if any of their descendants are present. Passes to prune_ancestors.
Fill colour for non-significant results.
Run a new set of enrichment tests even when cached
results are found. Only used when run_enrichment=FALSE
.
base font size, given in pts.
Path to save results to.
Number (>1) or proportion (<1) of worker cores to use.
Named list of ggplot and data.table objects.
set.seed(2025)
results <- load_example_results()
results <- results[sample(seq(nrow(results)), 5000),]
out <- plot_celltype_severity(results, types=c("bar","dot"))
#> Mapping cell types to cell ontology terms.
#> Adding stage information.
#> Translating ontology terms to ids.
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2025-05-06
#> 151 phenotypes do not have matching HPO IDs.
#> Reading in GPT annotations for 16,982 phenotypes.
#> Creating bar plot.
#> Creating dot plot.
#> 1 core(s) assigned as workers (3 reserved).
#> Running Wilcoxon rank-sum tests:
#>
|
| | 0%
|
|= | 2%
|
|== | 4%
|
|==== | 5%
|
|===== | 7%
|
|====== | 9%
|
|======== | 11%
|
|========= | 12%
|
|========== | 14%
|
|=========== | 16%
|
|============ | 18%
|
|============== | 20%
|
|=============== | 21%
|
|================ | 23%
|
|================== | 25%
|
|=================== | 27%
|
|==================== | 29%
|
|===================== | 30%
|
|====================== | 32%
|
|======================== | 34%
|
|========================= | 36%
|
|========================== | 38%
|
|============================ | 39%
|
|============================= | 41%
|
|============================== | 43%
|
|=============================== | 45%
|
|================================ | 46%
|
|================================== | 48%
|
|=================================== | 50%
|
|==================================== | 52%
|
|====================================== | 54%
|
|======================================= | 55%
|
|======================================== | 57%
|
|========================================= | 59%
|
|========================================== | 61%
|
|============================================ | 62%
|
|============================================= | 64%
|
|============================================== | 66%
|
|================================================ | 68%
|
|================================================= | 70%
|
|================================================== | 71%
|
|=================================================== | 73%
|
|==================================================== | 75%
|
|====================================================== | 77%
|
|======================================================= | 79%
|
|======================================================== | 80%
|
|========================================================== | 82%
|
|=========================================================== | 84%
|
|============================================================ | 86%
|
|============================================================= | 88%
|
|============================================================== | 89%
|
|================================================================ | 91%
|
|================================================================= | 93%
|
|================================================================== | 95%
|
|==================================================================== | 96%
|
|===================================================================== | 98%
|
|======================================================================| 100%
#>
#> Caching Wilcoxon rank-sum test results: /tmp/RtmpsW0tFt/file100e527c6380.rds