rnanorm.CPM

class rnanorm.CPM(allow_nan=False)[source]

Counts per million (CPM) normalization.

Parameters:

allow_nan (bool) – If true, allow X to contain NaN values.

Examples

>>> from rnanorm.datasets import load_toy_data
>>> from rnanorm import CPM
>>> X = load_toy_data().exp
>>> X
          Gene_1  Gene_2  Gene_3  Gene_4  Gene_5
Sample_1     200     300     500    2000    7000
Sample_2     400     600    1000    4000   14000
Sample_3     200     300     500    2000   17000
Sample_4     200     300     500    2000    2000
>>> CPM().set_output(transform="pandas").fit_transform(X)
           Gene_1   Gene_2    Gene_3    Gene_4    Gene_5
Sample_1  20000.0  30000.0   50000.0  200000.0  700000.0
Sample_2  20000.0  30000.0   50000.0  200000.0  700000.0
Sample_3  10000.0  15000.0   25000.0  100000.0  850000.0
Sample_4  40000.0  60000.0  100000.0  400000.0  400000.0
__init__(allow_nan=False)[source]

Initialize class.

Methods

__init__([allow_nan])

Initialize class.

fit(X[, y])

Fit transformer by checking X.

fit_transform(X[, y])

Fit to data, then transform it.

get_feature_names_out([input_features])

Get output feature names for transformation.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

inverse_transform(X)

Transform X using the inverse function.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Transform X using the forward function.