scvi.data.fields.ProteinObsmField#

class scvi.data.fields.ProteinObsmField(*base_field_args, use_batch_mask=True, batch_field=None, **base_field_kwargs)[source]#

An AnnDataField for an protein data stored in an .obsm field of an AnnData object.

For usage with the TotalVI model. Computes an additional mask which indicates where batches are missing protein data.

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

  • obsm_key – Key to access the field in the AnnData .obsm mapping.

  • use_batch_mask (bool (default: True)) – If True, computes a batch mask over the data for missing protein data. Requires batch_key to be not None.

  • batch_key – Key corresponding to the .obs field where batch indices are stored. Used for computing a batch mask over the data for missing protein data.

  • colnames_uns_key – Key to access column names corresponding to each column of the .obsm field in the AnnData .uns mapping. Only used when .obsm data is a np.ndarray, not a pd.DataFrame.

  • is_count_data – If True, checks if the data are counts during validation.

  • correct_data_format – If True, checks and corrects that the AnnData field is C_CONTIGUOUS and csr if it is dense numpy or sparse respectively.

Attributes table#

COLUMN_NAMES_KEY

PROTEIN_BATCH_MASK

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)

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#

ProteinObsmField.COLUMN_NAMES_KEY = 'column_names'#
ProteinObsmField.PROTEIN_BATCH_MASK = 'protein_batch_mask'#
ProteinObsmField.attr_key[source]#
ProteinObsmField.attr_name[source]#
ProteinObsmField.is_empty[source]#
ProteinObsmField.mod_key[source]#

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

ProteinObsmField.registry_key[source]#

Methods#

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

ProteinObsmField.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]

ProteinObsmField.get_summary_stats(state_registry)[source]#

Get summary stats.

Return type:

dict

ProteinObsmField.register_field(adata)[source]#

Register the field.

Return type:

dict

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

Transfer the field.

Return type:

dict

ProteinObsmField.validate_field(adata)[source]#

Validate the field.

Return type:

None

ProteinObsmField.view_state_registry(state_registry)[source]#

View the state registry.

Return type:

Optional[Table]