Skip to content

Commit

Permalink
Specify geom in plotGenes
Browse files Browse the repository at this point in the history
  • Loading branch information
noriakis committed Apr 21, 2024
1 parent af8dbc8 commit 3fcf87a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 7 additions & 3 deletions R/plotGenes.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
#'
#' 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
#' @param geneID gene ID to be plotted
#' @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]]
Expand All @@ -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)+
Expand Down
11 changes: 9 additions & 2 deletions man/plotGenes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fcf87a

Please sign in to comment.