liana.method.MistyData¶
- class liana.method.MistyData(data: dict | MuData, obs: DataFrame | None = None, spatial_key: str = 'spatial', enforce_obs: bool = True, **kwargs)¶
MistyData Class used to construct multi-view objects
- Attributes:
axis
MuData axis
filename
Filename of the MuData object.
isbacked
Whether the MuData object is backed.
mod_names
Names of modalities (alias for list(mdata.mod.keys()))
n_mod
Number of modalities in the MuData object.
n_obs
Total number of observations
n_var
Total number of variables
n_vars
Total number of variables
obs
Annotation of observation
obs_names
Names of variables (alias for .obs.index)
obsm
Multi-dimensional annotation of observation
obsmap
Mapping of observation index in the MuData to indices in individual modalities.
obsp
Pairwise annotatation of observations
shape
Shape of data, all variables and observations combined (
n_obs
,n_var
).uns
Unstructured annotation (ordered dictionary).
var
Annotation of variables
var_names
Names of variables (alias for .var.index)
varm
Multi-dimensional annotation of variables
varmap
Mapping of feature index in the MuData to indices in individual modalities.
varp
Pairwise annotatation of variables
Methods
__call__
(model[, bypass_intra, ...])A Multi-view Learning for dissecting Spatial Transcriptomics data (MISTy) model.
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
get_weighted_matrix
getdoc
- __init__(data: dict | MuData, obs: DataFrame | None = None, spatial_key: str = 'spatial', enforce_obs: bool = True, **kwargs)¶
Construct a MistyData object from a dictionary of views (anndatas).
- Parameters:
- datadict
Dictionary of views (anndatas) or a MuData object. Note that only the .X attribute is used. An intra-view called “intra” is required.
- obspd.DataFrame
DataFrame of observations. If None, the obs of the intra-view is used.
- spatial_key
Key in adata.obsm that contains the spatial coordinates. Default is ‘spatial’.
- enforce_obsbool, optional (default: True)
If True, the number of observations in each extra-view must match the intra-view. Then the connectivities are stored in the .obsp attribute, while the weighted matrix is stored in .layers[‘weighted’].
If False, the connectivities are stored in the .obsm attribute, while the weighted matrix is transposed and stored in .varm[‘weighted’].
- **kwargs
Keyword arguments passed to the MuData Super class
Methods
__init__
(data[, obs, spatial_key, enforce_obs])Construct a MistyData object from a dictionary of views (anndatas).
copy
([filename])Make a copy.
get_weighted_matrix
(view_name[, predictors])getdoc
()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
axis
MuData axis
filename
Filename of the MuData object.
isbacked
Whether the MuData object is backed.
mod_names
Names of modalities (alias for list(mdata.mod.keys()))
n_mod
Number of modalities in the MuData object.
n_obs
Total number of observations
n_var
Total number of variables
n_vars
Total number of variables
obs
Annotation of observation
obs_names
Names of variables (alias for .obs.index)
obsm
Multi-dimensional annotation of observation
obsmap
Mapping of observation index in the MuData to indices in individual modalities.
obsp
Pairwise annotatation of observations
shape
Shape of data, all variables and observations combined (
n_obs
,n_var
).uns
Unstructured annotation (ordered dictionary).
var
Annotation of variables
var_names
Names of variables (alias for .var.index)
varm
Multi-dimensional annotation of variables
varmap
Mapping of feature index in the MuData to indices in individual modalities.
varp
Pairwise annotatation of variables