scviva.tools.vision.NormData#
- class scviva.tools.vision.NormData(data, gene_offsets, gene_scale_factors, cell_offsets, cell_scale_factors)[source]#
Sparse expression matrix with pre-computed normalisation parameters.
Stores the log-transformed sparse matrix together with per-gene and per-cell offset / scale-factor vectors so that the fully normalised value for element
(i, j)can be computed on demand without materialising a dense intermediate matrix.Normalised value for element
(i, j):step1 = (data[i, j] + gene_offsets[j]) * gene_scale_factors[j] step2 = (step1 + cell_offsets[i]) * cell_scale_factors[i]
Parameters that are not used for a given method are set to neutral values (offsets=0, scale_factors=1).
Mirrors R VISION’s
NormDataS4 class fromNormalizationMethods.R. Note that R uses genes × cells layout (so R’srowOffsetsare per-gene and R’scolOffsetsare per-cell); the Python attribute names use the Python / AnnData convention (cells × genes).- Parameters:
- data
ndarray|spmatrix Log-transformed expression matrix, dense or sparse.
- gene_offsets
ndarray Per-gene offsets (R’s
rowOffsets).- gene_scale_factors
ndarray Per-gene scale factors (R’s
rowScaleFactors).- cell_offsets
ndarray Per-cell offsets (R’s
colOffsets).- cell_scale_factors
ndarray Per-cell scale factors (R’s
colScaleFactors).
- data
Attributes table
Methods table
|
Materialise the fully normalised dense matrix. |
Attributes
Methods