Skip to contents

plot_expression() is a ggplot2 implementation for visualizing protein abundance distributions across two sample conditions for top differentially expressed proteins. The resulting plot is faceted by protein/annotation label, with the two samples on the x-axis, log2 abundance on the y-axis, a boxplot representing the distribution, and individual replicate points overlaid (filled circle for non-imputed, hollow circle for imputed).

Usage

plot_expression(
  data = NULL,
  ...,
  tag = NULL,
  log2fc_min = 1,
  log2fc_column = "log2_foldchange",
  significance_max = 0.05,
  significance_column = "adj_p_value",
  top_n = 10,
  regulation = c("both", "up", "down"),
  labels_column = "protein",
  candidates = NULL,
  proteins = NULL,
  imputed_only = FALSE,
  show_title = TRUE,
  destination = "plot",
  height = 6,
  width = 8,
  path = NULL,
  file_name = NULL
)

Arguments

data

a tidyproteomics data object

...

two sample comparison expression (e.g. knockdown/control)

tag

a character string to append to the plot file name

log2fc_min

a numeric defining the minimum log2 foldchange threshold. Default is 1.

log2fc_column

a character defining the column name of log2 foldchange values.

significance_max

a numeric defining the maximum significance threshold. Default is 0.05.

significance_column

a character defining the column name of significance values.

top_n

an integer defining the top N proteins to plot post-filtering. Default is 10.

regulation

a character defining direction: "both" (default), "up", or "down".

labels_column

a character defining the annotation column for facet titles (default is "protein").

candidates

optional character vector of protein identifiers or gene names to plot.

proteins

alias for candidates for backward compatibility.

imputed_only

logical; if TRUE, restricts automatic selection to features with imputed values (imputed > 0). Default is FALSE.

show_title

input FALSE, TRUE for an auto-generated title or any character string.

destination

a character string ("plot", "save", "png", "svg", "tiff", "jpeg").

height

a numeric plot height in inches. Default is 6.

width

a numeric plot width in inches. Default is 8.

path

optional path to save destination plot.

file_name

optional base file name override for saved output.

Value

a ggplot2 object or tidyproteomics data object depending on destination

Examples

library(dplyr, warn.conflicts = FALSE)
library(tidyproteomics)

# subset for fast execution
hela_proteins <- hela_proteins %>% subset(description %like% "Ribosome")
#> 
#> ℹ Subsetting data: description %like% Ribosome
#> ✔ Subsetting data: description %like% Ribosome ... done
#> 

hela_proteins %>%
  expression(knockdown/control) %>%
  plot_expression(knockdown/control, log2fc_min = 0.5, significance_column = "p_value", top_n = 6)
#> ℹ .. expression::t_test testing knockdown / control
#> ✔ .. expression::t_test testing knockdown / control [64ms]
#>