plotqcDoubletClusters: Create QC plots from 'findDoubletClusters' output

View source: R/func_sc.R

plotqcDoubletClustersR Documentation

Create QC plots from findDoubletClusters output

Description

This function produces QC plots to aid deciding potential doublet clusters after running findDoubletClusters() from the scDblFinder package.

Usage

plotqcDoubletClusters(
  dbl,
  clusters = NULL,
  cluster_color = NULL,
  qc_plot = 0,
  point_size = 2,
  text_size = 6,
  box.padding = 0.5,
  point.padding = 0.5,
  max.overlaps = Inf,
  seed = 12321,
  theme_size = 18
)

Arguments

dbl

A DataFrame returned by findDoubletClusters() that identifies potential clusters of doublet cells.

clusters

A vector of length equal to number of rows in dbl, indicating the cluster levels. Default is NULL and use the row names in dbl.

cluster_color

A character vector of color codes indicating the colour of the clusters. Default is NULL, and use choosePalette() to select a palette.

qc_plot

A numeric scalar indicating which QC plot to create. Default is 0 to produce a compound figure, or:

  • 1: A scatter plot of median number of significant genes (median.de) against number of significant genes (num.de).

  • 2: A barplot showing the proportion of cells in each of the query cluster (prop).

  • 3: A scatter plot of ratio of the median library sizes for the second source cluster (lib.size2) against first source cluster (lib.size1).

point_size

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

text_size

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

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.

point.padding

A scalar indicating the amount of padding around labeled point, 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.

theme_size

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

Value

A ggplot object when qc_plot is not 0, or a ggplot2 plot with an object of class c("gg", "ggplot") when qc_plot = 0

Author(s)

I-Hsuan Lin

See Also

scDblFinder::findDoubletClusters()

Examples

library(SingleCellExperiment)

data(dbl_results)

# Create compound figure
plotqcDoubletClusters(dbl_results)

# Create median.de against num.de
plotqcDoubletClusters(dbl_results, qc_plot = 1)

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