# scverse/liana architecture

> Architecture diagram of the GitHub repository scverse/liana, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scverse/liana
- Repository: https://github.com/scverse/liana

## Overview

LIANA+ is a cell–cell communication analysis framework for single-cell, spatial, and multimodal omics. The main workflow accepts AnnData or MuData, prepares expression and cell-group data, applies ligand–receptor knowledge and inference methods, then returns interaction scores for downstream comparison and visualization. Separate branches support spatially constrained and spatial-pattern analyses, multisample integration, and causal-network interpretation. The README documents the broad method families; source excerpts confirm selected preparation, inference, and result-handling relationships, so uncertain wiring is omitted.

Main entry points: [`src/liana/method/sc/_liana_pipe.py`](https://github.com/scverse/liana/blob/main/src/liana/method/sc/_liana_pipe.py) (Single-cell pipeline), [`src/liana/plotting`](https://github.com/scverse/liana/tree/main/src/liana/plotting) (Result plots), [`src/liana/preprocessing`](https://github.com/scverse/liana/tree/main/src/liana/preprocessing) (Spatial preprocessing), [`src/liana/method/sc/_rank_aggregate.py`](https://github.com/scverse/liana/blob/main/src/liana/method/sc/_rank_aggregate.py) (Consensus ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Data preparation"]
  node_datasets["Example datasets<br/>[datasets.py]"]
  node_spatial_prep["Spatial preprocessing"]
  node_multimodal_prep["MuData conversion"]
  node_dataset_fetch["Dataset retrieval<br/>[_fetch.py]"]
end

subgraph group_knowledge["Prior knowledge"]
  node_resource_select["Resource selection<br/>[select_resource.py]"]
  node_prior_network["Prior networks<br/>[_prior_network.py]"]
  node_orthology["Orthology mapping<br/>[_orthology.py]"]
end

subgraph group_inference["Communication inference"]
  node_singlecell_pipe["Single-cell pipeline<br/>[_liana_pipe.py]"]
  node_sc_methods["Single-cell methods"]
  node_aggregate["Consensus ranking<br/>[_rank_aggregate.py]"]
  node_dea_pairs["DEA to interactions<br/>[df_to_lr.py]"]
  node_spatial_lr["Spatial LR scoring<br/>[_inflow.py]"]
  node_lric["Spatial co-occurrence<br/>[_LRIC.py]"]
  node_bivariate["Bivariate metrics"]
  node_misty["MISTy learning"]
end

subgraph group_integration["Integration and interpretation"]
  node_sample_rank["Sample comparison"]
  node_mudata_views["Interaction views<br/>[to_mudata.py]"]
  node_tensor["Tensor conversion<br/>[to_tensor_c2c.py]"]
  node_nmf["Program discovery<br/>[_nmf.py]"]
  node_causal["Causal networks<br/>[_causalnet.py]"]
end

subgraph group_presentation["Results and visualization"]
  node_plots["Result plots"]
end

node_analyst(("Analyst"))

node_analyst -->|"requests data"| node_datasets
node_datasets -->|"fetches dataset"| node_dataset_fetch
node_dataset_fetch -->|"returns data"| node_datasets
node_analyst -->|"submits data"| node_singlecell_pipe
node_multimodal_prep -->|"converts input"| node_singlecell_pipe
node_singlecell_pipe -->|"converts MuData"| node_multimodal_prep
node_singlecell_pipe -->|"selects resource"| node_resource_select
node_singlecell_pipe -->|"runs methods"| node_sc_methods
node_singlecell_pipe -->|"aggregates scores"| node_aggregate
node_analyst -->|"provides DEA results"| node_dea_pairs
node_analyst -->|"prepares coordinates"| node_spatial_prep
node_analyst -->|"submits spatial data"| node_spatial_lr
node_analyst -->|"submits spatial data"| node_lric
node_analyst -->|"submits spatial data"| node_bivariate
node_analyst -->|"submits spatial data"| node_misty
node_spatial_prep -->|"prepares input"| node_spatial_lr
node_spatial_prep -->|"prepares input"| node_lric
node_aggregate -->|"provides scores"| node_sample_rank
node_sample_rank -->|"builds views"| node_mudata_views
node_sample_rank -->|"converts results"| node_tensor
node_mudata_views -.->|"supports programs"| node_nmf
node_analyst -->|"provides scores"| node_causal
node_prior_network -->|"supplies network"| node_causal
node_analyst -->|"requests visualization"| node_plots
node_aggregate -->|"provides results"| node_plots
node_spatial_lr -->|"provides results"| node_plots
node_lric -->|"provides results"| node_plots
node_bivariate -->|"provides results"| node_plots
node_misty -->|"provides results"| node_plots
node_resource_select -.->|"maps genes"| node_orthology

click node_datasets "https://github.com/scverse/liana/blob/main/src/liana/datasets/datasets.py"
click node_spatial_prep "https://github.com/scverse/liana/tree/main/src/liana/preprocessing"
click node_multimodal_prep "https://github.com/scverse/liana/blob/main/src/liana/multisample/mdata_to_anndata.py"
click node_resource_select "https://github.com/scverse/liana/blob/main/src/liana/resource/select_resource.py"
click node_prior_network "https://github.com/scverse/liana/blob/main/src/liana/resource/_prior_network.py"
click node_orthology "https://github.com/scverse/liana/blob/main/src/liana/resource/_orthology.py"
click node_singlecell_pipe "https://github.com/scverse/liana/blob/main/src/liana/method/sc/_liana_pipe.py"
click node_sc_methods "https://github.com/scverse/liana/tree/main/src/liana/method/sc"
click node_aggregate "https://github.com/scverse/liana/blob/main/src/liana/method/sc/_rank_aggregate.py"
click node_dea_pairs "https://github.com/scverse/liana/blob/main/src/liana/method/df_to_lr.py"
click node_spatial_lr "https://github.com/scverse/liana/blob/main/src/liana/method/sp/_inflow.py"
click node_lric "https://github.com/scverse/liana/blob/main/src/liana/method/sp/_LRIC.py"
click node_bivariate "https://github.com/scverse/liana/tree/main/src/liana/method/sp/_bivariate"
click node_misty "https://github.com/scverse/liana/tree/main/src/liana/method/sp/_misty"
click node_sample_rank "https://github.com/scverse/liana/tree/main/src/liana/multisample"
click node_mudata_views "https://github.com/scverse/liana/blob/main/src/liana/multisample/to_mudata.py"
click node_tensor "https://github.com/scverse/liana/blob/main/src/liana/multisample/to_tensor_c2c.py"
click node_nmf "https://github.com/scverse/liana/blob/main/src/liana/multisample/_nmf.py"
click node_causal "https://github.com/scverse/liana/blob/main/src/liana/method/fun/_causalnet.py"
click node_plots "https://github.com/scverse/liana/tree/main/src/liana/plotting"
click node_dataset_fetch "https://github.com/scverse/liana/blob/main/src/liana/datasets/_fetch.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_datasets,node_spatial_prep,node_multimodal_prep,node_dataset_fetch toneBlue
class node_resource_select,node_prior_network,node_orthology toneAmber
class node_singlecell_pipe,node_sc_methods,node_aggregate,node_dea_pairs,node_spatial_lr,node_lric,node_bivariate,node_misty toneMint
class node_sample_rank,node_mudata_views,node_tensor,node_nmf,node_causal toneRose
class node_plots,node_analyst toneIndigo
```

## Components

### Data preparation

- [Example datasets](https://github.com/scverse/liana/blob/main/src/liana/datasets/datasets.py): `src/liana/datasets/datasets.py`
- [Spatial preprocessing](https://github.com/scverse/liana/tree/main/src/liana/preprocessing): `src/liana/preprocessing`
- [MuData conversion](https://github.com/scverse/liana/blob/main/src/liana/multisample/mdata_to_anndata.py): `src/liana/multisample/mdata_to_anndata.py`
- [Dataset retrieval](https://github.com/scverse/liana/blob/main/src/liana/datasets/_fetch.py): `src/liana/datasets/_fetch.py`

### Prior knowledge

- [Resource selection](https://github.com/scverse/liana/blob/main/src/liana/resource/select_resource.py): `src/liana/resource/select_resource.py`
- [Prior networks](https://github.com/scverse/liana/blob/main/src/liana/resource/_prior_network.py): `src/liana/resource/_prior_network.py`
- [Orthology mapping](https://github.com/scverse/liana/blob/main/src/liana/resource/_orthology.py): `src/liana/resource/_orthology.py`

### Communication inference

- [Single-cell pipeline](https://github.com/scverse/liana/blob/main/src/liana/method/sc/_liana_pipe.py): `src/liana/method/sc/_liana_pipe.py`
- [Single-cell methods](https://github.com/scverse/liana/tree/main/src/liana/method/sc): `src/liana/method/sc`
- [Consensus ranking](https://github.com/scverse/liana/blob/main/src/liana/method/sc/_rank_aggregate.py): `src/liana/method/sc/_rank_aggregate.py`
- [DEA to interactions](https://github.com/scverse/liana/blob/main/src/liana/method/df_to_lr.py): `src/liana/method/df_to_lr.py`
- [Spatial LR scoring](https://github.com/scverse/liana/blob/main/src/liana/method/sp/_inflow.py): `src/liana/method/sp/_inflow.py`
- [Spatial co-occurrence](https://github.com/scverse/liana/blob/main/src/liana/method/sp/_LRIC.py): `src/liana/method/sp/_LRIC.py`
- [Bivariate metrics](https://github.com/scverse/liana/tree/main/src/liana/method/sp/_bivariate): `src/liana/method/sp/_bivariate`
- [MISTy learning](https://github.com/scverse/liana/tree/main/src/liana/method/sp/_misty): `src/liana/method/sp/_misty`

### Integration and interpretation

- [Sample comparison](https://github.com/scverse/liana/tree/main/src/liana/multisample): `src/liana/multisample`
- [Interaction views](https://github.com/scverse/liana/blob/main/src/liana/multisample/to_mudata.py): `src/liana/multisample/to_mudata.py`
- [Tensor conversion](https://github.com/scverse/liana/blob/main/src/liana/multisample/to_tensor_c2c.py): `src/liana/multisample/to_tensor_c2c.py`
- [Program discovery](https://github.com/scverse/liana/blob/main/src/liana/multisample/_nmf.py): `src/liana/multisample/_nmf.py`
- [Causal networks](https://github.com/scverse/liana/blob/main/src/liana/method/fun/_causalnet.py): `src/liana/method/fun/_causalnet.py`

### Results and visualization

- [Result plots](https://github.com/scverse/liana/tree/main/src/liana/plotting): `src/liana/plotting`

### Other components

- **Analyst**

## Connections

- Analyst → Example datasets: requests data
- Example datasets → Dataset retrieval: fetches dataset
- Dataset retrieval → Example datasets: returns data
- Analyst → Single-cell pipeline: submits data
- MuData conversion → Single-cell pipeline: converts input
- Single-cell pipeline → MuData conversion: converts MuData
- Single-cell pipeline → Resource selection: selects resource
- Single-cell pipeline → Single-cell methods: runs methods
- Single-cell pipeline → Consensus ranking: aggregates scores
- Analyst → DEA to interactions: provides DEA results
- Analyst → Spatial preprocessing: prepares coordinates
- Analyst → Spatial LR scoring: submits spatial data
- Analyst → Spatial co-occurrence: submits spatial data
- Analyst → Bivariate metrics: submits spatial data
- Analyst → MISTy learning: submits spatial data
- Spatial preprocessing → Spatial LR scoring: prepares input
- Spatial preprocessing → Spatial co-occurrence: prepares input
- Consensus ranking → Sample comparison: provides scores
- Sample comparison → Interaction views: builds views
- Sample comparison → Tensor conversion: converts results
- Interaction views → Program discovery: supports programs
- Analyst → Causal networks: provides scores
- Prior networks → Causal networks: supplies network
- Analyst → Result plots: requests visualization
- Consensus ranking → Result plots: provides results
- Spatial LR scoring → Result plots: provides results
- Spatial co-occurrence → Result plots: provides results
- Bivariate metrics → Result plots: provides results
- MISTy learning → Result plots: provides results
- Resource selection → Orthology mapping: maps genes
