plot_exprs: Plot exprs for coef

View source: R/4_plot.R

plot_exprsR Documentation

Plot exprs for coef

Description

Plot exprs for coef

Usage

plot_exprs(
  object,
  dim = "both",
  assay = assayNames(object)[1],
  fit = fits(object)[1],
  coefs = default_coefs(object, fit = fit),
  block = NULL,
  x = default_x(object, dim),
  geom = default_geom(object, x = x, block = block),
  color = x,
  fill = x,
  shape = NULL,
  size = NULL,
  alpha = NULL,
  linetype = NULL,
  highlight = NULL,
  combiner = "|",
  p = 1,
  fdr = 1,
  facet = if (dim == "both") "feature_id" else NULL,
  n = 4,
  ncol = NULL,
  nrow = NULL,
  scales = "free_y",
  labeller = "label_value",
  pointsize = if (is.null(block)) 0 else 0.5,
  jitter = if (is.null(block)) 0.1 else 0,
  fillpalette = make_var_palette(object, fill),
  colorpalette = make_var_palette(object, color),
  hlevels = NULL,
  title = switch(dim, both = x, features = "Feature Boxplots", samples =
    "Sample Boxplots"),
  subtitle = if (!is.null(fit)) coefs else "",
  xlab = NULL,
  ylab = "value",
  theme = ggplot2::theme(plot.title = element_text(hjust = 0.5)),
  file = NULL,
  width = 7,
  height = 7,
  verbose = TRUE
)

plot_sample_boxplots(
  object,
  fill = if ("subgroup" %in% svars(object)) "subgroup" else "sample_id",
  n = min(ncol(object), 16),
  ...
)

plot_feature_boxplots(object, ...)

Arguments

object

SummarizedExperiment

dim

'samples' (per-sample distribution across features),
'features' (per-feature distribution across samples ) or 'both' (subgroup distribution faceted per feature)

assay

string: value in assayNames(object)

fit

'limma', 'lm', 'lme', 'lmer', 'wilcoxon'

coefs

subset of coefs(object) to consider in selecting top

block

group svar

x

x svar

geom

'boxplot' or 'point'

color

color svar: points, lines

fill

fill svar: boxplots

shape

shape svar

size

size svar

alpha

alpha svar

linetype

linetype svar

highlight

highlight svar

combiner

'&' or '|'

p

fraction: p cutoff

fdr

fraction: fdr cutoff

facet

string: fvar mapped to facet

n

number of samples (dim = 'samples') or features (dim = 'features' or 'both') to plot

ncol

number of cols in faceted plot (if dim = 'both')

nrow

number of rows in faceted plot (if dim = 'both)

scales

'free_y', 'free'x', 'fixed'

labeller

string or function

pointsize

number

jitter

jitter width (number)

fillpalette

named character vector: fill palette

colorpalette

named character vector: color palette

hlevels

xlevels for which to plot hlines

title

string

subtitle

string

xlab

string

ylab

string

theme

ggplot2::theme(...) or NULL

file

NULL or filepath

width

inches

height

inches

verbose

TRUE or FALSE

...

used to maintain depreceated functions

Value

ggplot object

See Also

plot_sample_densities, plot_sample_violins

Examples

# Without limma
    file <- system.file('extdata/atkin.metabolon.xlsx', package = 'autonomics')
    object <- read_metabolon(file)
    plot_exprs(object, block = 'Subject', title = 'Subgroup Boxplots')
    plot_exprs(object, dim = 'samples')
    plot_exprs(object, dim = 'features', block = 'sample_id')
# With limma 
    object %<>% fit_limma(block = 'Subject')
    plot_exprs(object, block = 'Subject')
    plot_exprs(object, block = 'Subject', coefs = c('t1-t0', 't2-t0', 't3-t0'))
    plot_exprs_per_coef(object, x = 'Time', block = 'Subject')
# Points
    plot_exprs(object, geom = 'point', block = 'Subject')
# Add highlights
    controlfeatures <- c('biotin','phosphate')
    fdt(object) %<>% cbind(control = .$feature_name %in% controlfeatures)
    plot_exprs(object, dim = 'samples', highlight = 'control')
# Multiple pages
    plot_exprs(object, block = 'Subject', n = 4, nrow = 1, ncol = 2)

bhagwataditya/autonomics documentation built on Nov. 1, 2024, 5:47 a.m.