API#

Import liana as:

import liana as li

Single-cell#

Callable Ligand-Receptor Method instances#

Ligand-receptor method instances provide helper functions and consistent attributes, to describe each method instance, and are callable:

cellchat.__call__(groupby[, resource_name, ...])

Run a ligand-receptor method.

cellphonedb.__call__(groupby[, ...])

Run a ligand-receptor method.

connectome.__call__(groupby[, ...])

Run a ligand-receptor method.

logfc.__call__(groupby[, resource_name, ...])

Run a ligand-receptor method.

natmi.__call__(groupby[, resource_name, ...])

Run a ligand-receptor method.

singlecellsignalr.__call__(groupby[, ...])

Run a ligand-receptor method.

geometric_mean.__call__(groupby[, ...])

Run a ligand-receptor method.

rank_aggregate.__call__(groupby[, ...])

Get an aggregate of ligand-receptor scores from multiple methods.

Spatial#

Local bivariate metrics#

bivariate.__call__([local_name, ...])

A method for bivariate local spatial metrics.

Learn Spatial Relationships#

MistyData(data[, obs, spatial_key, enforce_obs])

MistyData Class used to construct multi-view objects.

genericMistyData(intra[, intra_use_raw, ...])

Construct a MistyData object from an AnnData object with views as presented in the manuscript.

lrMistyData(adata[, resource_name, ...])

Generate a MistyData object from an AnnData object in ligand-receptor format.

Multi-Sample#

df_to_lr(adata, dea_df, groupby, stat_keys)

Convert DEA results to ligand-receptor pairs.

to_tensor_c2c([adata, sample_key, ...])

Function to convert a LIANA result to a tensor for cell2cell analysis.

adata_to_views(adata, groupby, sample_key[, ...])

Converts an AnnData object to a MuData object with views that represent an aggregate for each entity in adata.obs[groupby].

lrs_to_views(adata[, score_key, ...])

Converts a LIANA result to a MuData object with views that represent an aggregate for each entity in adata.obs[groupby].

nmf([adata, df, n_components, k_range, ...])

Fits NMF to an AnnData object.

estimate_elbow(X, k_range[, verbose])

Visualization#

dotplot([adata, uns_key, liana_res, colour, ...])

Dotplot interactions by source and target cells

dotplot_by_sample([adata, uns_key, ...])

A dotplot of interactions by sample

tileplot([adata, liana_res, fill, label, ...])

Tileplot interactions by source and target cells

connectivity(adata, idx[, spatial_key, ...])

Plot spatial connectivity weights.

target_metrics([misty, stat, ...])

Plot target metrics.

contributions([misty, target_metrics, ...])

Plot view contributions per target.

interactions([misty, interactions, view, ...])

Plot interaction importances.

Utility#

obsm_to_adata(adata, obsm_key[, df, _uns, ...])

Extracts a dataframe from adata.obsm and returns a new AnnData object with the values stored in X.

mdata_to_anndata(mdata, x_mod, y_mod[, ...])

Convert a MultiData object to an AnnData object.

zi_minmax(X[, cutoff])

Zero-inflated min-max scaling, adopted from CiteFuse (Kim et al., 2020; https://academic.oup.com/bioinformatics/article/36/14/4137/5827474).

neg_to_zero(X[, cutoff])

Set negative values to 0.

spatial_neighbors(adata[, bandwidth, ...])

Generate spatial connectivity weights using Euclidean distance.

get_factor_scores(adata[, obsm_key, obs_keys])

Extract factor scores from an AnnData object.

get_variable_loadings(adata[, varm_key, ...])

Extract variable loadings from an AnnData object.

interpolate_adata(target, reference, spatial_key)

Interpolates spatial data from a target AnnData object to a reference AnnData object based on spatial coordinates.

Prior knowledge#

select_resource([resource_name])

Read resource of choice from the pre-generated resources in LIANA.

show_resources()

Show available resources.

generate_lr_geneset(resource, net[, ...])

Generate a ligand-receptor gene set from a resource and a network.

explode_complexes(resource[, SOURCE, TARGET])

Function to explode ligand-receptor complexes

get_metalinks([db_path, types, ...])

Fetches edges of metabolite-proteins with specified annotations, applying filters if they are not None.

describe_metalinks([db_path, return_output])

Prints the schema information and foreign key details for all tables in the specified SQLite database.

get_metalinks_values(table_name, column_name)

Fetches distinct values from a specified column in a specified table.

Intracellular#

find_causalnet(prior_graph, ...[, ...])

Find the causal network that best explains the input/output node scores.

build_prior_network(ppis, input_nodes, ...)

Build Prior Network from PPIs and input/output nodes.

estimate_metalinks(adata, resource, pd_net)

Estimate Metabolites from anndata object, and return a MuData object of metabolites and receptors.