plotExprsFreqVsMean: Plot expression frequency against mean counts

View source: R/func_sc.R

plotExprsFreqVsMeanR Documentation

Plot expression frequency against mean counts

Description

This function uses plotRowData() from the scater package to produce a scatter plot of expression frequency against mean counts by using per-feature quality control metrics produced by scuttle.

Usage

plotExprsFreqVsMean(
  sce,
  point_size = 2,
  point_alpha = 0.8,
  anno_size = 6,
  text_size = 4,
  text_color = "black",
  trend_color = "firebrick",
  trend_size = 1,
  trend_se = TRUE,
  box.padding = 0.5,
  max.overlaps = Inf,
  seed = 12321,
  xlab = "log2 Mean expression",
  ylab = "Percentage of expressing cells",
  title = NULL,
  theme_size = 18,
  ...
)

Arguments

sce

A SingleCellExperiment object containing the required QC metrics for features ('mean' and 'detected') that were returned by addPerCellQC() or perFeatureQCMetrics() in its rowData slot.

point_size

A numeric scalar indicating the size of the points. Default is 2.

point_alpha

A numeric scalar (between 0 and 1) indicating the transparency. Default is 0.8.

anno_size

A numeric scalar indicating the size of annotation text. Default is 6.

text_size

A numeric scalar indicating the size of the label. This is passed to geom_text_repel(). Default is 4.

text_color

A string indicating the colour of the label. This is passed to geom_text_repel(). Default is "black".

trend_color

A string indicating the colour of the smoothed curve. Default is "firebrick",

trend_size

A numeric scalar indicating the size of the smoothed curve. Default is 1.

trend_se

Logical scalar indicating whether to display confidence interval around smooth. Default is TRUE.

box.padding

A scalar indicating the amount of padding around bounding box, as unit or number. This is passed to geom_text_repel(). Default is 0.5.

max.overlaps

Exclude text labels that overlap too many things. This is passed to geom_text_repel(). Default is Inf.

seed

Random seed passed to set.seed(). This is passed to geom_text_repel(). Default is 12321.

xlab

The title of the x-axis. Default is "log2 Mean expression".

ylab

The title of the y-axis. Default is "Percentage of expressing cells".

title

Plot title. Default is NULL.

theme_size

A numeric scalar indicating the base font size. Default is 18.

...

Other arguments passed on to geom_text_repel().

Details

The original function of the same name can be found in the legacy scater package and is now deprecated.

Value

A ggplot object

Author(s)

I-Hsuan Lin

See Also

scater::plotRowData(), scuttle::addPerFeatureQCMetrics(), scuttle::perFeatureQCMetrics(), ggrepel::geom_text_repel()

Examples

library(SingleCellExperiment)

# Load demo dataset
data(sce)

plotExprsFreqVsMean(sce, title = "Expression frequency vs. mean expression level")

ycl6/scRUtils documentation built on Feb. 18, 2025, 6:14 a.m.