Skip to content

msmu._preprocessing._filter

add_filter

add_filter(mdata, modality, column, keep, value)

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 modality's var DataFrame to apply the filter on.

required
value str | float | None

The value to compare against for filtering.

required

Returns:

Name Type Description
MuData MuData

MuData object with the added filter.

apply_filter

apply_filter(mdata, modality)

Applies the filter to the specified modality in the MuData object.

Parameters:

Name Type Description Default
mdata MuData

MuData object to which the filter will be applied.

required
modality str

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

required

Returns:

Name Type Description
MuData MuData

MuData object with the filter applied.