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.

compute_global_specificity(adata, groupby[, ...])

Computes group-specific ligand-receptor means and permutation-based p-values.

Spatial proximity & interaction metrics#

cross_pcf.__call__(groupby[, spatial_key, ...])

Cross pair-correlation function for all directed cell-type pairs.

lric.__call__([resource, resource_name, ...])

Ligand-Receptor Interaction Correlation (LRIC).

inflow.__call__([groupby, obsm_key, ...])

A method for trivariate (source cell type, ligand, receptor) 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].

filter_view_markers(mdata, markers[, ...])

Remove potential cell type marker genes found in the background of other views.

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

circle_plot(adata[, uns_key, liana_res, ...])

Visualize the cell-cell communication network using a circular plot.

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.

annulus_plot(adata[, spatial_key, ...])

Visualise concentric annuli around a randomly chosen cell on a tissue section.

lric_lineplot(radii, curves, *[, overlay, ...])

Line plot for cross-PCF / LRIC g(r) curves with a baseline at 1.

feature_by_group([adata, groupby, ...])

Plot inflow scores for single feature across spatial coordinates.

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.

spatial_pair_proximity(adata, groupby[, ...])

Computes aggregated spatial statistics and proximity scores between cell types.

query_bandwidth(coordinates[, start, end, ...])

Query the bandwidth (maximum distance) at which the average number of neighbors is maximized.

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

filter_reassemble_complexes(lr_res, ...[, ...])

Reassemble complexes from exploded long-format pandas Dataframe.

translate_resource(resource, map_df[, columns])

Generate orthologs for multiple columns in a DataFrame.

translate_column(resource, map_df, column[, ...])

Generate orthologs for a given column in a DataFrame.

get_hcop_orthologs([target_organism, url, ...])

Download the HCOP orthology file and filter it by minimum evidence.

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.