cookiecutter_scverse_instance.pp.elaborate_example

cookiecutter_scverse_instance.pp.elaborate_example#

cookiecutter_scverse_instance.pp.elaborate_example(items, transform, *, layer_key=None, max_items=100)#

A method with a more complex docstring.

This is where you add more details. Try to support general container classes such as Sequence, Mapping, or Collection where possible to ensure that your functions can be widely used.

Data science means there’s lots of math too:

x=b±b24ac2ax = \frac{-b \pm \sqrt{b^2-4ac}}{2a}
Parameters:
  • items (Iterable[AnnData]) – AnnData objects to process.

  • transform (Callable[[ndarray], str]) – Function to transform each item to string.

  • layer_key (str | None (default: None)) – Optional layer key to access matrix to apply transformation on.

  • max_items (int (default: 100)) – Maximum number of items to process.

Return type:

list[str]

Returns:

List of transformed string items.

Examples

>>> elaborate_example(
...     [adata],
...     lambda vals: f"Statistics: mean={vals.mean():.2f}, max={vals.max():.2f}",
... )
['Statistics: mean=1.24, max=8.75']