rnalysis.filtering.FoldChangeFilter.filter_fold_change_directionο
- FoldChangeFilter.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 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') >>> # keep only rows with a positive log2(fold change) value >>> f.filter_fold_change_direction('pos') Filtered 10 features, leaving 12 of the original 22 features. Filtered inplace.
>>> f = filtering.FoldChangeFilter('tests/test_files/fc_1.csv','numerator name','denominator name') >>> # keep only rows with a negative log2(fold change) value >>> f.filter_fold_change_direction('neg') Filtered 14 features, leaving 8 of the original 22 features. Filtered inplace.
>>> f = filtering.FoldChangeFilter('tests/test_files/fc_1.csv','numerator name','denominator name') >>> # keep only rows with a non-positive log2(fold change) value >>> f.filter_fold_change_direction('pos', opposite=True) Filtered 12 features, leaving 10 of the original 22 features. Filtered inplace.