scdrs.pp._get_mean_var_implicit_cov_corr#

scdrs.pp._get_mean_var_implicit_cov_corr(adata, axis=0, weights=None, transform_func=None, n_chunk=20)[source]#

Compute mean and variance of sparse matrix of the form

adata.X + COV_MAT * COV_BETA + COV_GENE_MEAN.

Computed iteratively over chunks of sparse matrix by converting to dense matrix and computing mean and variance of dense matrix.

Parameters:
adataanndata.AnnData

Annotated data matrix (n_obs, n_vars)

axis{0, 1}, default=0

Axis along which to compute mean and variance

weightsarray_like, default=None

Weights of length adata.shape[axis].

transform_funcfunction, default=None

Function to transform the data before computing mean and variance

n_chunkint, default=20

Number of chunks to split the data into when computing mean and variance this will determine the memory usage

Returns:
v_meannp.ndarray

Mean vector.

v_varnp.ndarray

Variance vector.