Plot a phenotype x phenotype correlation matrix based on genetic overlap.

correlation_heatmap(
  top_targets,
  row_side_vars = c("ancestor_name", "ontLvl", "onset_top"),
  col_side_vars = c("n_celltypes", "n_genes"),
  phenotype_to_genes = HPOExplorer::load_phenotype_to_genes(),
  col = pals::gnuplot(),
  show_plot = TRUE,
  save_plot = tempfile(fileext = "correlation_heatmap.pdf"),
  height = 10,
  width = height * 1.3,
  fontsize = 7,
  row_km = 3,
  column_km = row_km,
  row_km_repeats = 1000,
  column_km_repeats = row_km_repeats,
  seed = 2023,
  interact = FALSE,
  verbose = TRUE
)

Arguments

top_targets

data.table of prioritised targets generated by prioritise_targets.

row_side_vars

Variables to include in row-side metadata annotations.

col_side_vars

Variables to include in column-side metadata annotations.

phenotype_to_genes

Output of load_phenotype_to_genes mapping phenotypes to gene annotations.

col

A vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers (should be generated by colorRamp2). If the matrix is continuous, the value can also be a vector of colors so that colors can be interpolated. Pass to ColorMapping. For more details and examples, please refer to https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#colors .

show_plot

Print the plot after generating it.

save_plot

Path to save plot to.

height

Height of the heatmap body.

width

Width of the heatmap body.

fontsize

Axis labels font size.

row_km

Same as km.

column_km

K-means clustering on columns.

row_km_repeats

Number of k-means runs to get a consensus k-means clustering. Note if row_km_repeats is set to more than one, the final number of groups might be smaller than row_km, but this might means the original row_km is not a good choice.

column_km_repeats

Number of k-means runs to get a consensus k-means clustering. Similar as row_km_repeats.

seed

Set the seed for reproducible clustering.

interact

Make the plot interactive via heatmaply.

verbose

Print messages.

Value

Plot

Examples

top_targets <- example_targets$top_targets[seq(100),]
hm <- correlation_heatmap(top_targets = top_targets)
#> Constructing HPO gene x phenotype matrix.
#> Reading cached RDS file: phenotype_to_genes.txt
#> + Version: v2023-10-09
#> Annotating gene-disease associations with Evidence score
#> Annotating phenos with Disease
#> Reading cached RDS file: phenotype.hpoa
#> + Version: v2023-10-09
#> Gathering data from GenCC.
#> Importing cached file.
#> + Version: 2023-11-14
#> Computing all parwise correlations.
#> Aggregating results by group_var='hpo_name'/'hpo_id'/'ancestor_name'/'ontLvl'/'onset_top'
#> Loading required namespace: ComplexHeatmap