rapids_singlecell.pp.normalize_total#

rapids_singlecell.pp.normalize_total(adata, *, target_sum=None, exclude_highly_expressed=False, max_fraction=0.05, use=None, out=False, key_added=None, layer=None, inplace=True, copy=False)[source]#

Normalizes rows in matrix so they sum to target_sum.

Parameters:
adata AnnData

AnnData object

target_sum float | None (default: None)

If None, after normalization, each observation (cell) has a total count equal to the median of total counts for observations (cells) before normalization.

exclude_highly_expressed bool (default: False)

Exclude (very) highly expressed genes for the computation of the normalization factor (size factor) for each cell. A gene is considered highly expressed, if it has more than max_fraction of the total counts in at least one cell. The not-excluded genes will sum up to target_sum.

max_fraction float (default: 0.05)

If exclude_highly_expressed=True, consider cells as highly expressed that have more counts than max_fraction of the original total counts in at least one cell.

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 | NormalizeTotalOut | bool (default: False)

Where to write the outputs. A single accessor writes normalized to it, a mapping (NormalizeTotalOut) writes only the outputs it names, e.g. {'normalized': A.layers['norm'], 'norm_factor': A.obs['nf']}. If True, they are returned as a NormalizeTotalResult. If False, normalized is written to the place use reads from and norm_factor isn’t written.

Return type:

AnnData | NormalizeTotalResult | None

Returns:

None, or a NormalizeTotalResult if out=True.