Skip to contents

Estimates doublet rate (if not provided), finds optimal pK, and removes heterotypic doublets from a Seurat object.

Usage

doublet_removal(
  seurat_obj = sc_matrix,
  out_path,
  pN = 0.25,
  PCs = 1:20,
  nPCs_for_pK = 1:10,
  doublet_rate = NULL,
  sct = FALSE,
  slim = TRUE,
  verbose = TRUE
)

Arguments

seurat_obj

Seurat object (after normalization & PCA).

out_path

Character. Directory to save UMAP plots. Default: "."

pN

Numeric. Proportion of artificial doublets. Default: 0.25.

PCs

Integer vector. PCs to use. Default: 1:20.

nPCs_for_pK

Integer vector. PCs to use for pK estimation. Default: 1:10.

doublet_rate

Numeric. Expected doublet rate (0-1). If NULL, looked up via doublet_rate_dictionary.

sct

Logical. Whether data is SCTransformed. Default: FALSE.

slim

Logical. Whether to slim the Seurat object to only leave RNA count. Default: TRUE.

verbose

Logical. Whether to print leo.log messages. Default: TRUE.

Value

Seurat object with doublets removed.

Note

  • PCs: a vector of statistically significant PCs to use

  • pN: the number of artificially generated doublets (default = 0.25); robust, normally do not need fine-tune

  • pK: PC neighborhood size used to compute network; need fine-tune

  • nExp: threshold used to make doublet/singlet call; based on empirical ratios