# yanghanwu/graphtgi architecture

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

- Interactive diagram: https://gitdiagram.com/yanghanwu/graphtgi
- Repository: https://github.com/yanghanwu/graphtgi

## Overview

GraphTGI is a research model for predicting transcription-factor (TF) to target-gene interactions. The principal workflow samples known and negative pairs, assembles similarity features and interaction edges into a graph, trains and evaluates a graph-attention model across five folds, then reports classification metrics and plots ROC curves. Similarity matrices and association pairs are visible in the data tree; the listed TRRUST file’s role is not established by the sampled code. The graph reflects the shown calls; the data-loading code uses hard-coded paths, so runtime path resolution is uncertain.

Main entry points: [`train.py`](https://github.com/yanghanwu/graphtgi/blob/main/train.py) (Fold training), [`main.py`](https://github.com/yanghanwu/graphtgi/blob/main/main.py) (Run and plot), [`model.py`](https://github.com/yanghanwu/graphtgi/blob/main/model.py) (GraphTGI model), [`utils.py`](https://github.com/yanghanwu/graphtgi/blob/main/utils.py) (Load similarities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow"]
  node_main["Run and plot<br/>[main.py]"]
  node_train["Fold training<br/>[train.py]"]
end

subgraph group_inputs["Data inputs"]
  node_datasets["Input datasets"]
  node_load["Load similarities<br/>[utils.py]"]
  node_sample["Sample pairs<br/>[utils.py]"]
  node_graph["Build interaction graph<br/>[utils.py]"]
end

subgraph group_learning["Graph learning"]
  node_gat["GAT encoder<br/>[model.py]"]
  node_embeddings["Node embeddings<br/>[model.py]"]
  node_decoder["Bilinear decoder<br/>[model.py]"]
  node_model["GraphTGI model<br/>[model.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Fold metrics<br/>[train.py]"]
  node_roc["ROC visualization<br/>[main.py]"]
end

node_user(("Research user"))

node_user -->|"runs"| node_main
node_main -->|"invokes"| node_train
node_train -->|"builds graph"| node_graph
node_train -->|"samples pairs"| node_sample
node_graph -->|"loads matrices"| node_load
node_load -->|"reads similarities"| node_datasets
node_sample -->|"reads pairs"| node_datasets
node_train -->|"trains and scores"| node_model
node_model -->|"calls encoder"| node_gat
node_gat -->|"produces"| node_embeddings
node_model -->|"scores pairs"| node_decoder
node_train -->|"encodes folds"| node_gat
node_train -->|"scores test pairs"| node_decoder
node_train -->|"computes metrics"| node_metrics
node_metrics -->|"returns scores"| node_main
node_main -->|"plots curves"| node_roc

click node_main "https://github.com/yanghanwu/graphtgi/blob/main/main.py"
click node_train "https://github.com/yanghanwu/graphtgi/blob/main/train.py"
click node_datasets "https://github.com/yanghanwu/graphtgi/tree/main/data"
click node_load "https://github.com/yanghanwu/graphtgi/blob/main/utils.py"
click node_sample "https://github.com/yanghanwu/graphtgi/blob/main/utils.py"
click node_graph "https://github.com/yanghanwu/graphtgi/blob/main/utils.py"
click node_gat "https://github.com/yanghanwu/graphtgi/blob/main/model.py"
click node_embeddings "https://github.com/yanghanwu/graphtgi/blob/main/model.py"
click node_decoder "https://github.com/yanghanwu/graphtgi/blob/main/model.py"
click node_model "https://github.com/yanghanwu/graphtgi/blob/main/model.py"
click node_metrics "https://github.com/yanghanwu/graphtgi/blob/main/train.py"
click node_roc "https://github.com/yanghanwu/graphtgi/blob/main/main.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_main,node_train,node_user toneBlue
class node_datasets,node_load,node_sample,node_graph toneAmber
class node_gat,node_embeddings,node_decoder,node_model toneMint
class node_metrics,node_roc toneRose
```

## Components

### Workflow

- [Run and plot](https://github.com/yanghanwu/graphtgi/blob/main/main.py): `main.py`
- [Fold training](https://github.com/yanghanwu/graphtgi/blob/main/train.py): `train.py`

### Data inputs

- [Input datasets](https://github.com/yanghanwu/graphtgi/tree/main/data): `data`
- [Load similarities](https://github.com/yanghanwu/graphtgi/blob/main/utils.py): `utils.py`
- [Sample pairs](https://github.com/yanghanwu/graphtgi/blob/main/utils.py): `utils.py`
- [Build interaction graph](https://github.com/yanghanwu/graphtgi/blob/main/utils.py): `utils.py`

### Graph learning

- [GAT encoder](https://github.com/yanghanwu/graphtgi/blob/main/model.py): `model.py`
- [Node embeddings](https://github.com/yanghanwu/graphtgi/blob/main/model.py): `model.py`
- [Bilinear decoder](https://github.com/yanghanwu/graphtgi/blob/main/model.py): `model.py`
- [GraphTGI model](https://github.com/yanghanwu/graphtgi/blob/main/model.py): `model.py`

### Evaluation

- [Fold metrics](https://github.com/yanghanwu/graphtgi/blob/main/train.py): `train.py`
- [ROC visualization](https://github.com/yanghanwu/graphtgi/blob/main/main.py): `main.py`

### Other components

- **Research user**

## Connections

- Research user → Run and plot: runs
- Run and plot → Fold training: invokes
- Fold training → Build interaction graph: builds graph
- Fold training → Sample pairs: samples pairs
- Build interaction graph → Load similarities: loads matrices
- Load similarities → Input datasets: reads similarities
- Sample pairs → Input datasets: reads pairs
- Fold training → GraphTGI model: trains and scores
- GraphTGI model → GAT encoder: calls encoder
- GAT encoder → Node embeddings: produces
- GraphTGI model → Bilinear decoder: scores pairs
- Fold training → GAT encoder: encodes folds
- Fold training → Bilinear decoder: scores test pairs
- Fold training → Fold metrics: computes metrics
- Fold metrics → Run and plot: returns scores
- Run and plot → ROC visualization: plots curves
