rnalysis.filtering.CountFilter.normalize_to_quantile

CountFilter.normalize_to_quantile(quantile: Fraction = 0.75, inplace: bool = True, return_scaling_factors: bool = False)

Normalizes the count matrix using the quantile method, generalized from Bullard et al 2010. This is the default normalization method used by R’s Limma. To calculate the Quantile Method scaling factors, you first calculate the given quantile of gene expression within each sample, excluding genes that have 0 reads in all samples. You then divide those quantile values by the total number of reads in each sample, which yields the scaling factors for each sample.

Parameters:
  • quantile (float between 0 and 1 (default=0.75)) – the quantile from which scaling factors will be calculated.

  • inplace (bool (default=True)) – If True (default), filtering will be applied to the current CountFilter object. If False, the function will return a new CountFilter instance and the current instance will not be affected.

  • return_scaling_factors (bool (default=False)) – if True, return a DataFrame containing the calculated scaling factors.

Returns:

If inplace is False, returns a new instance of the Filter object.

Examples:
>>> from rnalysis import filtering
>>> c = filtering.CountFilter("tests/test_files/counted.csv")
>>> c.normalize_to_quantile(0.75)

Normalized 22 features. Normalized inplace.