PomaBoxplots: Boxplots and Violin Plots

View source: R/PomaBoxplots.R

PomaBoxplotsR Documentation

Boxplots and Violin Plots

Description

PomaBoxplots generates boxplots and violin plots for samples and features. This function can be used for data exploration (e.g., comparison between pre and post normalized datasets).

Usage

PomaBoxplots(
  data,
  x = "samples",
  violin = FALSE,
  outcome = NULL,
  feature_name = NULL,
  theme_params = list(legend_title = FALSE, axis_x_rotate = TRUE)
)

Arguments

data

A SummarizedExperiment object.

x

Character. Options are "samples" (to visualize sample boxplots) and "features" (to visualize feature boxplots). Default is "samples".

violin

Logical. Indicates if violin plots should be displayed instead of boxplots. Default is FALSE.

outcome

Character. Indicates the name of the colData column to be used as the outcome factor. Default is NULL (first factor variable in colData).

feature_name

Character vector. Indicates the feature/s to display. Default is NULL (all features will be displayed).

theme_params

List. Indicates theme_poma parameters.

Value

A ggplot object.

Author(s)

Pol Castellano-Escuder

Examples

data <- POMA::st000284 %>% # Example SummarizedExperiment object included in POMA
  PomaNorm() 

# Sample boxplots
data %>%
  PomaBoxplots(x = "samples",
               violin = FALSE,
               outcome = NULL,
               feature_name = NULL,
               theme_params = list(axistext = "y")) # If too many samples

# Sample boxplots with covariate as outcome
data %>%
  PomaBoxplots(x = "samples",
               violin = FALSE,
               outcome = "gender", # change outcome
               feature_name = NULL,
               theme_params = list(axistext = "y")) # If too many samples

# Sample violin plots
data %>%
  PomaBoxplots(x = "samples",
               violin = TRUE,
               outcome = NULL,
               feature_name = NULL,
               theme_params = list(axistext = "y")) # If too many samples


# All feature boxplots
data %>% 
  PomaBoxplots(x = "features", 
               theme_params = list(axis_x_rotate = TRUE))

# Specific feature boxplots
data %>% 
  PomaBoxplots(x = "features", 
               feature_name = c("ornithine", "orotate"))

# Specific feature violin plots
data %>% 
  PomaBoxplots(x = "features", 
               violin = TRUE,
               feature_name = c("ornithine", "orotate"))

pcastellanoescuder/POMA_package documentation built on Nov. 28, 2024, 1:23 p.m.