pipe_varm#
- SingleCell.pipe_varm(function, /, *args, **kwargs)[source]#
Apply a function to a SingleCell dataset’s varm.
sc = sc.pipe_varm(func) is equivalent to sc.varm = func(sc.varm). sc = sc.pipe_varm(func, 1, a=2) is equivalent to sc.varm = func(sc.varm, 1, a=2).
To apply a function to a specific key of varm, rather than to varm as a whole, use pipe_varm_key().
- Parameters:
function: Callable[[dict[str, ndarray | DataFrame], ...], dict[str, ndarray | DataFrame]]
the function to apply to varm. It must take the old varm as its first argument and return the new varm. The function may also take other arguments after varm, 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 varm.
- Return type: