rapids_singlecell.pp.normalize_shifted_clr#

rapids_singlecell.pp.normalize_shifted_clr(adata, *, alpha=None, use=None, out=False, layer=None, inplace=True, copy=False)[source]#

Normalize counts with the shifted centered log-ratio (PFlog) transform [BHGMP26].

If alpha is not provided, it is estimated from the input matrix. PFlog is then computed as

T(x)i=log⁡(1+4αxi)−1D∑j=1Dlog⁡(1+4αxj),

which is equivalent to centering log⁡(xi+1/(4α)) because the constant log⁡(4α) cancels during CLR centering.

Note

CLR centering generally maps zeros to non-zero values, so the resulting matrix is dense even when the input is sparse.

Parameters:
adata AnnData

The annotated data matrix of shape n_obs × n_vars. Rows correspond to cells and columns to genes.

alpha float | None (default: None)

Negative-binomial overdispersion of the dataset (var = μ + α·μ²). If None, it is estimated from the input matrix. A positive numeric value uses that value directly. PFlog applies log1p(4 * alpha * x) before CLR centering.

use LayerAcc | MultiAcc | str | None (default: None)

Which matrix to normalize, e.g. A.X, A.layers['counts'] or A.obsm['x']. Strings are resolved by anndata.acc.AdAcc.resolve(), e.g. 'layers.counts'.

out LayerAcc | MultiAcc | str | bool (default: False)

Where to write the result, e.g. A.layers['k'] (or 'layers.k'). If True, the result is returned instead of written. If False, it is written to the place use reads from.

Return type:

AnnData | ndarray | Array | dict[str, ndarray | Array] | None

Returns:

The normalized matrix if out=True, else None.