rnanorm.CTF

class rnanorm.CTF(m_trim=0.3, a_trim=0.05)[source]

Counts adjusted with TMM factors normalization.

Procedure for normalization is described in Johnson & Krishnan, 2022, but in short:

  • Compute normalization factors same as in TMM

  • Divide raw counts with these factors

Parameters:
  • m_trim (float) – Keep genes that are within (m_trim, 1 - m_trim) percentile of M-values.

  • a_trim (float) – Keep genes that are within (a_trim, 1 - a_trim) percentile of A-values.

Examples

>>> from rnanorm.datasets import load_toy_data
>>> from rnanorm import CTF
>>> 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
>>> CTF().set_output(transform="pandas").fit_transform(X)
          Gene_1  Gene_2  Gene_3  Gene_4   Gene_5
Sample_1   200.0   300.0   500.0  2000.0   7000.0
Sample_2   400.0   600.0  1000.0  4000.0  14000.0
Sample_3   400.0   600.0  1000.0  4000.0  34000.0
Sample_4   100.0   150.0   250.0  1000.0   1000.0
__init__(m_trim=0.3, a_trim=0.05)

Initialize class.

Methods

__init__([m_trim, a_trim])

Initialize class.

fit(X[, y])

Fit.

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_norm_factors(X)

Get UQ normalization factors (normalized with geometric mean).

get_params([deep])

Get parameters for this estimator.

set_output(*[, transform])

Set output container.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Transform.