scviva.data.SpatialCoordsField#
- class scviva.data.SpatialCoordsField(obsm_key)[source]#
AnnData obsm field for 2D/3D spatial coordinates.
Wraps scvi’s ObsmField with coordinate dimensionality validation. Stores coordinates as-is (no normalization) — callers may normalize before registration if needed.
- Parameters:
- obsm_key
str Key to access the spatial coordinates in
adata.obsm.
- obsm_key
Attributes table
The key of the data field within the relevant AnnData attribute. |
|
The name of the AnnData attribute where the data is stored. |
|
Returns True if the field is empty as a function of its kwargs. |
|
The modality key of the data field within the MuData (if applicable). |
|
The key that is referenced by models via a data loader. |
Methods table
Returns a nested dictionary which describes the mapping to the data field. |
|
|
Get the spatial coordinates from |
|
Get summary stats. |
|
Register the field. |
|
Transfer the field. |
|
Validate the field. |
|
View the state registry. |
Attributes
- SpatialCoordsField.COLUMN_NAMES_KEY = 'column_names'#
- SpatialCoordsField.attr_key#
- SpatialCoordsField.attr_name#
- SpatialCoordsField.is_empty#
- SpatialCoordsField.mod_key#
The modality key of the data field within the MuData (if applicable).
- SpatialCoordsField.registry_key#
Methods
- SpatialCoordsField.get_data_registry()[source]#
Returns a nested dictionary which describes the mapping to the data field.
The dictionary is of the form {“mod_key”: mod_key, “attr_name”: attr_name, “attr_key”: attr_key}. This mapping is then combined with the mappings of other fields to make up the data registry.
- Return type:
- SpatialCoordsField.get_field_data(adata)[source]#
Get the spatial coordinates from
adata.obsmand validate their dimensionality.- Parameters:
- adata
AnnData object containing the coordinates in
adata.obsm[obsm_key].
- Returns:
The coordinate array, with shape
(n_obs, 2)or(n_obs, 3).- Raises:
ValueError – If the coordinates do not have 2 or 3 columns.