From 54c4af8bf7965c006ac9c36d986cd204fd52e001 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 16:47:38 -0700 Subject: [PATCH 01/15] Updating plot ggrepel --- R/bootstrap_plot.R | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 702301b..23d4853 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -27,6 +27,7 @@ bootstrap_plot <- function(gene_data, requireNamespace("ggplot2") requireNamespace("patchwork") + requireNamespace("ggrepel") Pos <- Rep <- Exp <- p <- significant <- CellType <- NULL; exp_mats_msg <- paste( @@ -36,8 +37,7 @@ bootstrap_plot <- function(gene_data, plots <- list() #### Set up save path #### dir.create(save_dir, showWarnings = FALSE, recursive = TRUE) - gene_data$symLab <- ifelse(gene_data$hit > 25, - sprintf(" %s", gene_data$gene), NA) + gene_data$symLab <- ifelse(gene_data$hit > 25, gene_data$gene, "") #### Filter gene_data #### if(!is.null(signif_ct)){ @@ -70,7 +70,7 @@ bootstrap_plot <- function(gene_data, facet_grid(facets = facets, scales = scales) + add_line() + - theme_graph() + theme_classic() plots[["plot1"]] <- g1 messager("Saving plot -->", files[[1]], v=verbose) ggplot2::ggsave(filename = files[[1]], @@ -80,12 +80,18 @@ bootstrap_plot <- function(gene_data, #### Plot 2: Plot with gene names #### g2 <- g1 + - geom_text(aes_string(label = "symLab"), - # fill=ggplot2::alpha("black",.5), - color=ggplot2::alpha("black",.75), - na.rm = TRUE, - hjust = 0, vjust = 0, size = 3 - ) + + geom_text_repel( + mapping = aes(label = symLab), + alpha = 0.75, + segment.alpha = 0.75, + max.overlaps = 15 + ) + + # geom_text(aes_string(label = "symLab"), + # # fill=ggplot2::alpha("black",.5), + # color=ggplot2::alpha("black",.75), + # na.rm = TRUE, + # hjust = 0, vjust = 0, size = 3 + # ) + scale_x_discrete(expand = expansion(mult = c(0,.15))) + scale_y_discrete(expand = expansion(mult = c(0,.15))) plots[["plot2"]] <- g2 From 61d993e2c1647f97ff1322c4240dbc9da052ce40 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 17:10:23 -0700 Subject: [PATCH 02/15] Changing abline, file widths --- R/bootstrap_plot.R | 47 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 23d4853..6e067ba 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -56,27 +56,31 @@ bootstrap_plot <- function(gene_data, } ## Plot several variants of the graph ## add_line <- function(){ - geom_abline(intercept = 0, slope = 1, - linetype = "dashed", - colour = ggplot2::alpha("red",.5)) + geom_abline( + intercept = 0, + slope = 1, + linetype = "dashed", + color = "red", + alpha = 0.5 + ) } #### Plot 1: Plot without gene names #### - g1 <- ggplot(gene_data, - aes_string(x = "boot", y = "hit", color="hit")) + - geom_point(size = 1, alpha=.75) + + g1 <- ggplot(gene_data, aes(x = boot, y = hit, color = hit)) + + geom_point(size = 1, alpha = .75) + xlab("Mean Bootstrap Expression") + ylab("Expression in cell type (%)\n") + scale_color_viridis_c() + - facet_grid(facets = facets, - scales = scales) + + facet_grid(facets = facets, scales = scales) + add_line() + theme_classic() plots[["plot1"]] <- g1 messager("Saving plot -->", files[[1]], v=verbose) - ggplot2::ggsave(filename = files[[1]], - plot = g1, - width = 3.5, - height = 3.5) + ggsave( + filename = files[[1]], + plot = g1, + width = 4, + height = 3.5 + ) #### Plot 2: Plot with gene names #### g2 <- g1 + @@ -84,22 +88,19 @@ bootstrap_plot <- function(gene_data, mapping = aes(label = symLab), alpha = 0.75, segment.alpha = 0.75, - max.overlaps = 15 + max.overlaps = 25, + force_pull = 0.5 ) + - # geom_text(aes_string(label = "symLab"), - # # fill=ggplot2::alpha("black",.5), - # color=ggplot2::alpha("black",.75), - # na.rm = TRUE, - # hjust = 0, vjust = 0, size = 3 - # ) + scale_x_discrete(expand = expansion(mult = c(0,.15))) + scale_y_discrete(expand = expansion(mult = c(0,.15))) plots[["plot2"]] <- g2 messager("Saving plot -->", files[[2]], v=verbose) - ggplot2::ggsave(filename = files[[2]], - plot = g2, - width = 3.5, - height = 3.5) + ggsave( + filename = files[[2]], + plot = g2, + width = 4, + height = 3.5 + ) #### Plot 3 #### From 2b38f542f97bd9f19abc0feedc6d6afa16ffe8eb Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 17:22:02 -0700 Subject: [PATCH 03/15] file widths --- R/bootstrap_plot.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 6e067ba..9b26b9f 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -141,11 +141,12 @@ bootstrap_plot <- function(gene_data, scale_x_discrete(breaks = NULL) + theme_graph() + facet_wrap(facets=facets) + wd <- 1 + length(unique(melt_boot[, hit])) * 0.25 plots[["plot3"]] <- g3 messager("Saving plot -->", files[[3]], v=verbose) ggplot2::ggsave(filename = files[[3]], plot = g3, - width = 3.5, + width = wd, height = 3.5) @@ -189,7 +190,7 @@ bootstrap_plot <- function(gene_data, labs(x=expression("Least specific" %->% "Most specific"), y="Expression in cell type (%)\n") #### Save #### - wd <- 1 + length(unique(melt_boot[,4])) * 0.175 + wd <- 1 + length(unique(melt_boot[,4])) * 0.25 plots[["plot4"]] <- g4 messager("Saving plot -->", files[[4]], v=verbose) ggplot2::ggsave(filename = files[[4]], From 67ca405ef3a47691d045b32e52939e9134e3ed89 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 17:52:52 -0700 Subject: [PATCH 04/15] file widths --- R/bootstrap_plot.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 9b26b9f..15e4202 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -91,8 +91,8 @@ bootstrap_plot <- function(gene_data, max.overlaps = 25, force_pull = 0.5 ) + - scale_x_discrete(expand = expansion(mult = c(0,.15))) + - scale_y_discrete(expand = expansion(mult = c(0,.15))) + # scale_x_discrete(expand = expansion(mult = c(0,.15))) + + # scale_y_discrete(expand = expansion(mult = c(0,.15))) plots[["plot2"]] <- g2 messager("Saving plot -->", files[[2]], v=verbose) ggsave( @@ -141,6 +141,7 @@ bootstrap_plot <- function(gene_data, scale_x_discrete(breaks = NULL) + theme_graph() + facet_wrap(facets=facets) + print(sprintf("Names of melt boot: %s", paste(names(melt_boot), collapse = " "))) wd <- 1 + length(unique(melt_boot[, hit])) * 0.25 plots[["plot3"]] <- g3 messager("Saving plot -->", files[[3]], v=verbose) From ee23df226acb4f8c4f0614ef2b39a39e7f14591b Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 18:01:31 -0700 Subject: [PATCH 05/15] issue with plot --- R/bootstrap_plot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 15e4202..e22fd7a 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -90,7 +90,7 @@ bootstrap_plot <- function(gene_data, segment.alpha = 0.75, max.overlaps = 25, force_pull = 0.5 - ) + + ) # + # scale_x_discrete(expand = expansion(mult = c(0,.15))) + # scale_y_discrete(expand = expansion(mult = c(0,.15))) plots[["plot2"]] <- g2 From b533c60017de7784181208a1ab16d9fdfc07564a Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 18:15:35 -0700 Subject: [PATCH 06/15] flip colors, say melt_boot names --- R/bootstrap_plot.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index e22fd7a..d9ca740 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -69,7 +69,7 @@ bootstrap_plot <- function(gene_data, geom_point(size = 1, alpha = .75) + xlab("Mean Bootstrap Expression") + ylab("Expression in cell type (%)\n") + - scale_color_viridis_c() + + scale_color_viridis_c(direction = -1) + facet_grid(facets = facets, scales = scales) + add_line() + theme_classic() @@ -141,7 +141,7 @@ bootstrap_plot <- function(gene_data, scale_x_discrete(breaks = NULL) + theme_graph() + facet_wrap(facets=facets) - print(sprintf("Names of melt boot: %s", paste(names(melt_boot), collapse = " "))) + cat("Names of melt boot:", paste(names(melt_boot), collapse = " ")) wd <- 1 + length(unique(melt_boot[, hit])) * 0.25 plots[["plot3"]] <- g3 messager("Saving plot -->", files[[3]], v=verbose) From 181e60481f6c09d8d379fc8cbe0e3acdd9cabb03 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Wed, 28 May 2025 18:28:46 -0700 Subject: [PATCH 07/15] unclear error melt_boot names --- R/bootstrap_plot.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index d9ca740..8372102 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -141,13 +141,13 @@ bootstrap_plot <- function(gene_data, scale_x_discrete(breaks = NULL) + theme_graph() + facet_wrap(facets=facets) - cat("Names of melt boot:", paste(names(melt_boot), collapse = " ")) - wd <- 1 + length(unique(melt_boot[, hit])) * 0.25 + # cat("Names of melt boot:", paste(names(melt_boot), collapse = " ")) + # wd <- 1 + length(unique(melt_boot[, hit])) * 0.25 plots[["plot3"]] <- g3 messager("Saving plot -->", files[[3]], v=verbose) ggplot2::ggsave(filename = files[[3]], plot = g3, - width = wd, + width = 8, height = 3.5) @@ -191,12 +191,12 @@ bootstrap_plot <- function(gene_data, labs(x=expression("Least specific" %->% "Most specific"), y="Expression in cell type (%)\n") #### Save #### - wd <- 1 + length(unique(melt_boot[,4])) * 0.25 + # wd <- 1 + length(unique(melt_boot[,4])) * 0.25 plots[["plot4"]] <- g4 messager("Saving plot -->", files[[4]], v=verbose) ggplot2::ggsave(filename = files[[4]], plot = g4, - width = wd, + width = 8, height = 4) } From 12052e959abbf349666a86193a675f300d7bd8b8 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:47:52 -0700 Subject: [PATCH 08/15] Checking #98 --- R/check_full_results.R | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/R/check_full_results.R b/R/check_full_results.R index af06975..cf61ff2 100755 --- a/R/check_full_results.R +++ b/R/check_full_results.R @@ -23,13 +23,9 @@ check_full_results <- function(full_results, " sct_data. Perhaps the wrong annotLevel was used?" ) if (sum(!as.character(unique(full_results$results$CellType)) %in% - colnames(sct_data[[1]]$specificity)) == + colnames(sct_data[[annotLevel]]$specificity)) == length(as.character(unique(full_results$results$CellType)))) { stop(err_msg2) } - if (sum(!as.character(unique(full_results$results$CellType)) %in% - colnames(sct_data[[1]]$specificity)) > 0) { - stop(err_msg2) - } } } From 45570cc9cfe77e738d186b9e7a869932654ff204 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:11:21 -0700 Subject: [PATCH 09/15] specify annot #98 --- R/check_full_results.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/check_full_results.R b/R/check_full_results.R index cf61ff2..580e8fb 100755 --- a/R/check_full_results.R +++ b/R/check_full_results.R @@ -8,7 +8,8 @@ #' #' @keywords internal check_full_results <- function(full_results, - sct_data) { + sct_data, + annotLevel = annotLevel) { if (!is.null(full_results)) { err_msg <- paste0( "ERROR: full_results must be a list of length 3 or 4", From b6b1b34c60087b4b2e016423e434f6f62833ae26 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Fri, 19 Sep 2025 14:38:58 -0700 Subject: [PATCH 10/15] specify annot #98 --- R/check_full_results.R | 2 +- R/generate_bootstrap_plots.r | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/R/check_full_results.R b/R/check_full_results.R index 580e8fb..15bbddc 100755 --- a/R/check_full_results.R +++ b/R/check_full_results.R @@ -9,7 +9,7 @@ #' @keywords internal check_full_results <- function(full_results, sct_data, - annotLevel = annotLevel) { + annotLevel) { if (!is.null(full_results)) { err_msg <- paste0( "ERROR: full_results must be a list of length 3 or 4", diff --git a/R/generate_bootstrap_plots.r b/R/generate_bootstrap_plots.r index 4cf3038..e97c8b1 100755 --- a/R/generate_bootstrap_plots.r +++ b/R/generate_bootstrap_plots.r @@ -153,7 +153,8 @@ generate_bootstrap_plots <- function(sct_data = NULL, ) check_full_results( full_results = full_results, - sct_data = sct_data + sct_data = sct_data, + annotLevel = annotLevel ) results <- full_results$results #### Check gene lists #### From bb1f6cbd22d9f94036f4745feec1a801cac255f4 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:42:03 -0700 Subject: [PATCH 11/15] split qqs to multiple pages --- R/bootstrap_plot.R | 164 +++++++++++++++++++++++++++++++++------------ 1 file changed, 121 insertions(+), 43 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 8372102..7a8d4bc 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -1,3 +1,110 @@ +#' Create a multi-page PDF with each cell type on a separate page +#' +#' This function creates a PDF where each unique value in a specified faceting +#' variable (typically "CellType") is plotted on a separate page. Each plot shows +#' expression data with points colored by expression levels. +#' +#' @param gene_data A data frame containing gene expression data with columns for +#' "boot", "hit", and a faceting variable (typically "CellType"). +#' @param facet_var Character string specifying the column name to use for +#' separating plots onto different pages (e.g., "CellType"). +#' @param output_file Character string specifying the path to save the PDF file. +#' @param add_labels Character string specifying the column name to use for point labels, +#' or NULL to disable labels (default: NULL). +#' @param verbose Logical indicating whether to print progress messages (default: TRUE). +#' +#' @return No return value, called for side effect of creating a PDF file. +#' +#' @details The function creates QQ plots of "boot" vs "hit" values, with points +#' colored by "hit" values using a reversed viridis color scale. Each plot includes +#' a title showing the cell type being displayed. If add_labels is provided, text labels +#' from the specified column will be added to the points using ggrepel. +#' +#' @examples +#' \dontrun{ +#' # Create plots without labels +#' .create_multipage_plot( +#' gene_data = my_gene_data, +#' facet_var = "CellType", +#' output_file = "cell_type_plots.pdf" +#' ) +#' +#' # Create plots with gene symbol labels +#' .create_multipage_plot( +#' gene_data = my_gene_data, +#' facet_var = "CellType", +#' output_file = "cell_type_plots_labeled.pdf", +#' add_labels = "gene_symbol" +#' ) +#' } +#' +#' @import ggplot2 +#' @importFrom viridis scale_color_viridis_c +#' @importFrom ggrepel geom_text_repel +#' +#' @keywords internal +.create_multipage_plot <- function(gene_data, facet_var, output_file, + add_labels = NULL, verbose = TRUE) { + # Check for required packages + if(!is.null(add_labels) && !requireNamespace("ggrepel", quietly = TRUE)) { + stop("Package 'ggrepel' is needed for adding labels. Please install it.", + call. = FALSE) + } + + if (verbose) messager("Saving plot -->", output_file) + # Check if the specified label column exists + if(!is.null(add_labels) && !(add_labels %in% colnames(gene_data))) { + stop(paste0("Label column '", add_labels, "' not found in data."), + call. = FALSE) + } + + # Get unique cell types + cell_types <- unique(gene_data[[facet_var]]) + + # Start PDF device + pdf(output_file, width = 7, height = 7) + + # Create and print a plot for each cell type + for (cell_type in cell_types) { + # Subset data for this cell type + subset_data <- gene_data[gene_data[[facet_var]] == cell_type, ] + + # Create base plot for this cell type + g <- ggplot(subset_data, aes(x = boot, y = hit, color = hit)) + + geom_point(size = 1, alpha = .75) + + xlab("Mean Bootstrap Expression") + + ylab("Expression in cell type (%)\n") + + scale_color_viridis_c(direction = -1) + + ggtitle(paste("Cell Type:", cell_type)) + + add_line() + + theme_classic() + + # Add labels if a column name was provided + if(!is.null(add_labels)) { + g <- g + ggrepel::geom_text_repel( + aes(label = .data[[add_labels]]), # Use the column name dynamically + size = 3, + box.padding = 0.35, + point.padding = 0.5, + segment.color = "grey50", + max.overlaps = 25 + ) + + if (verbose) messager("Added labels from column:", add_labels) + } + + # Print the plot (adds it to the PDF) + print(g) + + if (verbose) messager("Added plot for", cell_type) + } + + # Close the PDF device + dev.off() + +} + + #' Bootstrap plot #' #' Plot bootstrap enrichment results. @@ -55,53 +162,22 @@ bootstrap_plot <- function(gene_data, dir.create(dirname(f), showWarnings = FALSE, recursive = TRUE) } ## Plot several variants of the graph ## - add_line <- function(){ - geom_abline( - intercept = 0, - slope = 1, - linetype = "dashed", - color = "red", - alpha = 0.5 - ) - } #### Plot 1: Plot without gene names #### - g1 <- ggplot(gene_data, aes(x = boot, y = hit, color = hit)) + - geom_point(size = 1, alpha = .75) + - xlab("Mean Bootstrap Expression") + - ylab("Expression in cell type (%)\n") + - scale_color_viridis_c(direction = -1) + - facet_grid(facets = facets, scales = scales) + - add_line() + - theme_classic() - plots[["plot1"]] <- g1 - messager("Saving plot -->", files[[1]], v=verbose) - ggsave( - filename = files[[1]], - plot = g1, - width = 4, - height = 3.5 + .create_multipage_plot( + gene_data = gene_data, + facet_var = "CellType", # Column name containing cell types + output_file = files[[1]], + verbose = verbose ) #### Plot 2: Plot with gene names #### - g2 <- g1 + - geom_text_repel( - mapping = aes(label = symLab), - alpha = 0.75, - segment.alpha = 0.75, - max.overlaps = 25, - force_pull = 0.5 - ) # + - # scale_x_discrete(expand = expansion(mult = c(0,.15))) + - # scale_y_discrete(expand = expansion(mult = c(0,.15))) - plots[["plot2"]] <- g2 - messager("Saving plot -->", files[[2]], v=verbose) - ggsave( - filename = files[[2]], - plot = g2, - width = 4, - height = 3.5 - ) - + .create_multipage_plot( + gene_data = gene_data, + facet_var = "CellType", # Column name containing cell types + output_file = files[[2]], + add_labels = "symLab", + verbose = verbose + ) #### Plot 3 #### if(is.null(exp_mats)){ @@ -204,3 +280,5 @@ bootstrap_plot <- function(gene_data, return(list(plots=plots, paths=files)) } + + From a0a996a622ee2f8f5d5ef0649c8466e20813857a Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Thu, 2 Oct 2025 20:07:18 -0700 Subject: [PATCH 12/15] fixing abline --- R/bootstrap_plot.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 7a8d4bc..3508143 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -76,7 +76,12 @@ ylab("Expression in cell type (%)\n") + scale_color_viridis_c(direction = -1) + ggtitle(paste("Cell Type:", cell_type)) + - add_line() + + geom_abline( + intercept = 0, + slope = 1, + linetype = "dashed", + colour = ggplot2::alpha("red",.5) + ) + theme_classic() # Add labels if a column name was provided From 6eb304d4898d9e4a55a456b49369409040fc7cce Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Thu, 2 Oct 2025 20:35:00 -0700 Subject: [PATCH 13/15] improve labeling --- R/bootstrap_plot.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index 3508143..c8c84ad 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -62,7 +62,7 @@ cell_types <- unique(gene_data[[facet_var]]) # Start PDF device - pdf(output_file, width = 7, height = 7) + pdf(output_file, width = 5, height = 5) # Create and print a plot for each cell type for (cell_type in cell_types) { @@ -149,7 +149,7 @@ bootstrap_plot <- function(gene_data, plots <- list() #### Set up save path #### dir.create(save_dir, showWarnings = FALSE, recursive = TRUE) - gene_data$symLab <- ifelse(gene_data$hit > 25, gene_data$gene, "") + gene_data$symLab <- ifelse(gene_data$hit - gene_data$boot > 1, gene_data$gene, "") #### Filter gene_data #### if(!is.null(signif_ct)){ From b1a303c218dcd5326f15fc6d8ac98e35ab9e0e89 Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Thu, 2 Oct 2025 21:06:19 -0700 Subject: [PATCH 14/15] more dots --- R/bootstrap_plot.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index c8c84ad..b513df1 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -89,6 +89,7 @@ g <- g + ggrepel::geom_text_repel( aes(label = .data[[add_labels]]), # Use the column name dynamically size = 3, + force_pull = 0.1, box.padding = 0.35, point.padding = 0.5, segment.color = "grey50", From e611462edac3f86d651c7cdaa0818511c8b658fe Mon Sep 17 00:00:00 2001 From: rrbutler <6644896+rbutleriii@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:03:35 -0700 Subject: [PATCH 15/15] include top hits labels always --- R/bootstrap_plot.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/bootstrap_plot.R b/R/bootstrap_plot.R index b513df1..68d3c36 100755 --- a/R/bootstrap_plot.R +++ b/R/bootstrap_plot.R @@ -150,7 +150,11 @@ bootstrap_plot <- function(gene_data, plots <- list() #### Set up save path #### dir.create(save_dir, showWarnings = FALSE, recursive = TRUE) - gene_data$symLab <- ifelse(gene_data$hit - gene_data$boot > 1, gene_data$gene, "") + gene_data$symLab <- ifelse( + test = gene_data$hit - gene_data$boot > 1 | gene_data$hit > 75, + yes = gene_data$gene, + no = "" + ) #### Filter gene_data #### if(!is.null(signif_ct)){