pipe_uns#

SingleCell.pipe_uns(function, /, *args, **kwargs)[source]#

Apply a function to a SingleCell dataset’s uns.

sc = sc.pipe_uns(func) is equivalent to sc.uns = func(sc.uns). sc = sc.pipe_uns(func, 1, a=2) is equivalent to sc.uns = func(sc.uns, 1, a=2).

To apply a function to a specific key of uns, rather than to uns as a whole, use pipe_uns_key().

Parameters:
  • function: Callable[[Dict[str, str | int | float | bool | bool | ndarray | Dict[str, str | int | float | bool | bool | ndarray | UnsDict]], ...], Dict[str, str | int | float | bool | bool | ndarray | Dict[str, str | int | float | bool | bool | ndarray | UnsDict]]]

    the function to apply to uns. It must take the old uns as its first argument and return the new uns. The function may also take other arguments after uns, 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 uns.

Return type:

SingleCell