scvi.data.fields.MuDataCategoricalVarField#

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

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 for a given AnnData/MuData object.

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#

adata_field

MuDataCategoricalVarField.adata_field[source]#

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

attr_key

MuDataCategoricalVarField.attr_key[source]#

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

attr_name

MuDataCategoricalVarField.attr_name[source]#

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

is_empty

MuDataCategoricalVarField.is_empty[source]#

mod_key

MuDataCategoricalVarField.mod_key[source]#

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

registry_key

MuDataCategoricalVarField.registry_key[source]#

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

Methods#

get_data_registry

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

get_field_data

MuDataCategoricalVarField.get_field_data(adata)[source]#

Returns the requested data as determined by the field for a given AnnData/MuData object.

Parameters:

adata (Union[AnnData, MuData]) –

Return type:

Union[ndarray, DataFrame]

get_modality

MuDataCategoricalVarField.get_modality(mdata)[source]#

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

Parameters:

mdata (MuData) –

Return type:

Union[AnnData, MuData]

get_summary_stats

MuDataCategoricalVarField.get_summary_stats(state_registry)[source]#

Get summary stats.

Parameters:

state_registry (dict) –

Return type:

dict

preregister

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.

Parameters:

mdata (MuData) –

Return type:

None

register_field

MuDataCategoricalVarField.register_field(mdata)[source]#

Register the field.

Parameters:

mdata (MuData) –

Return type:

dict

transfer_field

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

Transfer the field.

Parameters:
  • state_registry (dict) –

  • mdata_target (MuData) –

Return type:

dict

validate_field

MuDataCategoricalVarField.validate_field(mdata)[source]#

Validate the field.

Parameters:

mdata (MuData) –

Return type:

None

view_state_registry

MuDataCategoricalVarField.view_state_registry(state_registry)[source]#

View the state registry.

Parameters:

state_registry (dict) –

Return type:

Optional[Table]