Skip to contents

Applies stored MAGIC diffusion weights to smooth a feature-by-cell matrix. The result is a dense matrix where each cell's values are a weighted average of its neighborhood.

Usage

impute_matrix(
  mat,
  impute_weights,
  verbose = getOption("MarchR.verbose", FALSE)
)

Arguments

mat

(matrix, dgCMatrix, or IterableMatrix) Feature-by-cell matrix to impute.

impute_weights

Impute weights object from get_impute_weights().

verbose

(logical) Print progress messages. Default getOption("MarchR.verbose", FALSE).

Value

A dense matrix (features x cells) with imputed values.

Details

For each replicate and block, the function subsets mat to the block's cells and multiplies by the sparse diffusion weights: imputed_block = t(W %*% t(mat[, block_cells])). Each replicate must cover all input cells exactly once. Replicate outputs are aligned by cell name before averaging, regardless of block order.

ArchR correspondence: imputeMatrix(mat, getImputeWeights(proj))

See also

add_impute_weights for computing weights get_impute_weights for retrieving weights