rnalysis.filtering.FoldChangeFilter.filter_abs_log2_fold_change

FoldChangeFilter.filter_abs_log2_fold_change(abslog2fc: float = 1, opposite: bool = False, inplace: bool = True)

Filters out all features whose absolute log2 fold change is below the indicated threshold. For example: if log2fc is 1.0, all features whose log2 fold change is between 1 and -1 (went up less than two-fold or went down less than two-fold) will be filtered out.

Parameters
  • abslog2fc – The threshold absolute log2 fold change for filtering out a feature. Float or int. All features whose absolute log2 fold change is lower than log2fc will be filtered out.

  • opposite (bool) – If True, the output of the filtering will be the OPPOSITE of the specified (instead of filtering out X, the function will filter out anything BUT X). If False (default), the function will filter as expected.

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

Returns

If ‘inplace’ is False, returns a new instance of FoldChangeFilter.

Examples
>>> from rnalysis import filtering
>>> f = filtering.FoldChangeFilter('tests/test_files/fc_1.csv','numerator name','denominator name')
>>> f.filter_abs_log2_fold_change(2) # keep only rows whose log2(fold change) is >=2 or <=-2
Filtered 18 features, leaving 4 of the original 22 features. Filtered inplace.