# drug-discovery-entc/p2pxml architecture

> Architecture diagram of the GitHub repository drug-discovery-entc/p2pxml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/drug-discovery-entc/p2pxml
- Repository: https://github.com/drug-discovery-entc/p2pxml

## Overview

##### Project type and purpose
- This is an open-source computational biology / machine-learning toolkit (“P2PXML”) that implements a deep geometric model to predict antibody-antigen binding affinity.
- It provides (a) a curated PDB dataset, (b) Python code for data preprocessing, model definition and training/inference, (c) a CLI wrapper (shell script) and (d) a Jupyter/Colab demonstration.

##### File structure
- Top-level directories:
– data/ : raw PDB files + dataset README
– notebooks/ : demonstration Jupyter notebooks + README
– resources/ : static assets (plots, bibtex)
– src/ : core Python modules and shell script
- integrated_model_v1.py – orchestrator for feature extraction, training and inference
- models/ – model definition modules (graph conv, mesh layers, etc.)
- p2pxml.sh – CLI entry point for training/prediction workflows
- Configuration/build scripts: none external—everything is driven by Python code and the shell wrapper.

##### Key insights from README
- The pipeline reads PDB files, constructs geometric (graph) representations, feeds them into a deep neural network, and outputs predicted IC₅₀ values.
- A Colab notebook demonstrates minimal usage.
- Data is hosted on Zenodo; the notebook runs on Google Colab.

1. Data Source
- Local PDB files (data/)
- External dataset host (Zenodo)
2. Preprocessing / Featurization Module
- PDB parser → graph/mesh converter (inside integrated_model_v1)
3. Model Component
- Graph Neural Network modules (src/models/)
- Loss, optimizer, training loop (integrated_model_v1)
4. CLI / Orchestration
- p2pxml.sh shell script invokes Python modules with parameters (train vs infer)
5. Demonstration Interface
- Jupyter Notebook (notebooks/) / Colab
6. Outputs / Results
- Plots and metrics (resources/, notebooks output)

– Raw PDB files → Preprocessing Module
– Preprocessed features → Model Component
– Model Component “train” or “infer” → Predictions & Metrics
– CLI wrapper (p2pxml.sh) → orchestrates preprocessing & model calls
– Notebook → invokes Model Component (via integrated_model_v1 or directly imports modules) → visualizes outputs

c. Architectural patterns & principles
– Pipeline pattern: sequential stages (ingest → featurize → train/infer → evaluate)
– Modular design: clear separation between data loader, model definitions, orchestration script, and presentation layer
– Extensibility points: new model architectures can be added in src/models; parameters configurable via CLI

d. Key technologies & libraries
– Python 3.x, PyTorch or TensorFlow (as specified in src/readme.md)
– Shell scripting (bash) for CLI
– Jupyter/Colab for interactive demos
– PDB file format for molecular structures

##### Final remarks
- Every module in src (preprocessor, model, CLI) and how notebooks import/invoke them.
- Don’t overcomplicate—split the system into logical functional blocks and show their interactions clearly.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Sources"
        PDB["PDB Data"]:::dataStore
        Zenodo["External Dataset (Zenodo)"]:::external
    end

    PDB --> Pre["Feature Extractor"]:::compute
    Zenodo --> Pre

    subgraph "Core Engine"
        Pre
        Model["GNN Model Suite"]:::compute
    end

    Pre --> Model
    Model --> Results["Predictions & Metrics"]:::dataStore

    CLI["p2pxml.sh CLI"]:::interface
    CLI -->|"invoke preprocess"| Pre
    CLI -->|"invoke model"| Model

    subgraph "Demo Interface"
        Notebook["Jupyter/Colab Notebook"]:::interface
    end

    Notebook -->|"import/preprocess"| Pre
    Notebook -->|"import/model"| Model
    Notebook -->|"view results"| Results

    subgraph "Outputs"
        Plots["Plots & Metrics"]:::dataStore
    end

    Results --> Plots

    click PDB "https://github.com/drug-discovery-entc/p2pxml/tree/main/data/"
    click Pre "https://github.com/drug-discovery-entc/p2pxml/blob/main/src/integrated_model_v1.py"
    click Model "https://github.com/drug-discovery-entc/p2pxml/tree/main/src/models/"
    click CLI "https://github.com/drug-discovery-entc/p2pxml/blob/main/src/p2pxml.sh"
    click Notebook "https://github.com/drug-discovery-entc/p2pxml/tree/main/notebooks/"
    click Plots "https://github.com/drug-discovery-entc/p2pxml/tree/main/resources/"

    classDef dataStore fill:#cde,stroke:#000;
    classDef compute   fill:#9cf,stroke:#000;
    classDef interface fill:#fc9,stroke:#000;
    classDef external  fill:#fcc,stroke:#000;
```
