scviva.data.NeighborhoodGraphField#

class scviva.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.

Attributes table

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.

Methods table

get_data_registry()

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

get_field_data(adata)

Get the neighbor graph array from adata.obsm as a dense numpy array.

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

NeighborhoodGraphField.COLUMN_NAMES_KEY = 'column_names'#
NeighborhoodGraphField.attr_key#
NeighborhoodGraphField.attr_name#
NeighborhoodGraphField.is_empty#
NeighborhoodGraphField.mod_key#

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

NeighborhoodGraphField.registry_key#

Methods

NeighborhoodGraphField.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:

dict

NeighborhoodGraphField.get_field_data(adata)[source]#

Get the neighbor graph array from adata.obsm as a dense numpy array.

Parameters:
adata

AnnData object containing the neighbor array in adata.obsm[obsm_key].

Returns:

Dense ndarray; sparse inputs are converted with toarray().

NeighborhoodGraphField.get_summary_stats(state_registry)[source]#

Get summary stats.

Return type:

dict

NeighborhoodGraphField.register_field(adata)[source]#

Register the field.

Return type:

dict

NeighborhoodGraphField.transfer_field(state_registry, adata_target, **kwargs)[source]#

Transfer the field.

Return type:

dict

NeighborhoodGraphField.validate_field(adata)[source]#

Validate the field.

Return type:

None

NeighborhoodGraphField.view_state_registry(state_registry)[source]#

View the state registry.

Return type:

Table | None