spatialdata_to_domain#

spatialdata_to_domain(spatialdata, name_of_domain='spatialData domain', include_elements=None, annData_tables_and_vars={'table': ['__all__']}, import_shapes_as_points=True, number_of_points_in_cirlces=30, print_summary=True)#

Import a SpatialData object as a MuSpAn domain.

Parameters:
spatialdatasd.SpatialData

The spatialdata object to be converted.

name_of_domainstr, optional

The name of the resulting MuSpAn domain, by default ‘spatialData domain’.

include_elementslist or tuple, optional

A list or tuple of element labels to include from the spatialdata object, by default None.

annData_tables_and_varsdict, optional

A dictionary specifying which annData tables and variables of the tables to add, by default {}. The keys are the names of the tables in the spatialdata object, and the values are lists of the variables to add. If a value is [‘__all__’], all variables in the annData table are added. For example, {‘table1’:[‘var1’,’var2’],’table2’:[‘__all__’]}.

import_shapes_as_pointsbool, optional

If True, import shapes as points, by default True. Set to True if there is a large number of shapes in the spatialdata object for memory efficiency.

number_of_points_in_cirlcesint, optional

Number of points to use when creating circles, by default 30. Circles are created when shape cicrles are imported as points.

print_summarybool, optional

If True, print a summary of the resulting domain, by default True.

Returns:
ms.domain

The resulting MuSpAn domain.

Raises:
TypeError

If the input is not a spatialdata object.

ValueError

If include_elements is not a list or tuple, or if it contains invalid keys. If no elements are included in the domain. If an unrecognized shape type is encountered in the spatialdata object. If a specified table is not in the spatialdata object.

Notes

For more information on spatialData objects, see the spatialData package, https://spatialdata.scverse.org/en/stable/index.html.