# costalab/pycrosstalker architecture

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

- Interactive diagram: https://gitdiagram.com/costalab/pycrosstalker
- Repository: https://github.com/costalab/pycrosstalker

## Overview

pyCrossTalkeR analyzes ligand–receptor communication across single or comparative biological conditions, then supports network ranking, statistical comparison and visualization. The main evidenced workflow loads LR tables into AnnData, builds condition networks, optionally computes differential graphs and tests, then calculates cell- and gene-level rankings and can save analyzed results. README capabilities also include reports, PCA rankings, LR-pair plots and network visualizations. Visualization and report-related paths are documented, but their full call wiring was not shown; those relationships are therefore omitted or marked unverified.

Main entry points: [`pycrosstalker/tools/generate_report.py`](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/generate_report.py) (Analysis engine), [`pycrosstalker/tools/Single_Condition.py`](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Single_Condition.py) (Condition input), [`pycrosstalker/tools/Comparative_condition.py`](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Comparative_condition.py) (Condition comparison), [`pycrosstalker/tools/utils.py`](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py) (Statistical tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Analysis workflow"]
  node_report_engine["Analysis engine<br/>[generate_report.py]"]
  node_single_input["Condition input"]
  node_diff["Condition comparison"]
  node_tests["Statistical tests<br/>[utils.py]"]
  node_graph_filter["Graph filtering<br/>[utils.py]"]
  node_rankings["Network rankings<br/>[utils.py]"]
end

subgraph group_state["Analysis state"]
  node_lr_state["LR results state<br/>[lrobject.py]"]
end

subgraph group_visuals["Visualization"]
  node_network_plots["Network plots<br/>[plot.py]"]
  node_ranking_plots["Ranking and PCA plots<br/>[plot.py]"]
  node_lr_pair_plots["LR-pair plots<br/>[plot.py]"]
end

subgraph group_results["Reports and results"]
  node_analyzed_file["Analyzed AnnData"]
end

node_analyst(("Analyst"))

node_analyst -.->|"runs analysis"| node_report_engine
node_report_engine -->|"loads conditions"| node_single_input
node_single_input -->|"stores results"| node_lr_state
node_report_engine -->|"builds comparisons"| node_diff
node_report_engine -->|"runs tests"| node_tests
node_report_engine -->|"filters graphs"| node_graph_filter
node_report_engine -->|"calculates rankings"| node_rankings
node_report_engine -->|"writes results"| node_analyzed_file
node_analyst -.->|"visualizes networks"| node_network_plots
node_analyst -.->|"views rankings"| node_ranking_plots
node_analyst -.->|"plots LR pairs"| node_lr_pair_plots

click node_report_engine "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/generate_report.py"
click node_single_input "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Single_Condition.py"
click node_diff "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Comparative_condition.py"
click node_tests "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py"
click node_graph_filter "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py"
click node_rankings "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py"
click node_lr_state "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/lrobject.py"
click node_network_plots "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.py"
click node_ranking_plots "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.py"
click node_lr_pair_plots "https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.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_report_engine,node_single_input,node_diff,node_tests,node_graph_filter,node_rankings toneBlue
class node_lr_state toneAmber
class node_network_plots,node_ranking_plots,node_lr_pair_plots toneMint
class node_analyzed_file toneRose
class node_analyst toneIndigo
```

## Components

### Analysis workflow

- [Analysis engine](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/generate_report.py): `pycrosstalker/tools/generate_report.py`
- [Condition input](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Single_Condition.py): `pycrosstalker/tools/Single_Condition.py`
- [Condition comparison](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/Comparative_condition.py): `pycrosstalker/tools/Comparative_condition.py`
- [Statistical tests](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py): `pycrosstalker/tools/utils.py`
- [Graph filtering](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py): `pycrosstalker/tools/utils.py`
- [Network rankings](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/utils.py): `pycrosstalker/tools/utils.py`

### Analysis state

- [LR results state](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/tools/lrobject.py): `pycrosstalker/tools/lrobject.py`

### Visualization

- [Network plots](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.py): `pycrosstalker/plots/plot.py`
- [Ranking and PCA plots](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.py): `pycrosstalker/plots/plot.py`
- [LR-pair plots](https://github.com/costalab/pycrosstalker/blob/main/pycrosstalker/plots/plot.py): `pycrosstalker/plots/plot.py`

### Reports and results

- **Analyzed AnnData**

### Other components

- **Analyst**

## Connections

- Analyst → Analysis engine: runs analysis
- Analysis engine → Condition input: loads conditions (evidence: `pycrosstalker/tools/generate_report.py`)
- Condition input → LR results state: stores results (evidence: `pycrosstalker/tools/Single_Condition.py`)
- Analysis engine → Condition comparison: builds comparisons (evidence: `pycrosstalker/tools/generate_report.py`)
- Analysis engine → Statistical tests: runs tests (evidence: `pycrosstalker/tools/generate_report.py`)
- Analysis engine → Graph filtering: filters graphs (evidence: `pycrosstalker/tools/generate_report.py`)
- Analysis engine → Network rankings: calculates rankings (evidence: `pycrosstalker/tools/generate_report.py`)
- Analysis engine → Analyzed AnnData: writes results (evidence: `pycrosstalker/tools/generate_report.py`)
- Analyst → Network plots: visualizes networks (evidence: `README.md`)
- Analyst → Ranking and PCA plots: views rankings (evidence: `README.md`)
- Analyst → LR-pair plots: plots LR pairs (evidence: `README.md`)
