Creates an interactive heatmap displaying -log10(Padj) values for selected clusters and terms. Users can specify clusters numerically or select them by providing term names. The function ensures that the final heatmap includes all terms from the selected clusters as well as any explicitly provided terms.
term_hmap(cluster_result, clusters, terms, value_type, aggr_type, title = NULL)An interactive heatmap object (`plotly`), displaying the -log10(Padj) values across clusters, with representative terms as row labels and color-coded cluster annotations.
A list containing a data frame (`cluster_df`) with clustering results. The data frame must include at least the columns `Cluster`, `Term`, and `Padj_*` values.
Optional. A numeric vector specifying the cluster numbers to display, or a character vector specifying terms whose clusters should be included. Defaults to `NULL`, which includes all clusters.
Optional. A character vector specifying additional terms to include in the heatmap. Defaults to `NULL`.
A character string specifying the column name prefix for adjusted p-values. Defaults to `"Padj"`.
A function used to aggregate values across clusters (e.g., `mean` or `median`). Defaults to `mean`.
An optional parameter to title the plot something else.
The function processes the given `cluster_df`, identifying the clusters and terms to be visualized. If `clusters` is specified as a numeric vector, the function directly filters based on cluster numbers. If `clusters` is given as a character vector, it identifies the clusters associated with those terms and retrieves all terms from the selected clusters.
The `Padj_*` values are transformed using `-log10()`, and infinite values are replaced with `0`. The resulting heatmap is generated using `heatmaply::heatmaply()` with fixed row ordering (no hierarchical clustering).