This puts all the functions together from getting the subset of results to creating the final interactive plot.

ggnetwork_plot_full(
  cell_type,
  ancestor = NULL,
  results = load_example_results(),
  hpo = HPOExplorer::get_hpo(),
  phenotype_to_genes = HPOExplorer::load_phenotype_to_genes(),
  q_threshold = 5e-04,
  fold_threshold = 1,
  columns = HPOExplorer::list_columns(),
  colour_var = "fold_change",
  size_var = "ontLvl_relative",
  add_ont_lvl_absolute = TRUE,
  add_ont_lvl_relative = TRUE,
  interactive = TRUE,
  verbose = TRUE
)

Arguments

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.

results

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

hpo

Human Phenotype Ontology object, loaded from ontologyIndex.

phenotype_to_genes

Output of load_phenotype_to_genes mapping phenotypes to gene annotations.

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.

columns

A named vector of columns in phenos to add to the hoverdata via make_hoverboxes.

colour_var

Column to be mapped to node colour.

size_var

Column name to be mapped to node size.

add_ont_lvl_absolute

Add the absolute ontology level of each HPO term. See get_ont_lvls for more details.

add_ont_lvl_relative

Add the relative ontology level of each HPO term. See get_ont_lvls for more details.

interactive

Make the plot interactive with ggplotly.

verbose

Print messages.

Value

A named list of outputs, including a interactive network plot of the selected subset of results from RD EWCE analysis.

Examples

res <- ggnetwork_plot_full(cell_type = "Microglia")
#> ggnetwork_plot_full
#> Subsetting results by q_threshold and fold_change.
#> Subsetting results by cell_type
#> 2,719 associations remain after filtering.
#> Aggregating results by group_var='hpo_name'
#> Adding HPO IDs.
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2023-10-09
#> Translating all phenotypes to HPO IDs.
#>  All local files already up-to-date!
#> + Returning a vector of phenotypes (same order as input).
#> Warning: 1 HPO IDs are still missing.
#> Warning: 1 HPO IDs are still missing.
#>  All local files already up-to-date!
#> Creating adjacency matrix for 9 term(s).
#> Getting absolute ontology level for 9 HPO IDs.
#> Getting relative ontology level for 9 HPO IDs.
#> Adding term definitions.
#>  All local files already up-to-date!
#> Making hoverboxes from: 'hpo_name', 'hpo_id', 'ontLvl', 'ontLvl_relative', 'definition', 'celltype', 'mean_q', 'mean_fold_change', 'mean_sd_from_mean'
#> Making phenotype network object.
#> Creating ggnetwork object.
#> Adding new_column='hpo_name'
#> Adding new_column='hpo_id'
#> Adding new_column='ontLvl'
#> Adding new_column='ontLvl_relative'
#> Adding new_column='definition'
#> Adding new_column='celltype'
#> Adding new_column='mean_q'
#> Adding new_column='mean_fold_change'
#> Adding new_column='mean_sd_from_mean'
#> Adding n_edges per node.
#> Creating ggnetwork plot.