pipe_obsm#
- SingleCell.pipe_obsm(function, /, *args, **kwargs)[source]#
Apply a function to a SingleCell dataset’s obsm.
sc = sc.pipe_obsm(func) is equivalent to sc.obsm = func(sc.obsm). sc = sc.pipe_obsm(func, 1, a=2) is equivalent to sc.obsm = func(sc.obsm, 1, a=2).
To apply a function to a specific key of obsm, rather than to obsm as a whole, use pipe_obsm_key().
- Parameters:
function: Callable[[dict[str, ndarray | DataFrame], ...], dict[str, ndarray | DataFrame]]
the function to apply to obsm. It must take the old obsm as its first argument and return the new obsm. The function may also take other arguments after obsm, which can be specified via args and kwargs.
*args: Any
the positional arguments to the function
**kwargs: Any
the keyword arguments to the function
- Returns:
A new SingleCell dataset where the function has been applied to obsm.
- Return type: