spatialvi.data.NeighborhoodGraphField

spatialvi.data.NeighborhoodGraphField#

class spatialvi.data.NeighborhoodGraphField(obsm_key)[source]#

AnnData obsm field for neighbor index/distance arrays.

Stores dense numpy arrays. Squidpy outputs sparse CSR matrices — this field converts them to dense on registration (documented behavior). Keys: index_neighbor and distance_neighbor (matching upstream ResolVI).

Parameters:

obsm_key (str) – Key to access the neighbor graph in adata.obsm.

__init__(obsm_key)[source]#

Methods

__init__(obsm_key)

get_data_registry()

Returns a nested dictionary which describes the mapping to the data field.

get_field_data(adata)

Returns the requested data as determined by the field.

get_summary_stats(state_registry)

Get summary stats.

register_field(adata)

Register the field.

transfer_field(state_registry, adata_target, ...)

Transfer the field.

validate_field(adata)

Validate the field.

view_state_registry(state_registry)

View the state registry.

Attributes

COLUMN_NAMES_KEY

attr_key

The key of the data field within the relevant AnnData attribute.

attr_name

The name of the AnnData attribute where the data is stored.

is_empty

Returns True if the field is empty as a function of its kwargs.

mod_key

The modality key of the data field within the MuData (if applicable).

registry_key

The key that is referenced by models via a data loader.