View source: R/plot_bar_dendro_facets.R
plot_bar_dendro_facets | R Documentation |
Plot bar plot of enriched phenotypes per cell type per HPO branch.
plot_bar_dendro_facets(
results = load_example_results(),
results_full = NULL,
hpo = HPOExplorer::get_hpo(),
target_branches = get_target_branches(),
keep_ancestors = names(target_branches),
target_celltypes = get_target_celltypes(target_branches = target_branches),
target_branches_keep = NULL,
celltype_col = "cl_name",
keep_ont_levels = NULL,
add_test_target_celltypes = TRUE,
color_map = NULL,
color_vector = NULL,
preferred_palettes = "gnuplot",
legend.position = "none",
fill_var = "ancestor_name",
facets = fill_var,
scales = "free_y",
q_threshold = NULL,
lvl = NULL,
facets_n = "phenotypes_per_ancestor",
suffix = "phenotypes",
vlines = NULL,
ncol = 1,
cols = NULL,
y_lab = "Significant phenotypes",
normalise_by = NULL,
background_full = TRUE,
save_path = NULL,
width = NULL,
height = NULL
)
results |
The cell type-phenotype enrichment results generated by gen_results and merged together with merge_results |
results_full |
A full set of results (not just those selected for
plotting in |
hpo |
Human Phenotype Ontology object, loaded from get_ontology. |
target_branches |
A named list of HPO branches each matched with CL cell type branches that correspond to on-target cell types across the two ontologies. |
keep_ancestors |
Only HPO terms that have these ancestors will be kept. |
target_celltypes |
A named list of HPO branches and matched CL ids. |
target_branches_keep |
Whether to plot the target branch ancestors
( |
celltype_col |
Name of the cell type column in the |
keep_ont_levels |
Only keep phenotypes at certain absolute ontology levels to keep. See add_ont_lvl for details. |
add_test_target_celltypes |
Using the significant phenotype-cell type
association |
color_map |
Colour map generated by map_colors to use for colouring the faceted bars (i.e. number of significant associations within a given HPO branch). |
color_vector |
A vector of colors to use for colouring the x-axis text (i.e. cell types). |
preferred_palettes |
Preferred palettes to use for each column. |
legend.position |
the default position of legends ("none", "left", "right", "bottom", "top", "inside") |
fill_var |
Variable to fill by. |
facets |
A set of variables or expressions quoted by For compatibility with the classic interface, can also be a
formula or character vector. Use either a one sided formula, |
scales |
Should scales be fixed ( |
q_threshold |
The q value threshold to subset the |
lvl |
HPO ontology to display the final plot as. |
facets_n |
A column to use when displaying the number of unique phenotypes within each facet. |
suffix |
Suffix for |
vlines |
Add vertical lines at specific x-axis intercepts (i.e. cell types). |
ncol |
Number of facet columns. |
cols |
Columns to use for faceting. |
y_lab |
y-axis label. |
normalise_by |
Normalise the bar heights from 0-1 within a given variable (e.g. "ancestor_name"). |
background_full |
Whether to use the full set of results as a background for proportional enrichment testing. |
save_path |
Save the plot to a file.
Set to |
width |
Width of the saved plot. |
height |
Height of the saved plot. |
hpo <- HPOExplorer::get_hpo()
target_branches <- list("Recurrent bacterial infections"="leukocyte")
lvl <- subset(hpo@elementMetadata,name==names(target_branches)[1])$ontLvl
results <- load_example_results()
results <- HPOExplorer::add_ancestor(results,
lvl = lvl,
force_new = TRUE)
out <- plot_bar_dendro_facets(results=results,
target_branches=target_branches,
facets = "hpo_name",
legend.position="right",
lvl=lvl+1,
ncol=2,
vlines="hepatoblast",
facets_n=NULL,
q_threshold=0.05,
background_full=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.