grassp.pp.normalize_total#
- normalize_total(data, inplace=True, **kwargs)[source]#
Normalize expression values for each sample to sum to a constant value.
- Parameters:
- Return type:
- Returns:
Notes
This function normalizes each sample (column) to have the same total intensity. This function serves as a convenient wrapper around
normalize_total(), automatically handling the transposition required to work with subcellular protein data (where proteins are rows rather than columns as in typical single-cell data).Examples
>>> import grassp as gr >>> import numpy as np >>> adata = gr.datasets.hein_2024(enrichment="raw") >>> float(np.median(adata.X.sum(axis=0))) # Column sums before normalization 627735... >>> gr.pp.normalize_total(adata, target_sum=1e6) >>> float(np.median(adata.X.sum(axis=0))) # All columns sum to target after 1000000.0...