rnalysis.filtering.DESeqFilter.filter_fold_change_direction

DESeqFilter.filter_fold_change_direction(direction: Literal['pos', 'neg'] = 'pos', opposite: bool = False, inplace: bool = True)

Filters out features according to the direction in which they changed between the two conditions.

Parameters
  • direction – ‘pos’ or ‘neg’. If ‘pos’, will keep only features that have positive log2foldchange. If ‘neg’, will keep only features that have negative log2foldchange.

  • 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 DESeqFilter object. If False, the function will return a new DESeqFilter instance and the current instance will not be affected.

Returns

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

Examples
>>> from rnalysis import filtering
>>> d = filtering.DESeqFilter('tests/test_files/sample_deseq.csv')
>>> d.filter_fold_change_direction('pos') # keep only rows with a positive log2(fold change) value
Filtered 3 features, leaving 26 of the original 29 features. Filtered inplace.
>>> d = filtering.DESeqFilter('tests/test_files/sample_deseq.csv')
>>> d.filter_fold_change_direction('neg') # keep only rows with a negative log2(fold change) value
Filtered 27 features, leaving 2 of the original 29 features. Filtered inplace.
>>> d = filtering.DESeqFilter('tests/test_files/sample_deseq.csv')
>>> d.filter_fold_change_direction('pos', opposite=True) # keep only rows with a non-positive log2(fold change) value
Filtered 26 features, leaving 3 of the original 29 features. Filtered inplace.