metbit.spec_norm
NMR and preprocessing module in metbit 7.3.0.
import metbit.spec_normClasses
Normalization
A class for performing various normalization methods, including Probabilistic Quotient Normalization (PQN), Standard Normal Variate (SNV), Multiplicative Scatter Correction (MSC), and their combinations.
Methods:
pqn_normalization(df): Applies Probabilistic Quotient Normalization (PQN) to the input dataframe.
snv_normalization(df): Applies Standard Normal Variate (SNV) normalization to the input dataframe.
msc_normalization(df): Applies Multiplicative Scatter Correction (MSC) normalization to the input dataframe.
snv_msc_normalization(df): Applies SNV followed by MSC normalization to the input dataframe.
snv_pqn_normalization(df): Applies SNV followed by PQN normalization to the input dataframe.
snv_msc_pqn_normalization(df): Applies SNV followed by MSC and then PQN normalization to the input dataframe.
Methods
__init__(self)
Initializes the Normalization class.
pqn_normalization(df)
Perform Probabilistic Quotient Normalization (PQN) on a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe PQN normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one.
snv_normalization(df)
Apply Standard Normal Variate (SNV) normalization to a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe SNV normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one.
msc_normalization(df)
Apply Multiplicative Scatter Correction (MSC) normalization to a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe MSC normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one.
snv_msc_normalization(df)
Apply SNV followed by MSC normalization to a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe SNV-MSC normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one.
snv_pqn_normalization(df)
Apply SNV followed by PQN normalization to a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe SNV-PQN normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one.
snv_msc_pqn_normalization(df)
Apply SNV followed by MSC and then PQN normalization to a dataframe.
Parameters:
dfpandas.DataFrame or numpy.ndarrayThe input data to normalize. Each column represents a feature.
Returns:
df_normpandas.DataFrameThe SNV-MSC-PQN normalized dataframe.
Raises:
TypeError: If input is not a pandas DataFrame or cannot be converted to one. ValueError: If an error occurs during the normalization process.