Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

ALRAChooseKPlot() produces three diagnostic plots used to select the rank k for ALRA imputation. It requires RunALRA() to have been called first with k.only = TRUE to compute the singular value decomposition and store it in the object’s tool slot.

Syntax

ALRAChooseKPlot(
  object,
  start = 0,
  combine = TRUE
)

Parameters

object
Seurat
required
A Seurat object on which RunALRA(object, k.only = TRUE) has been run. The function reads singular values, spacings, and p-values from Tool(object, slot = 'RunALRA').
start
numeric
default:"0"
Starting index for the singular value spacing and p-value plots. Defaults to floor(k / 2) where k is the automatically selected rank. Use a smaller value to see more of the spectrum.
combine
logical
default:"TRUE"
If TRUE, combines all three plots into a single figure using CombinePlots(). If FALSE, returns a named list of three separate ggplot objects: spectrum, spacings, and pvals.

Returns

When combine = TRUE (default): a combined ggplot object showing all three panels side by side. When combine = FALSE: a named list with three ggplot objects:
  • spectrum — singular values s_i vs index, with a vertical line at the selected k
  • spacings — consecutive differences s_i - s_, with a vertical line at k+1
  • pvals — p-values for each spacing, with a vertical line at k+1

Examples

library(SeuratWrappers)

# Step 1: Compute k only (no imputation yet)
pbmc_alra <- RunALRA(pbmc_small, k.only = TRUE)

# Step 2: Visualize the singular value spectrum
ggouts <- ALRAChooseKPlot(pbmc_alra)
# Combined plot — all three panels
ggouts

# Or access individual panels
ggouts_list <- ALRAChooseKPlot(pbmc_alra, combine = FALSE)
ggouts_list$spectrum
ggouts_list$pvals

# Or use gridExtra for layout control
do.call(gridExtra::grid.arrange, c(ALRAChooseKPlot(pbmc_alra, combine = FALSE), nrow = 1))

# Step 3: Once satisfied with k, run full ALRA imputation
pbmc_alra <- RunALRA(pbmc_alra)

See Also

Build docs developers (and LLMs) love