acore.normalization package#
Module normalization for analysis. This module provides functions to normalize data for analysis.
The higher-level convience functions are normalize_data and normalize_data_by_group. Combat normalization was added using the inmoose package.
The actual normalization functions are in strategies.py.
- normalize_data(data: DataFrame, method: str = 'median', normalize: str = None)[source]#
This function normalizes the data using the selected method. Normalizes only nummeric data, but keeps the non-numeric columns in the output DataFrame.
- Parameters:
data – DataFrame with the data to be normalized (samples x features)
method (str) – normalization method to choose among: median (default), median_polish, median_zero, quantile, linear, zscore
normalize (str) – whether the normalization should be done by ‘features’ (columns) or ‘samples’ (rows) (default None)
- Returns:
pandas.DataFrame.
Example:
result = normalize_data(data, method='median_polish')
- normalize_data_per_group(data: DataFrame, group: str | int | list[str | int], method: str = 'median', normalize: str = None) DataFrame[source]#
This function normalizes the data by group using the selected method
- Parameters:
data – DataFrame with the data to be normalized (samples x features)
group_col – Column containing the groups, passed to pandas.DataFrame.groupby
method (str) – normalization method to choose among: median_polish, median, quantile, linear
normalize (str) – whether the normalization should be done by ‘features’ (columns) or ‘samples’ (rows) (default None)
- Returns:
pandas.DataFrame.
Example:
result = normalize_data_per_group(data, group='group' method='median')