Skip to contents

Applies the diffusion operator to impute and denoise data.

Usage

magic_impute(
  data,
  diff_op,
  t = 3,
  t_max = 20,
  threshold = 0.001,
  solver = c("exact", "approximate"),
  verbose = FALSE
)

Arguments

data

Matrix (cells x genes) to impute.

diff_op

Diffusion operator (Markov matrix).

t

Integer or "auto". Number of diffusion steps.

t_max

Integer. Maximum t for automatic selection. Default is 20.

threshold

Numeric. Convergence threshold for automatic t. Default is 0.001.

solver

Character. "exact" or "approximate". Default is "exact".

verbose

Logical or integer. Verbosity level.

Value

A matrix of imputed values.

Details

MAGIC imputation applies the diffusion operator repeatedly: $$X_{imputed} = P^t \times X$$

When t = "auto", the algorithm stops when the Procrustes disparity between consecutive iterations falls below the threshold.