# zhangruochi/pepland architecture

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

- Interactive diagram: https://gitdiagram.com/zhangruochi/pepland
- Repository: https://github.com/zhangruochi/pepland

## Overview

PepLand turns peptide SMILES into atom/fragment heterogeneous graphs, pretrains representations in canonical and then non-canonical stages, and uses trained models for peptide embeddings or property prediction. The graph highlights fragmentation, graph construction, message passing, training, and inference, with prediction variants retained as distinct product capabilities. Some checkpoint and evaluation internals are unsampled; their paths identify subsystems, but uncertain wiring is omitted or marked dashed.

Main entry points: [`inference/inference_pepland.py`](https://github.com/zhangruochi/pepland/blob/master/inference/inference_pepland.py) (Embedding inference), [`pretrain_masking.py`](https://github.com/zhangruochi/pepland/blob/master/pretrain_masking.py) (Pretraining workflow), [`model/data.py`](https://github.com/zhangruochi/pepland/blob/master/model/data.py) (Graph dataset), [`tokenizer/pep2fragments.py`](https://github.com/zhangruochi/pepland/blob/master/tokenizer/pep2fragments.py) (Amiibo / AdaFrag)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_representation["Peptide representation"]
  node_fragmenter["Amiibo / AdaFrag<br/>[pep2fragments.py]"]
  node_graph_data["Graph dataset<br/>[data.py]"]
  node_graph_build["Heterogeneous graph builder<br/>[data.py]"]
  node_pretrain_data["Pretraining graphs<br/>[data.py]"]
end

subgraph group_learning["Pretraining and models"]
  node_checkpoint["Trained checkpoints"]
  node_gnn["Multi-view HGT<br/>[model.py]"]
  node_training["Masking trainer<br/>[trainer.py]"]
  node_pretrain_entry["Pretraining workflow"]
end

subgraph group_prediction["Inference and prediction"]
  node_inference_entry["Inference workflow<br/>[inference.py]"]
  node_inference_model["Embedding inference"]
  node_property_heads["Property predictors<br/>[model.py]"]
  node_atom_heads["Atom prediction<br/>[model.py]"]
  node_bond_heads["Bond prediction<br/>[model.py]"]
end

subgraph group_support["Data and utilities"]
  node_evaluation_data["Evaluation statistics<br/>[statistics.py]"]
  node_splitters["Dataset splitting<br/>[splitters.py]"]
  node_processing["Graph feature processing<br/>[process.py]"]
  node_core["Representation core<br/>[core.py]"]
  node_commons["Shared graph utilities<br/>[commons.py]"]
end

node_user(("Researcher"))
node_smiles["Peptide SMILES"]

node_user -->|"provides"| node_smiles
node_smiles -->|"fragments"| node_fragmenter
node_fragmenter -.->|"supplies fragments"| node_graph_data
node_graph_data -->|"builds graphs"| node_graph_build
node_graph_data -->|"uses splitting"| node_splitters
node_pretrain_entry -->|"loads dataset"| node_pretrain_data
node_pretrain_entry -->|"configures model"| node_gnn
node_pretrain_entry -->|"starts training"| node_training
node_training -->|"optimizes"| node_gnn
node_gnn -.->|"produces weights"| node_checkpoint
node_inference_entry -.->|"runs inference"| node_inference_model
node_inference_model -->|"loads model"| node_checkpoint
node_inference_model -->|"builds representations"| node_processing
node_inference_model -.->|"loads configured model"| node_property_heads
node_inference_model -.->|"loads configured model"| node_atom_heads
node_inference_model -.->|"loads configured model"| node_bond_heads
node_core -->|"uses utilities"| node_commons
node_core -->|"uses processing"| node_processing
node_processing -->|"uses fragmentation"| node_fragmenter
node_user -.->|"reviews evaluation"| node_evaluation_data

click node_fragmenter "https://github.com/zhangruochi/pepland/blob/master/tokenizer/pep2fragments.py"
click node_graph_data "https://github.com/zhangruochi/pepland/blob/master/model/data.py"
click node_graph_build "https://github.com/zhangruochi/pepland/blob/master/model/data.py"
click node_pretrain_data "https://github.com/zhangruochi/pepland/blob/master/cpkt/model/code/model/data.py"
click node_checkpoint "https://github.com/zhangruochi/pepland/tree/master/inference/cpkt"
click node_gnn "https://github.com/zhangruochi/pepland/blob/master/model/model.py"
click node_training "https://github.com/zhangruochi/pepland/blob/master/trainer.py"
click node_pretrain_entry "https://github.com/zhangruochi/pepland/blob/master/pretrain_masking.py"
click node_inference_entry "https://github.com/zhangruochi/pepland/blob/master/inference.py"
click node_inference_model "https://github.com/zhangruochi/pepland/blob/master/inference/inference_pepland.py"
click node_property_heads "https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_pharms/code/model/model.py"
click node_atom_heads "https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_atoms/code/model/model.py"
click node_bond_heads "https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_bonds/code/model/model.py"
click node_evaluation_data "https://github.com/zhangruochi/pepland/blob/master/data/eval/statistics.py"
click node_splitters "https://github.com/zhangruochi/pepland/blob/master/splitters.py"
click node_processing "https://github.com/zhangruochi/pepland/blob/master/utils/process.py"
click node_core "https://github.com/zhangruochi/pepland/blob/master/model/core.py"
click node_commons "https://github.com/zhangruochi/pepland/blob/master/utils/commons.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_fragmenter,node_graph_data,node_graph_build,node_pretrain_data toneBlue
class node_checkpoint,node_gnn,node_training,node_pretrain_entry toneAmber
class node_inference_entry,node_inference_model,node_property_heads,node_atom_heads,node_bond_heads toneMint
class node_evaluation_data,node_splitters,node_processing,node_core,node_commons toneRose
class node_user,node_smiles toneIndigo
```

## Components

### Peptide representation

- [Amiibo / AdaFrag](https://github.com/zhangruochi/pepland/blob/master/tokenizer/pep2fragments.py): `tokenizer/pep2fragments.py`
- [Graph dataset](https://github.com/zhangruochi/pepland/blob/master/model/data.py): `model/data.py`
- [Heterogeneous graph builder](https://github.com/zhangruochi/pepland/blob/master/model/data.py): `model/data.py`
- [Pretraining graphs](https://github.com/zhangruochi/pepland/blob/master/cpkt/model/code/model/data.py): `cpkt/model/code/model/data.py`

### Pretraining and models

- [Trained checkpoints](https://github.com/zhangruochi/pepland/tree/master/inference/cpkt): `inference/cpkt`
- [Multi-view HGT](https://github.com/zhangruochi/pepland/blob/master/model/model.py): `model/model.py`
- [Masking trainer](https://github.com/zhangruochi/pepland/blob/master/trainer.py): `trainer.py`
- [Pretraining workflow](https://github.com/zhangruochi/pepland/blob/master/pretrain_masking.py): `pretrain_masking.py`

### Inference and prediction

- [Inference workflow](https://github.com/zhangruochi/pepland/blob/master/inference.py): `inference.py`
- [Embedding inference](https://github.com/zhangruochi/pepland/blob/master/inference/inference_pepland.py): `inference/inference_pepland.py`
- [Property predictors](https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_pharms/code/model/model.py): `cpkt/linear_pred_pharms/code/model/model.py`
- [Atom prediction](https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_atoms/code/model/model.py): `cpkt/linear_pred_atoms/code/model/model.py`
- [Bond prediction](https://github.com/zhangruochi/pepland/blob/master/cpkt/linear_pred_bonds/code/model/model.py): `cpkt/linear_pred_bonds/code/model/model.py`

### Data and utilities

- [Evaluation statistics](https://github.com/zhangruochi/pepland/blob/master/data/eval/statistics.py): `data/eval/statistics.py`
- [Dataset splitting](https://github.com/zhangruochi/pepland/blob/master/splitters.py): `splitters.py`
- [Graph feature processing](https://github.com/zhangruochi/pepland/blob/master/utils/process.py): `utils/process.py`
- [Representation core](https://github.com/zhangruochi/pepland/blob/master/model/core.py): `model/core.py`
- [Shared graph utilities](https://github.com/zhangruochi/pepland/blob/master/utils/commons.py): `utils/commons.py`

### Other components

- **Researcher**
- **Peptide SMILES**

## Connections

- Researcher → Peptide SMILES: provides
- Peptide SMILES → Amiibo / AdaFrag: fragments
- Amiibo / AdaFrag → Graph dataset: supplies fragments (evidence: `model/data.py`)
- Graph dataset → Heterogeneous graph builder: builds graphs (evidence: `model/data.py`)
- Graph dataset → Dataset splitting: uses splitting (evidence: `model/data.py`)
- Pretraining workflow → Pretraining graphs: loads dataset (evidence: `pretrain_masking.py`)
- Pretraining workflow → Multi-view HGT: configures model (evidence: `pretrain_masking.py`)
- Pretraining workflow → Masking trainer: starts training (evidence: `pretrain_masking.py`)
- Masking trainer → Multi-view HGT: optimizes (evidence: `trainer.py`)
- Multi-view HGT → Trained checkpoints: produces weights
- Inference workflow → Embedding inference: runs inference
- Embedding inference → Trained checkpoints: loads model (evidence: `inference/inference_pepland.py`)
- Embedding inference → Graph feature processing: builds representations (evidence: `inference/inference_pepland.py`)
- Embedding inference → Property predictors: loads configured model
- Embedding inference → Atom prediction: loads configured model
- Embedding inference → Bond prediction: loads configured model
- Representation core → Shared graph utilities: uses utilities (evidence: `model/core.py`)
- Representation core → Graph feature processing: uses processing (evidence: `model/core.py`)
- Graph feature processing → Amiibo / AdaFrag: uses fragmentation (evidence: `utils/process.py`)
- Researcher → Evaluation statistics: reviews evaluation
