spateo.tdr.models.models_individual.point_clouds#

Module Contents#

Functions#

construct_pc(→ Tuple[pyvista.PolyData, Optional[str]])

Construct a point cloud model based on 3D coordinate information.

spateo.tdr.models.models_individual.point_clouds.construct_pc(adata: anndata.AnnData, layer: str = 'X', spatial_key: str = 'spatial', groupby: str | tuple = None, key_added: str = 'groups', mask: str | int | float | list = None, colormap: str | list | dict = 'rainbow', alphamap: float | list | dict = 1.0) Tuple[pyvista.PolyData, str | None][source]#

Construct a point cloud model based on 3D coordinate information.

Parameters:
adata

AnnData object.

layer

If 'X', uses .X, otherwise uses the representation given by .layers[layer].

spatial_key

The key in .obsm that corresponds to the spatial coordinate of each bucket.

groupby

The key that stores clustering or annotation information in .obs, a gene name or a list of gene names in .var.

key_added

The key under which to add the labels.

mask

The part that you don’t want to be displayed.

colormap

Colors to use for plotting pc. The default colormap is 'rainbow'.

alphamap

The opacity of the colors to use for plotting pc. The default alphamap is 1.0.

Returns:

A point cloud, which contains the following properties:

pc.point_data[key_added], the groupby information. pc.point_data[f'{key_added}_rgba'], the rgba colors of the groupby information. pc.point_data['obs_index'], the obs_index of each coordinate in the original adata.

plot_cmap: Recommended colormap parameter values for plotting.

Return type:

pc