pipe_varp#

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

Apply a function to a SingleCell dataset’s varp.

sc = sc.pipe_varp(func) is equivalent to sc.varp = func(sc.varp). sc = sc.pipe_varp(func, 1, a=2) is equivalent to sc.varp = func(sc.varp, 1, a=2).

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

Parameters:
  • function : Callable[[dict[str, csr_array | csc_array], ...], dict[str, csr_array | csc_array]]

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

Return type:

SingleCell