Skip to content

msmu.pp.add_filter

Adds a filter to the specified modality in the MuData object based on the given condition.

Parameters:

Name Type Description Default
mdata MuData

MuData object to which the filter will be added.

required
modality str

The modality within the MuData object to which the filter will be applied

required
column str

The column in the selected table to apply the filter on.

required
keep Literal['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'contains', 'not_contains']

The condition to apply for filtering.

required
value str | float | None

The value to compare against for filtering.

required
on Literal['var', 'obs', 'varm', 'obsm']

Target table to filter on. One of 'var', 'obs', 'varm', or 'obsm'.

'var'
key str | None

Key to select table from .varm/.obsm when on is 'varm'/'obsm'.

None

Returns:

Type Description
MuData

MuData object with the added filter.