pipe_var#

Pseudobulk.pipe_var(function, /, *args, **kwargs)[source]#

Apply a function to a Pseudobulk dataset’s var.

pb = pb.pipe_var(func) is equivalent to pb.var = func(pb.var). pb = pb.pipe_var(func, 1, a=2) is equivalent to pb.var = func(pb.var, 1, a=2).

To apply a function to each cell type’s var, rather than to var as a whole, use map_var().

Parameters:
  • function: Callable[[dict[str, DataFrame], ...], dict[str, DataFrame]]

    the function to apply to var. It must take the old var as its first argument and return the new var. The function may also take other arguments after var, 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 Pseudobulk dataset where the function has been applied to var.

Return type:

Pseudobulk