rapids_singlecell.pp.normalize_total

rapids_singlecell.pp.normalize_total#

rapids_singlecell.pp.normalize_total(adata, *, target_sum=None, exclude_highly_expressed=False, max_fraction=0.05, 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.

layer str | None (default: None)

Layer to normalize instead of X. If None, X is normalized.

inplace bool (default: True)

Whether to update adata or return the matrix.

copy bool (default: False)

Whether to return a copy or update adata. Not compatible with inplace=False.

Return type:

Union[AnnData, csr_matrix, ndarray, None]

Returns:

Returns a normalized copy or updates adata with a normalized version of the original adata.X and adata.layers['layer'], depending on inplace.