sparrow.pt.add_points_layer

sparrow.pt.add_points_layer#

sparrow.pt.add_points_layer(sdata, ddf, output_layer, coordinates, transformations=None, overwrite=True)#

Add a points layer to a SpatialData object.

This function allows you to add a points layer to sdata. The points layer is derived from a Dask DataFrame. If sdata is backed by a zarr store, the resulting points layer will be backed to the zarr store, otherwise ddf will be persisted in memory.

Parameters:
  • sdata (SpatialData) – The SpatialData object to which the new points layer will be added.

  • ddf (DataFrame) – The DaskDataFrame containing the points data to be added.

  • output_layer (str) – The name of the output layer where the points data will be stored.

  • coordinates (dict[str, str]) – A dictionary specifying the coordinate mappings for the points data (e.g., {“x”: “x_column”, “y”: “y_column”}).

  • transformations (Optional[dict[str, BaseTransformation]] (default: None)) – Transformations that will be added to the resulting output_layer. Currently sparrow only supports the Identity transformation.

  • overwrite (bool (default: True)) – If True, overwrites output_layer if it already exists in sdata.

Return type:

SpatialData

Returns:

: The sdata object with the points layer added.