From 3fcf87a17521d1343a6eb04e2ee65609401ed9a7 Mon Sep 17 00:00:00 2001 From: noriakis <31095487+noriakis@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:02:16 +0900 Subject: [PATCH] Specify geom in plotGenes --- R/plotGenes.R | 10 +++++++--- man/plotGenes.Rd | 11 +++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/R/plotGenes.R b/R/plotGenes.R index 44e7392..00259d0 100644 --- a/R/plotGenes.R +++ b/R/plotGenes.R @@ -1,7 +1,9 @@ #' #' plotGenes #' -#' plot the violin plot for specific genes +#' @description Plot the plot for specific genes +#' @details Plot the gene copy number between groups based on the specified geom. +#' The default is to use gene copy number, but gene family abundance can also be specified. #' #' @param stana stana object #' @param species candidate species @@ -9,11 +11,13 @@ #' @param cl named list of clusters #' @param target genes or KOs (gene families) #' @param return_df return data only +#' @param geom default to geom_violin, can be changed to the geom like `geom_boxplot` #' @import ggplot2 #' @export #' @return ggplot #' -plotGenes <- function(stana, species, geneID, target="genes", cl=NULL, return_df=FALSE) { +plotGenes <- function(stana, species, geneID, target="genes", cl=NULL, return_df=FALSE, + geom=geom_violin()) { if (is.null(cl)) { cl <- stana@cl} if (target=="genes") { geneDf <- stana@genes[[species]] @@ -35,7 +39,7 @@ plotGenes <- function(stana, species, geneID, target="genes", cl=NULL, return_df ggplot(df, aes(x=group, y=value, fill=group)) + - geom_violin()+ + geom+ geom_jitter(shape=21, size=2)+ scale_fill_manual(values=stana@colors)+ facet_wrap(.~geneID)+ diff --git a/man/plotGenes.Rd b/man/plotGenes.Rd index 6bd4266..2dc244b 100644 --- a/man/plotGenes.Rd +++ b/man/plotGenes.Rd @@ -10,7 +10,8 @@ plotGenes( geneID, target = "genes", cl = NULL, - return_df = FALSE + return_df = FALSE, + geom = geom_violin ) } \arguments{ @@ -25,10 +26,16 @@ plotGenes( \item{cl}{named list of clusters} \item{return_df}{return data only} + +\item{geom}{default to geom_violin, can be changed to the geom like `geom_boxplot`} } \value{ ggplot } \description{ -plot the violin plot for specific genes +Plot the plot for specific genes +} +\details{ +Plot the gene copy number between groups based on the specified geom. +The default is to use gene copy number, but gene family abundance can also be specified. }