spateo.tdr.models.pc#

Submodules#

Package Contents#

Functions#

construct_pc(→ pyvista.PolyData)

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

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

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

Parameters
adata

AnnData object.

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 pcd. The default colormap is 'rainbow'.

alphamap

The opacity of the colors to use for plotting pcd. 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.

Return type

pc