liana.method.inflow.__call__#
- inflow.__call__(groupby=None, obsm_key=None, resource_name=None, resource=None, interactions=None, nz_prop=0.001, connectivity_key='spatial_connectivities', complex_sep='_', x_transform=None, y_transform=None, use_raw=True, layer=None, xy_sep='^', verbose=False, **kwargs)#
A method for trivariate (source cell type, ligand, receptor) local spatial metrics.
- Parameters:
adata (
AnnData|MuData) – Annotated data object.groupby (str, optional) – Column name in
adata.obscontaining cell type labels. If provided, a one-hot encoding will be created. Mutually exclusive withobsm_key.obsm_key (str, optional) – Key in
adata.obsmcontaining a pre-computed cell type matrix (pandas DataFrame) of shape (n_obs, n_celltypes). Column names will be used as cell type labels. Can contain binary (one-hot) or continuous (probabilities/scores) values. Mutually exclusive withgroupby.interactions (
list(default:None)) – List of tuples with ligand-receptor pairs[(ligand, receptor), ...]to be used for the analysis. If passed, it will overrule the resource requested viaresourceandresource_name.resource (
DataFrame|None(default:None)) – A pandas dataframe with [ligand,receptor] columns. If provided will overrule the resource requested viaresource_nameresource_name (
str(default:None)) – Name of the resource to be used for ligand-receptor inference. Seeli.rs.show_resources()for available resources.connectivity_key (
str(default:'spatial_connectivities')) – Key inadata.obspthat contains the spatial connectivity matrix. Default is'spatial_connectivity'.layer (
str|None(default:None)) – Layer in anndata.AnnData.layers to use. If None, use anndata.AnnData.X.use_raw (
bool|None(default:True)) – Use raw attribute of adata if present.nz_prop (float) – Minimum proportion of non-zero values for each features. For example, if working with gene expression data, this would be the proportion of cells expressing a gene. Both features must have a proportion greater than
nz_propto be considered in the analysis.complex_sep (str) – Separator to use for complex names.
xy_sep (str) – Separator to use for interaction names.
x_transform (
Callable|None(default:None)) – Function used to transform the source-ligand values. If None, no transformation is applied.y_transform (
Callable|None(default:None)) – Function used to transform the receptor values. If None, no transformation is applied.verbose (
bool(default:False)) – Verbosity flag.**kwargs (dict, optional) –
Additional keyword arguments: - For AnnData:
x_name
- Name of the x-variable. If passing a
resourcedataframe, this should match the first column. By default: ‘ligand’. y_name
Name of the y-variable. If passing a
resourcedataframe, this should match the second column. By default: ‘receptor’.- For MuData:
x_mod
- Name of the modality to use for the x-axis.
y_mod
- Name of the modality to use for the y-axis.
x_name
- Name of the x-variable. If passing a
resourcedataframe, this should match the first column. By default: ‘x’. y_name
- Name of the y-variable. If passing a
resourcedataframe, this should match the second column. By default: ‘y’. - x_use_raw: bool
Whether to use raw counts for x modality.
- y_use_raw: bool
Whether to use raw counts for y modality.
- x_layer: str
Layer to use for x modality.
- y_layer: str
Layer to use for y modality.
- For both AnnData and MuData:
- x_transform_kwargs: dict
Keyword arguments to pass to x_transform function.
- y_transform_kwargs: dict
Keyword arguments to pass to y_transform function.
- Name of the x-variable. If passing a
- Return type:
- Returns:
An AnnData object of shape (n_cell_type_ligand_receptor_combinations, n_observations), where n_cell_type_ligand_receptor_combinations corresponds to the combinations of cell types (as defined by the
groupbyparameter) with ligands and receptors expressed in the data and covered by the resource, and n_observations is the number of observations.