Skip to contents

Generates a two-panel QC scatter plot for any pair of metadata variables. The top panel shows all samples overlaid with marginal density curves (via ggExtra::ggMarginal()). The bottom panel facets by the grouping variable. Axes can optionally be log10-scaled. This function assumes you have extracted the metadata from your Seurat object and saved as a dataframe.

Usage

qcScatter(
  metadata,
  Xvar,
  Yvar,
  groupVar = "orig.ident",
  logTransformX = FALSE,
  logTransformY = FALSE,
  colors = NULL,
  outDir = NULL,
  width,
  height
)

Arguments

metadata

A data frame of per-cell or per-sample QC metrics.

Xvar

Character string. Column name in metadata for the x-axis.

Yvar

Character string. Column name in metadata for the y-axis.

groupVar

Character string. Column name in metadata used for color and faceting (default "orig.ident").

logTransformX

Logical. Apply ggplot2::scale_x_log10() (default FALSE).

logTransformY

Logical. Apply ggplot2::scale_y_log10() (default FALSE).

colors

Optional named or positional color vector for groups (default NULL, in which case, 8 default colors are used.)

outDir

Optional directory path for saving the plot. If NULL (default), the plot is not saved.

width

Numeric. Plot width in inches (default 12).

height

Numeric. Plot height in inches (default 10).

Value

A combined cowplot::plot_grid() object (returned invisibly when saved to disk).

Examples

if (FALSE) { # \dontrun{
qcScatter(metadata,
  Xvar = "log_atac_peak_region_fragments",
  Yvar = "pct_reads_in_peaks",
  groupVar = "orig.ident",
  colors = my_colors
)
} # }