liana.method.bivariate.__call__

bivariate.__call__(mdata: MuData | AnnData, local_name: str | None = 'cosine', global_name: None | str | list = None, resource_name: str | None = None, resource: DataFrame | None = None, interactions: list | None = None, connectivity_key: str = 'spatial_connectivities', mask_negatives: bool = False, add_categories: bool = False, n_perms: int | None = None, seed: int = 1337, nz_prop: float = 0.05, remove_self_interactions: bool = True, complex_sep: None | str = '_', xy_sep: str = '^', verbose: bool = False, **kwargs) AnnData | DataFrame | None

A method for bivariate local spatial metrics.

Parameters:
mdata

MuData (multimodal) data object.

local_name

Name of the local function to use for the analysis. Passing None will return only the Global scores.

global_name

Name or names (list) of the global function(s) to use for the analysis. Passing None will not calculate any global scores

interactions

List of tuples with ligand-receptor pairs [(ligand, receptor), …] to be used for the analysis. If passed, it will overrule the resource requested via resource and resource_name.

resource

A pandas dataframe with [ligand, receptor] columns. If provided will overrule the resource requested via resource_name

resource_name

Name of the resource to be used for ligand-receptor inference. See li.rs.show_resources() for available resources.

connectivity_key

Key in adata.obsp that contains the spatial connectivity matrix. Default is ‘spatial_connectivity’.

mask_negatives

Whether to mask negative-negative (low-low) or uncategorized interactions.

add_categories

Whether to add categories about the local scores.

n_perms

Number of permutations for the permutation test. If None, no p-values are computed.

seed

Random seed for reproducibility.

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_prop to be considered in the analysis.

complex_sep: str

Separator to use for complex names.

xy_sep: str

Separator to use for interaction names.

remove_self_interactions: bool

Whether to remove self-interactions. True by default.

verbose

Verbosity flag.

**kwargsdict, optional

Additional keyword arguments: - For AnnData:

x_name

Name of the x-variable. If passing a resource dataframe, this should match the first column. By default: ‘ligand’.

y_name

Name of the y-variable. If passing a resource dataframe, 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 resource dataframe, this should match the first column. By default: ‘x’.

y_name

Name of the y-variable. If passing a resource dataframe, 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.

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.