R Under development (unstable) (2024-10-10 r87224 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > # Load necessary libraries > library(diceplot) > library(dplyr) Attaching package: 'dplyr' The following objects are masked from 'package:stats': filter, lag The following objects are masked from 'package:base': intersect, setdiff, setequal, union > 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" + ) Plot saved to domino_plot_example.png (7.0 x 5.0 inches) Warning messages: 1: Removed 90 rows containing missing values or values outside the scale range (`geom_point()`). 2: Removed 90 rows containing missing values or values outside the scale range (`geom_point()`). > > # Display the plot > print(p) Warning messages: 1: Removed 90 rows containing missing values or values outside the scale range (`geom_point()`). 2: Removed 90 rows containing missing values or values outside the scale range (`geom_point()`). > > proc.time() user system elapsed 2.70 0.40 3.01