liana.mt.genericMistyData#
- liana.mt.genericMistyData(intra, intra_use_raw=False, intra_layer=None, extra=None, extra_use_raw=False, extra_layer=None, nz_threshold=0.1, add_para=True, spatial_key='spatial', set_diag=False, kernel='misty_rbf', bandwidth=100, zoi=0, cutoff=0.1, add_juxta=True, n_neighs=6, max_neighs=18, verbose=False)#
Construct a MistyData object from an AnnData object with views as presented in the manuscript.
- Parameters:
- intra
AnnData AnnData object with the intraview
- intra_use_raw
bool(default:False) Whether to use the raw data of the intraview.
- intra_layer
str|None(default:None) The layer of the intraview to use.
- extra
AnnData|None(default:None) AnnData object with the extraview(s). If None, the extraview is set to be the same as the intraview.
- extra_use_raw
bool(default:False) Whether to use the raw data of the extraview.
- extra_layer
str|None(default:None) The layer of the extraview(s) to use.
- nz_threshold
float(default:0.1) The threshold for the number of non-zero entries in each view.
- add_para
bool(default:True) Whether to add the paraview.
- spatial_key
str(default:'spatial') The key in adata.obsm where the spatial coordinates are stored.
- set_diag
bool(default:False) Whether to set the diagonal of the connectivity matrix to 1.
- kernel
Literal['gaussian','exponential','linear','misty_rbf'] (default:'misty_rbf') A radial basis function kernel to use for the generation of the connectivity matrix for the paraview. Default is ‘misty_rbf’, a kernel derivative of a Gaussian kernel.
- bandwidth
float(default:100) The bandwidth of the kernel.
- zoi
float(default:0) The zone of indifference of the kernel, i.e. the kernel is set to 0 for distances smaller than zoi.
- cutoff
float(default:0.1) The cutoff for the connectivity matrix.
- add_juxta
bool(default:True) Whether to add the juxtaview. The juxtaview is constructed using only the nearest neighbors. A bandwidth of 5 times the bandwidth of the paraview is used to ensure that the nearest neighbors within the radius.
- n_neighs
int(default:6) The number of neighbors to consider when constructing the juxtaview.
- max_neighs
int(default:18) The maximum number of neighbors to consider when constructing the Paraview.
- verbose
bool(default:False) Whether to print progress.
- intra
- Return type:
- Returns:
MistyDataobject with the intra view, and two fixed extra view(s): para and juxta.
Examples
Builds the three-view design of the MISTy manuscript from one spatial
AnnData: the measurements themselves ('intra'), the immediate neighbours ('juxta'), and the wider neighbourhood ('para'):>>> import liana as li >>> adata = li.ds.generate_toy_spatial() >>> misty = li.mt.genericMistyData(intra=adata, bandwidth=200, set_diag=True)
Pass a second object as
extrato predict the intra view from a different modality (e.g. cell-type composition, or pathway activities). Then call the object to fit the model – seeliana.mt.MistyData.__call__().