scviva.tools.vision.get_normalized_copy_sparse#

scviva.tools.vision.get_normalized_copy_sparse(X, method='znorm_columns')[source]#

Log2-transform then build a sparse-preserving NormData object.

Mirrors R VISION’s getNormalizedCopySparse. Instead of materialising the normalised matrix, the offsets and scale factors are pre-computed and stored in a NormData instance. Call NormData.toarray() to obtain the dense result when needed.

"rank_norm_columns" is not supported in the sparse path (it must densify; use get_normalized_copy() instead).

Parameters:
X ndarray | spmatrix

Expression matrix, cells × genes.

method Literal['none', 'znorm_columns', 'znorm_rows', 'znorm_rows_then_columns', 'rank_norm_columns']

One of "none", "znorm_columns", "znorm_rows", "znorm_rows_then_columns".

Return type:

NormData

Returns:

NormData Lazy normalisation container.

Raises:

ValueError – If method is not supported by the sparse path.