Skip to content

Commit

Permalink
Fix missing filter_var()
Browse files Browse the repository at this point in the history
  • Loading branch information
gtca committed Oct 16, 2024
1 parent 8aab218 commit 10060b5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions muon/_core/preproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,31 @@ def filter_obs(
return


def filter_var(
data: Union[AnnData, MuData], var: Union[str, Sequence[str]], func: Optional[Callable] = None
):
"""
Filter variables (features, e.g. genes) in-place
using any column in .var or row in .X.
Parameters
----------
data: AnnData or MuData
AnnData or MuData object
var: str or Sequence[str]
Column name in .var or row name in .X to be used for filtering.
Alternatively, var_names can be provided directly.
func
Function to apply to the variable used for filtering.
If the variable is of type boolean and func is an identity function,
the func argument can be omitted.
"""

_filter_attr(data, "var", var, func)

return


# Subsampling observations


Expand Down

0 comments on commit 10060b5

Please sign in to comment.