This function generates a plot to visualize gene expression levels for a given list of genes. The size of the dots can be customized, and the plot can be saved to an output file if specified.
domino_plot(
data,
gene_list,
x = "gene",
y = "Celltype",
contrast = "Contrast",
var_id = "var",
log_fc = "avg_log2FC",
p_val = "p_val_adj",
min_dot_size = 1,
max_dot_size = 5,
spacing_factor = 3,
logfc_colors = c(low = "blue", mid = "white", high = "red"),
color_scale_name = "Log2 Fold Change",
size_scale_name = "-log10(adj. p-value)",
axis_text_size = 8,
x_axis_text_size = NULL,
y_axis_text_size = NULL,
legend_text_size = 8,
cluster_method = "complete",
cluster_y_axis = TRUE,
cluster_var_id = TRUE,
base_width = 5,
base_height = 4,
show_legend = TRUE,
legend_width = 0.25,
legend_height = 0.5,
custom_legend = TRUE,
logfc_limits = NULL,
aspect_ratio = NULL,
switch_axis = FALSE,
reverse_y_ordering = FALSE,
show_var_positions = FALSE,
output_file = NULL,
feature_col = NULL,
celltype_col = NULL,
contrast_col = NULL,
logfc_col = NULL,
pval_col = NULL
)
A list containing the domino plot and optionally the variable positions plot.
A data frame containing gene expression data.
A character vector of gene names to include in the plot.
A string representing the column name in data
for the feature variable (e.g., genes). Default is "gene"
.
A string representing the column name in data
for the cell type variable. Default is "Celltype"
.
A string representing the column name in data
for the contrast variable. Default is "Contrast"
.
A string representing the column name in data
for the variable identifier. Default is "var"
.
A string representing the column name in data
for the log fold change values. Default is "avg_log2FC"
.
A string representing the column name in data
for the adjusted p-values. Default is "p_val_adj"
.
A numeric value indicating the minimum dot size in the plot. Default is 1
.
A numeric value indicating the maximum dot size in the plot. Default is 5
.
A numeric value indicating the spacing between gene pairs. Default is 3
.
A named vector specifying the colors for the low, mid, and high values in the color scale. Default is c(low = "blue", mid = "white", high = "red")
.
A string specifying the name of the color scale in the legend. Default is "Log2 Fold Change"
.
A string specifying the name of the size scale in the legend. Default is "-log10(adj. p-value)"
.
A numeric value specifying the size of the axis text. Default is 8
.
A numeric value specifying the size of the x-axis text. If NULL, uses axis_text_size
. Default is NULL
.
A numeric value specifying the size of the y-axis text. If NULL, uses axis_text_size
. Default is NULL
.
A numeric value specifying the size of the legend text. Default is 8
.
The clustering method to use. Default is "complete"
.
A logical value indicating whether to cluster the y-axis (cell types). Default is TRUE
.
A logical value indicating whether to cluster the var_id. Default is TRUE
.
A numeric value specifying the base width for saving the plot. Default is 5
.
A numeric value specifying the base height for saving the plot. Default is 4
.
A logical value indicating whether to show the legend. Default is TRUE
.
A numeric value specifying the relative width of the legend. Default is 0.25
.
A numeric value specifying the relative height of the legend. Default is 0.5
.
A logical value indicating whether to use a custom legend. Default is TRUE
.
A numeric vector of length 2 specifying the limits for the log fold change color scale. If NULL
(default), no limits are applied.
A numeric value specifying the aspect ratio of the plot. If NULL
, it's calculated automatically. Default is NULL
.
A logical value indicating whether to switch the x and y axes. Default is FALSE
.
A logical value indicating whether to reverse the y-axis ordering after clustering. Default is FALSE
.
A logical value indicating whether to show the intermediate variable positions plot. Default is FALSE
.
When output_file
is specified with a PDF extension, both plots will be saved to a multi-page PDF if this is TRUE
.
A warning will be shown if show_var_positions
is TRUE
but the output file is not a PDF.
An optional string specifying the path to save the plot. If NULL
, the plot is not saved. Default is NULL
.
Deprecated. Use x
instead.
Deprecated. Use y
instead.
Deprecated. Use contrast
instead.
Deprecated. Use log_fc
instead.
Deprecated. Use p_val
instead.