rnalysis.filtering.CountFilter.filter_by_row_sum

CountFilter.filter_by_row_sum(threshold: float = 5, opposite: bool = False, inplace: bool = True)

Removes features/rows whose sum is belove ‘threshold’.

Parameters
  • threshold (float) – The minimal sum a row should have in order not to 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 CountFilter object. If False, the function will return a new CountFilter instance and the current instance will not be affected.

Returns

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

Examples
>>> from rnalysis import filtering
>>> c = filtering.CountFilter('tests/test_files/counted.csv')
>>> c.filter_by_row_sum(5) # remove all rows whose sum is <5
Filtered 4 features, leaving 18 of the original 22 features. Filtered inplace.