Skip to content

Commit

Permalink
Merge pull request #72 from nbpeterson3/main
Browse files Browse the repository at this point in the history
Added parameter to adjust the size of gene tags
  • Loading branch information
enblacar authored Jul 24, 2024
2 parents 50551ee + 5e2804c commit fea9b84
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions R/do_VolcanoPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param add_gene_tags \strong{\code{\link[base]{logical}}} | Whether to plot the top genes.
#' @param add_tag_side \strong{\code{\link[base]{logical}}} | Either "both", "positive" or "negative" to indicate which side of genes to tag
#' @param order_tags_by \strong{\code{\link[base]{character}}} | Either "both", "pvalue" or "logfc".
#' @param tag_size \strong{\code{\link[base]{numeric}}} | Size of the text/label for the tags.
#' @param n_genes \strong{\code{\link[base]{numeric}}} | Number of top genes to plot.
#' @param use_labels \strong{\code{\link[base]{logical}}} | Whether to use labels instead of text for the tags.
#' @param colors.use \strong{\code{\link[base]{character}}} | Color to generate a tetradic color scale with.
Expand All @@ -36,6 +37,7 @@ do_VolcanoPlot <- function(sample,
add_gene_tags = TRUE,
add_tag_side = "both",
order_tags_by = "both",
tag_size = 6,
n_genes = 5,
use_labels = FALSE,
colors.use = "steelblue",
Expand Down Expand Up @@ -65,7 +67,8 @@ do_VolcanoPlot <- function(sample,
"border.size" = border.size,
"font.size" = font.size,
"line_size" = line_size,
"n_genes" = n_genes)
"n_genes" = n_genes,
"tag_size" = tag_size)
check_type(parameters = numeric_list, required_type = "numeric", test_function = is.numeric)
# Check character parameters.
character_list <- list("border.color" = border.color,
Expand Down Expand Up @@ -222,14 +225,16 @@ do_VolcanoPlot <- function(sample,
mapping = ggplot2::aes(label = .data$gene),
max.overlaps = 1000,
color = "black",
fontface = "bold")
fontface = "bold",
size = tag_size)
} else if (isTRUE(use_labels)){
p <- p +
ggrepel::geom_label_repel(data = data.label,
mapping = ggplot2::aes(label = .data$gene),
max.overlaps = 1000,
color = "black",
fontface = "bold")
fontface = "bold",
size = tag_size)
}

}
Expand Down

0 comments on commit fea9b84

Please sign in to comment.