filter_var#
- SingleCell.filter_var(*predicates, num_threads=None, **constraints)[source]#
Equivalent to
df.filter()from polars, but applied to both var/varm and X.- Parameters:
*predicates: Expr | Series | str | Iterable[Expr | Series | str] | bool | list[bool] | ndarray[dtype[bool]]
one or more column names, expressions that evaluate to Boolean Series, Boolean Series, lists of Booleans, and/or 1D Boolean NumPy arrays
num_threads: int | None
the number of threads to use when filtering X. Set num_threads=-1 to use all available cores, as determined by
os.cpu_count(). By default (num_threads=None), use self.num_threads cores. Does not affect the filtered SingleCell dataset’s num_threads; this will always be the same as the original dataset’s num_threads. Can only be specified when X is not None.**constraints: Any
column filters: name=value filters to genes where the column named name has the value value
- Returns:
A new SingleCell dataset filtered to genes passing all the Boolean filters in predicates and constraints.
- Return type: