This function plots UMAP embeddings for multiple gene modules, with options for discrete or continuous coloring based on the summarization of gene expression. The function allows for customization of the plot appearance, including point size, alpha, legend text size, axis text size, and color schemes. It also provides the option to include trajectory graphs if a trajectory object is provided.
Usage
plot_umap_gene_modules(
module_summaries,
umap_embedding,
trajectory_object = NULL,
legend_detail = "",
combine_legend = TRUE,
scale_values = TRUE,
n_columns = 3,
trajectory_width = 0.75,
cell_sort_order = c("lowest", "highest", "default"),
cell_size = 0.3,
cell_alpha = 0.8,
legend_text_size = 10,
axis_text_size = 10,
legend_key_size = 1,
colourbar_height = 50,
continuous_colors = NULL,
show_labels = FALSE
)Arguments
- module_summaries
A data frame or a list of data frames containing the summarized gene expression information for each module. If a data frame is provided, it should have columns corresponding to each module. If a list is provided, each element should be a data frame for a specific module.
- umap_embedding
A matrix or data frame containing the UMAP coordinates of the cells. It should have two columns corresponding to UMAP1 and UMAP2.
- trajectory_object
An optional trajectory object that can be used to overlay trajectory graphs on the UMAP plots. The trajectory object should be compatible with the
plot_trajectory_graphfunction.- legend_detail
A string to be appended to the legend title for continuous coloring, providing additional context about the summarization method used.
- combine_legend
A logical indicating whether to combine the legends of all module plots into a single legend. Defaults to TRUE.
- scale_values
A logical indicating whether to scale the summarized gene expression values between 0 and 1 for continuous coloring. Defaults to TRUE.
- n_columns
An integer specifying the number of columns to use when arranging the module plots. Defaults to 3.
- trajectory_width
A numeric value specifying the width of the trajectory edges when overlaying the trajectory graph on the UMAP plots. Defaults to 0.75.
- cell_sort_order
A character vector specifying the order of cells based on the summarized gene expression values. It can be either "lowest", "highest" or "default" to sort cells by the summarized values in ascending, descending or no particular order, respectively.
- cell_size
A numeric value specifying the size of the points in the UMAP plots. Defaults to 0.3.
- cell_alpha
A numeric value specifying the transparency of the points in the UMAP plots. Defaults to 0.8.
- legend_text_size
A numeric value specifying the size of the text in the legends. Defaults to 10.
- axis_text_size
A numeric value specifying the size of the axis text in the UMAP plots. Defaults to 10.
- legend_key_size
A numeric value specifying the size of the legend keys for discrete coloring. Defaults to 1.
- colourbar_height
A numeric value specifying the height of the colorbar for continuous coloring. Defaults to 50 points. If set to 0, the colorbar will be hidden.
- continuous_colors
A vector of colors for continuous coloring. If NULL, the default ggplot2 colors will be used.
- show_labels
A logical indicating whether to show labels for discrete groups. Defaults to FALSE.