View source: R/Seurat.Utils.Metadata.R
heatmap_calc_clust_median | R Documentation |
This function calculates the median of specified variables in a dataframe, grouped by a column ('ident'). The function also provides an option to scale the medians, subset the ident levels, and either return a matrix of median values or plot a heatmap.
heatmap_calc_clust_median(
meta,
ident,
subset_ident_levels = FALSE,
variables,
scale = TRUE,
suffix = NULL,
return_matrix = FALSE,
plotname = "Median metadata values by cluster",
n_cut_row = NA,
n_cut_col = NA,
w = ceiling(length(variables)/2),
...
)
meta |
A dataframe containing metadata from a Seurat object. |
ident |
A character string representing the column name to be used for grouping the data. |
subset_ident_levels |
An optional vector of ident levels to subset. Default is FALSE. |
variables |
A character vector containing the names of columns for which to calculate the median. |
scale |
A logical indicating whether to scale the medians. Default is TRUE. |
suffix |
A character string added to the plot file name if not returning a matrix. Default is NULL. |
return_matrix |
A logical indicating whether to return a matrix of medians, or plot a heatmap. Default is FALSE. |
plotname |
A character string representing the main title for the plot. Default is "Median metadata values by cluster". |
n_cut_row |
The number of row rows to cut the tree into on the |
n_cut_col |
The number of column clusters to cut the tree into on the |
w |
The width of the plot (if not returning a matrix). Default is half the number of variables. |
... |
Additional parameters passed to the pheatmap function. |
If 'return_matrix' is TRUE, a matrix where rows correspond to the unique values of 'ident', and columns correspond to 'variables'. Each element of the matrix represents the median of a specific variable for a specific group. If 'return_matrix' is FALSE, it saves a heatmap plot and returns the plot object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.