scvi.data.fields.NumericalJointObsField#

class scvi.data.fields.NumericalJointObsField(registry_key, obs_keys)[source]#

An AnnDataField for a collection of numerical .obs fields in the AnnData data structure.

Creates an .obsm field containing each .obs field to be referenced as a whole a model.

Parameters:
  • registry_key (str) – Key to register field under in data registry.

  • obs_keys (Optional[List[str]]) – Sequence of keys to combine to form the obsm field.

Attributes table#

COLUMNS_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).

obs_keys

List of .obs keys that make up this joint field.

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_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#

COLUMNS_KEY

NumericalJointObsField.COLUMNS_KEY = 'columns'#

attr_key

NumericalJointObsField.attr_key[source]#
Return type:

str

attr_name

NumericalJointObsField.attr_name[source]#
Return type:

str

is_empty

NumericalJointObsField.is_empty[source]#
Return type:

bool

mod_key

NumericalJointObsField.mod_key[source]#

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

Return type:

Optional[str]

obs_keys

NumericalJointObsField.obs_keys[source]#

List of .obs keys that make up this joint field.

Return type:

List[str]

registry_key

NumericalJointObsField.registry_key[source]#
Return type:

str

Methods#

get_data_registry

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

NumericalJointObsField.get_field_data(adata)[source]#

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

Return type:

Union[ndarray, DataFrame]

get_summary_stats

NumericalJointObsField.get_summary_stats(_state_registry)[source]#

Get summary stats.

Return type:

dict

register_field

NumericalJointObsField.register_field(adata)[source]#

Register the field.

Return type:

dict

transfer_field

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

Transfer the field.

Return type:

dict

validate_field

NumericalJointObsField.validate_field(adata)[source]#

Validate the field.

Return type:

None

view_state_registry

NumericalJointObsField.view_state_registry(state_registry)[source]#

View the state registry.

Return type:

Optional[Table]