Plot of total cell or nuclei number per sample grouped by another meta data variable.

CellBender_Diff_Plot(
  feature_diff_df,
  pct_diff_threshold = 25,
  num_features = NULL,
  label = TRUE,
  num_labels = 20,
  min_count_label = 1,
  repel = TRUE,
  custom_labels = NULL,
  plot_line = TRUE,
  plot_title = "Raw Counts vs. Cell Bender Counts",
  x_axis_label = "Raw Data Counts",
  y_axis_label = "Cell Bender Counts",
  xnudge = 0,
  ynudge = 0,
  max.overlaps = 100,
  label_color = "dodgerblue",
  fontface = "bold",
  label_size = 3.88,
  bg.color = "white",
  bg.r = 0.15,
  ...
)

Arguments

feature_diff_df

name of data.frame created using CellBender_Feature_Diff.

pct_diff_threshold

threshold to use for feature plotting. Resulting plot will only contain features which exhibit percent change >= value. Default is 25.

num_features

Number of features to plot. Will ignore pct_diff_threshold and return plot with specified number of features. Default is NULL.

label

logical, whether or not to label the features that have largest percent difference between raw and CellBender counts (Default is TRUE).

num_labels

Number of features to label if label = TRUE, (default is 20).

min_count_label

Minimum number of raw counts per feature necessary to be included in plot labels (default is 1)

repel

logical, whether to use geom_text_repel to create a nicely-repelled labels; this is slow when a lot of points are being plotted. If using repel, set xnudge and ynudge to 0, (Default is TRUE).

custom_labels

A custom set of features to label instead of the features most different between raw and CellBender counts.

plot_line

logical, whether to plot diagonal line with slope = 1 (Default is TRUE).

plot_title

Plot title.

x_axis_label

Label for x axis.

y_axis_label

Label for y axis.

xnudge

Amount to nudge X and Y coordinates of labels by.

ynudge

Amount to nudge X and Y coordinates of labels by.

max.overlaps

passed to geom_text_repel, exclude text labels that overlap too many things. Defaults to 100.

label_color

Color to use for text labels.

fontface

font face to use for text labels (“plain”, “bold”, “italic”, “bold.italic”) (Default is "bold").

label_size

text size for feature labels (passed to geom_text_repel).

bg.color

color to use for shadow/outline of text labels (passed to geom_text_repel) (Default is white).

bg.r

radius to use for shadow/outline of text labels (passed to geom_text_repel) (Default is 0.15).

...

Extra parameters passed to geom_text_repel through LabelPoints.

Value

A ggplot object

Examples

if (FALSE) {
# get cell bender differences data.frame
cb_stats <- CellBender_Feature_Diff(seurat_object - obj, raw_assay = "RAW",
cell_bender_assay = "RNA")

# plot
CellBender_Diff_Plot(feature_diff_df = cb_stats, pct_diff_threshold = 25)
}