muon.MuData#
- class muon.MuData(data: AnnData | Mapping[str, AnnData] | MuData = None, feature_types_names: dict | None = {'Antibody Capture': 'prot', 'Gene Expression': 'rna', 'Peaks': 'atac'}, as_view: bool = False, index: tuple[slice | Integral, slice | Integral] | slice | Integral | None = None, **kwargs)#
Multimodal data object
MuData represents modalities as collections of AnnData objects as well as includes multimodal annotations such as embeddings and neighbours graphs learned jointly on multiple modalities and generalised sample and feature metadata tables.
- __init__(data: AnnData | Mapping[str, AnnData] | MuData = None, feature_types_names: dict | None = {'Antibody Capture': 'prot', 'Gene Expression': 'rna', 'Peaks': 'atac'}, as_view: bool = False, index: tuple[slice | Integral, slice | Integral] | slice | Integral | None = None, **kwargs)#
- Parameters:
data – AnnData object or dictionary with AnnData objects as values. If a dictionary is passed, the keys will be used as modality names.
feature_types_names – Dictionary to map feature types encoded in data.var[“feature_types”] to modality names. Only relevant when data is an AnnData object. Default: {“Gene Expression”: “rna”, “Peaks”: “atac”, “Antibody Capture”: “prot”}
as_view – Create a view of the MuData object.
index – Index to slice the MuData object when creating the view.
**kwargs – Additional arguments to create a MuData object.
Methods
__init__([data, feature_types_names, ...])- param data:
AnnData object or dictionary with AnnData objects as values.
copy([filename])Make a copy.
obs_keys()List keys of observation annotation
obs.obs_names_make_unique()Call .obs_names_make_unique() method on each AnnData object.
obs_vector(key[, layer])Return an array of values for the requested key of length n_obs
obsm_keys()List keys of observation annotation
obsm.pull_obs([columns, mods, common, ...])Copy the data from the modalities to the global .obs, existing columns to be overwritten or updated
pull_var([columns, mods, common, ...])Copy the data from the modalities to the global .var, existing columns to be overwritten or updated
push_obs([columns, mods, common, prefixed, ...])Copy the data from the mdata.obs to the modalities, existing columns to be overwritten
push_var([columns, mods, common, prefixed, ...])Copy the data from the mdata.var to the modalities, existing columns to be overwritten
strings_to_categoricals([df])Transform string columns in .var and .obs slots of MuData to categorical as well as of .var and .obs slots in each AnnData object
to_anndata(**kwargs)Convert MuData to AnnData
uns_keys()List keys of unstructured annotation.
update()Update both .obs and .var indices of MuData with the data from all the modalities
update_obs()Update global .obs_names according to the .obs_names of all the modalities.
update_var()Update global .var_names according to the .var_names of all the modalities.
var_keys()List keys of variable annotation
var.var_names_make_unique()Call .var_names_make_unique() method on each AnnData object.
var_vector(key[, layer])Return an array of values for the requested key of length n_var
varm_keys()List keys of variable annotation
varm.write([filename])Write MuData object to an HDF5 file
write_h5mu([filename])Write MuData object to an HDF5 file
write_zarr(store, **kwargs)Write MuData object to a Zarr store
Attributes
axisMuData axis
filenameFilename of the MuData object.
isbackedWhether the MuData object is backed.
mod_namesNames of modalities (alias for list(mdata.mod.keys()))
n_modNumber of modalities in the MuData object.
n_obsTotal number of observations
n_varTotal number of variables
n_varsTotal number of variables
obsAnnotation of observation
obs_namesNames of variables (alias for .obs.index)
obsmMulti-dimensional annotation of observation
obsmapMapping of observation index in the MuData to indices in individual modalities.
obspPairwise annotatation of observations
shapeShape of data, all variables and observations combined (
n_obs,n_var).unsUnstructured annotation (ordered dictionary).
varAnnotation of variables
var_namesNames of variables (alias for .var.index)
varmMulti-dimensional annotation of variables
varmapMapping of feature index in the MuData to indices in individual modalities.
varpPairwise annotatation of variables