rnalysis.filtering.CountFilter.split_by_attribute

CountFilter.split_by_attribute(attributes: Union[str, List[str]], ref: Union[str, Path, Literal['predefined']] = 'predefined') tuple

Splits the features in the Filter object into multiple Filter objects, each corresponding to one of the specified Attribute Reference Table attributes. Each new Filter object will contain only features that belong to its Attribute Reference Table attribute.

Parameters
  • attributes (list of strings) – list of attribute names from the Attribute Reference Table to filter by.

  • ref – filename/path of the reference table to be used as reference.

Return type

Tuple[filtering.Filter]

Returns

A tuple of Filter objects, each containing only features that match one Attribute Reference Table attribute; the Filter objects are returned in the same order the attributes were given in.

Examples
>>> from rnalysis import filtering
>>> counts = filtering.Filter('tests/test_files/counted.csv')
>>> attribute1,attribute2 = counts.split_by_attribute(['attribute1','attribute2'],
... ref='tests/attr_ref_table_for_examples.csv')
Filtered 15 features, leaving 7 of the original 22 features. Filtering result saved to new object.
Filtered 20 features, leaving 2 of the original 22 features. Filtering result saved to new object.