# Load necessary libraries library(diceplot) library(dplyr) library(ggplot2) library(tidyr) # library(diceplot) # Ensure this library is installed or remove if not needed # Define genes gene_list <- c("GeneA", "GeneB", "GeneC") # Define cell types cell_types <- c("Neuron", "Astrocyte", "Microglia") # Define Contrasts contrasts <- c("Clinical", "Pathological") # Define vars for each Contrast vars_clinical <- c("MCI-NCI", "AD-MCI", "AD-NCI") vars_pathological <- c("Amyloid", "Plaq N", "Tangles", "NFT") # Create a data frame with all combinations data <- expand.grid( gene = gene_list, Celltype = cell_types, Contrast = contrasts, stringsAsFactors = FALSE ) # Add the appropriate vars to each Contrast set.seed(123) # Ensure reproducibility data_clinical <- data %>% filter(Contrast == "Clinical") %>% mutate(var = sample(vars_clinical, n(), replace = TRUE)) data_pathological <- data %>% filter(Contrast == "Pathological") %>% mutate(var = sample(vars_pathological, n(), replace = TRUE)) # Combine the data data <- bind_rows(data_clinical, data_pathological) # Assign random values for avg_log2FC and p_val_adj data <- data %>% mutate( avg_log2FC = runif(n(), min = -2, max = 2), p_val_adj = runif(n(), min = 0.0001, max = 0.05) ) # Use the corrected function p <- domino_plot( data = data, gene_list = gene_list, switch_axis = FALSE, min_dot_size = 1, max_dot_size = 5, output_file = "domino_plot_example.png" ) # Display the plot print(p)