scvi.data.fields.MuDataCategoricalVarField#

class scvi.data.fields.MuDataCategoricalVarField(*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#

MuDataCategoricalVarField.adata_field[source]#

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

MuDataCategoricalVarField.attr_key[source]#

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

MuDataCategoricalVarField.attr_name[source]#

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

MuDataCategoricalVarField.is_empty[source]#
MuDataCategoricalVarField.mod_key[source]#

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

MuDataCategoricalVarField.registry_key[source]#

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

Methods#

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

MuDataCategoricalVarField.get_field_data(adata)[source]#

Returns the requested data as determined by the field.

Return type:

ndarray | DataFrame

MuDataCategoricalVarField.get_modality(mdata)[source]#

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

Return type:

AnnData | MuData

MuDataCategoricalVarField.get_summary_stats(state_registry)[source]#

Get summary stats.

Return type:

dict

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

MuDataCategoricalVarField.register_field(mdata)[source]#

Register the field.

Return type:

dict

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

Transfer the field.

Return type:

dict

MuDataCategoricalVarField.validate_field(mdata)[source]#

Validate the field.

Return type:

None

MuDataCategoricalVarField.view_state_registry(state_registry)[source]#

View the state registry.

Return type:

Table | None