Cell-cell communication#

sctk.tl.run_liana() provides a lazy wrapper around LIANA consensus ligand-receptor inference. Results are hypotheses about compatible expression, not direct evidence of physical signaling.

Install the optional backend#

pip install -e ".[ccc]"

Prepare the input#

LIANA expects:

  • a curated cell-identity column;

  • sufficient cells in every identity;

  • natural-log normalized expression;

  • gene identifiers compatible with the selected ligand-receptor resource.

assert "cell_type" in adata.obs
assert "log1p_norm" in adata.layers
adata.obs["cell_type"].value_counts()

Do not use scaled expression. Set use_raw=True only when adata.raw contains the intended normalized representation.

Run consensus inference#

result = sctk.tl.run_liana(
    adata,
    groupby="cell_type",
    layer="log1p_norm",
    use_raw=False,
    resource_name="consensus",
    expr_prop=0.1,
    min_cells=10,
    n_perms=1_000,
    n_jobs=4,
    key_added="liana_res",
)

The returned DataFrame is also stored in adata.uns["liana_res"].

expr_prop is the minimum fraction of cells expressing ligand or receptor components in the relevant cell identities. Raising it favors broadly expressed interactions; lowering it increases sensitivity and the number of hypotheses.

Summarize source-target edges#

edges = sctk.tl.summarize_interactions(
    result,
    score="magnitude_rank",
    top_n=30,
)

The summary reports:

  • number of ligand-receptor interactions per source-target pair;

  • mean rank;

  • best rank.

For magnitude_rank, smaller values indicate stronger consensus ranking.

Filter specific interactions#

focused = result.loc[
    result["source"].isin(["Myeloid"])
    & result["target"].isin(["T_cell", "NK"])
].sort_values("magnitude_rank")

Retain ligand/receptor identities, magnitude, specificity, expression proportions, and adjusted significance fields when available.

Replicated-condition analysis#

Running LIANA once on all cells does not provide sample-level replication for a condition contrast. For replicated studies:

  1. perform inference or compatible summaries within each sample;

  2. retain source, target, ligand, and receptor identifiers;

  3. compare interaction scores across biological samples;

  4. use a paired model when appropriate;

  5. require consistent expression and direction across samples.

Do not interpret a difference between pooled condition-specific cell sets as a replicated statistical test.

Interpretation checklist#

  • Are ligand and receptor expressed in enough cells and samples?

  • Is the result driven by one high-depth sample?

  • Are source and target identities biologically plausible?

  • Does the interaction remain after alternative annotation thresholds?

  • Is direction consistent with known receptor localization?

  • Are conclusions robust across resources or methods?

  • Can the hypothesis be supported by orthogonal data?

Cell composition, ambient RNA, doublets, and annotation errors can all generate plausible-looking false-positive communication edges.