computeDropouts: Impute Dropout Values in a Log-normalized Expression Count...

View source: R/methods.R

computeDropoutsR Documentation

Impute Dropout Values in a Log-normalized Expression Count Matrix

Description

This function imputes dropout values (zeros) in a count matrix using either a fast numerical solver or a slower linear equations solver.

Usage

computeDropouts(consMtx, logX, dropIds, fastSolver = TRUE, nCores)

Arguments

consMtx

A numeric matrix representing the processed consensus matrix obtained from clustering analysis.

logX

A (sparse or dense) numeric matrix representing the transpose of a log-normalized gene expression matrix. Rows correspond to cells, and columns correspond to genes.

dropIds

A numeric vector containing the row/col indices of the dropouts to be imputed.

fastSolver

A logical value indicating whether to use the fast solver (default) or the slow solver.

nCores

An integer specifying the number of cores to use for parallel processing (if applicable).

Value

An imputed log-transformed count matrix (same dimensions as 'logX').

Examples

library(scater)
library(BiocParallel)
library(splatter)

sce <- splatSimulate(group.prob = rep(1, 5)/5, sparsify = FALSE, 
        batchCells=100, nGenes=1000, method = "groups", verbose = FALSE, 
        dropout.type = "experiment")
sce <- logNormCounts(sce)
cores <- 2
logX <- as.matrix(logcounts(sce))
w <- rowVars_fast(logX, cores)
corMat <- getCorM("spearman", logcounts(sce), w, cores)
v <- doSVD(corMat, nCores=cores)
BPPARAM = MulticoreParam(cores)
consMtx <- runKM(logX, v, BPPARAM=bpparam())
dropIds <- findDropouts(logX, consMtx)
impLogX <- computeDropouts(consMtx, logX, dropIds, nCores=cores)


khazum/ccImpute documentation built on July 26, 2024, 1:13 a.m.