liana.method.bivariate.__call__#
- bivariate.__call__(local_name='cosine', global_name=None, resource_name=None, resource=None, interactions=None, connectivity_key='spatial_connectivities', mask_negatives=False, add_categories=False, n_perms=None, seed=1337, nz_prop=0.05, remove_self_interactions=True, complex_sep='_', xy_sep='^', verbose=False, **kwargs)#
A method for bivariate local spatial metrics.
- Parameters:
mdata (
MuData|AnnData) – MuData (multimodal) data object.local_name (
str|None(default:'cosine')) – Name of the local function to use for the analysis. PassingNonewill return only the Global scores.global_name (
None|str|list[str] (default:None)) – Name or names (list) of the global function(s) to use for the analysis. PassingNonewill not calculate any global scoresresource_name (
str(default:None)) – Name of the resource to be used for ligand-receptor inference. Seeli.rs.show_resources()for available resources.resource (
DataFrame|None(default:None)) – A pandas dataframe with [ligand,receptor] columns. If provided will overrule the resource requested viaresource_nameinteractions (
list[str] (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.connectivity_key (
str(default:'spatial_connectivities')) – Key inadata.obspthat contains the spatial connectivity matrix. Default is'spatial_connectivity'.mask_negatives (
bool(default:False)) – Whether to mask negative-negative (low-low) or uncategorized interactions.add_categories (
bool(default:False)) – Whether to add categories about the local scores.n_perms (
int(default:None)) – Number of permutations for the permutation test. If None, no p-values are computed.seed (
int(default:1337)) – Random seed for reproducibility.nz_prop (
float(default:0.05)) – 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 thannz_propto be considered in the analysis.remove_self_interactions (
bool(default:True)) – Whether to remove self-interactions.Trueby default.complex_sep (
None|str(default:'_')) – Separator to use for complex names.xy_sep (
str(default:'^')) – Separator to use for interaction names.verbose (
bool(default:False)) – Verbosity flag.**kwargs –
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 the raw counts for the x-mod.
- y_use_raw: bool
Whether to use the raw counts for y-mod.
- x_layer: str
Layer to use for x-mod.
- y_layer: str
Layer to use for y-mod.
- x_transform: bool
Function to transform the x-mod.
- y_transform: bool
Function to transform the y-mod.
- Name of the x-variable. If passing a
- Raises:
ValueError – If
n_permsis not None or negative or ifmdatais not a valid type.- Return type:
- Returns:
An AnnData object, (optionally) with multiple layers which correspond categories/p-values, and the actual scores are stored in
.X. Moreover, global stats are stored in.var.