scvi.data.fields.MuDataObsmField#

class scvi.data.fields.MuDataObsmField(*args, mod_key=None, mod_required=False, **kwargs)#

Attributes table#

adata_field

class"~scvi.data.fields.AnnDataField instance that this class instance wraps.

attr_key

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

attr_name

The name of the AnnData/MuData 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)

Returns the requested data as determined by the field.

get_modality(mdata)

Fetches the appropriate modality from the MuData object using self.mod_key.

get_summary_stats(state_registry)

Get summary stats.

preregister(mdata)

Function that is called prior to registering fields.

register_field(mdata)

Register the field.

transfer_field(state_registry, mdata_target, ...)

Transfer the field.

validate_field(mdata)

Validate the field.

view_state_registry(state_registry)

View the state registry.

Attributes#

MuDataObsmField.adata_field[source]#

class”~scvi.data.fields.AnnDataField instance that this class instance wraps.

MuDataObsmField.attr_key[source]#

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

MuDataObsmField.attr_name[source]#

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

MuDataObsmField.is_empty[source]#
MuDataObsmField.mod_key[source]#

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

MuDataObsmField.registry_key[source]#

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

Methods#

MuDataObsmField.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

MuDataObsmField.get_field_data(adata)[source]#

Returns the requested data as determined by the field.

Return type:

ndarray | DataFrame

MuDataObsmField.get_modality(mdata)[source]#

Fetches the appropriate modality from the MuData object using self.mod_key.

Return type:

AnnData | MuData

MuDataObsmField.get_summary_stats(state_registry)[source]#

Get summary stats.

Return type:

dict

MuDataObsmField.preregister(mdata)[source]#

Function that is called prior to registering fields.

Function that is be called at the beginning of register_field() and transfer_field(). Used when data manipulation is necessary across modalities.

Return type:

None

MuDataObsmField.register_field(mdata)[source]#

Register the field.

Return type:

dict

MuDataObsmField.transfer_field(state_registry, mdata_target, **kwargs)[source]#

Transfer the field.

Return type:

dict

MuDataObsmField.validate_field(mdata)[source]#

Validate the field.

Return type:

None

MuDataObsmField.view_state_registry(state_registry)[source]#

View the state registry.

Return type:

Table | None