# abdollahegazy/comp_dock architecture

> Architecture diagram of the GitHub repository abdollahegazy/comp_dock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdollahegazy/comp_dock
- Repository: https://github.com/abdollahegazy/comp_dock

## Overview

##### Project type and purpose
- This is a command-line, Python-based data-processing pipeline (no UI) composed of standalone scripts.
- Purpose: automate ligand–protein complex processing (AF3 and MD), detect errors, select viable poses, merge complexes, compute RMSD for downstream analysis.

##### File structure
- Top level contains four main processing scripts:
- find_empty_ligand.py (error detection)
- most_viable.py      (pose viability ranking)
- merger.py           (complex merging)
- rmsd_test.py        (RMSD calculation)
- No frontend, no database, no services—pure file-based I/O.
- README describes inputs (AF3- and MD-derived PDBQT/PDB files) and outputs (lists of empty ligands, best poses, merged complexes, RMSD metrics).

##### Key architectural patterns and design principles
- Pipeline / batch-processing architecture: each script is a stage.
- Modularity: each stage has a single responsibility.
- Data-flow orientation: outputs of one stage feed into the next.
- File-based interfaces: standardized filenames and directories passed via CLI args or hard-coded paths.

##### Main components
A. Input Data Sources
– AF3-derived docking results (PDBQT files)
– MD simulation outputs (PDB/PDBQT)
B. Processing Modules (pipeline stages)
1. Error Detector (find_empty_ligand.py)
- Reads docking results
- Outputs empty_ligands.txt
2. Pose Viability Analyzer (most_viable.py)
- Reads original outputs + empty_ligands.txt
- Ranks ligand poses, outputs viable_pose_list.txt
3. Complex Merger (merger.py)
- Reads viable poses + processed receptor structures
- Produces merged complexes (PDB files)
4. RMSD Calculator (rmsd_test.py)
- Reads merged complexes + AF3 reference
- Computes per-atom RMSD, outputs RMSD_report.csv
C. Outputs / Artifacts
– error lists, ranked pose lists, merged complexes, RMSD reports
D. External Libraries
– Python 3.x
– Potential dependencies: BioPython or MDAnalysis, numpy, pandas

##### Detail without overthinking
- Four scripts as separate components.
- Key file artifact.
- Sequencing and dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Data Sources
    AF3["AF3 Docking Results (PDBQT)"]:::input
    MD["MD Simulation Outputs (PDB/PDBQT)"]:::input

    %% Processing Modules
    find_empty["find_empty_ligand.py\n(Error Detector)"]:::process
    most_viable["most_viable.py\n(Pose Analyzer)"]:::process
    merger["merger.py\n(Complex Merger)"]:::process
    rmsd["rmsd_test.py\n(RMSD Calculator)"]:::process

    %% Artifacts
    empty_txt["empty_ligands.txt"]:::artifact
    viable_txt["viable_pose_list.txt"]:::artifact
    merged_complex["Merged Complexes (PDB)"]:::artifact
    rmsd_report["RMSD_report.csv"]:::artifact

    %% Data Flow
    AF3 -->|Reads docking results| find_empty
    find_empty -->|Outputs empty_ligands.txt| empty_txt

    AF3 -->|Original inputs| most_viable
    MD -->|Original inputs| most_viable
    empty_txt -->|Filter out empties| most_viable
    most_viable -->|Outputs viable_pose_list.txt| viable_txt

    MD -->|Processed receptors| merger
    viable_txt -->|Inputs viable poses| merger
    merger -->|Produces merged complexes| merged_complex

    AF3 -->|Reference structures| rmsd
    merged_complex -->|Compute RMSD| rmsd
    rmsd -->|Outputs RMSD_report.csv| rmsd_report

    %% Click Events for Scripts
    click find_empty "https://github.com/abdollahegazy/comp_dock/blob/main/find_empty_ligand.py"
    click most_viable "https://github.com/abdollahegazy/comp_dock/blob/main/most_viable.py"
    click merger "https://github.com/abdollahegazy/comp_dock/blob/main/merger.py"
    click rmsd "https://github.com/abdollahegazy/comp_dock/blob/main/rmsd_test.py"

    %% Styles
    classDef input fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef process fill:#98FB98,stroke:#000,stroke-width:1px;
    classDef artifact fill:#FFA500,stroke:#000,stroke-width:1px;
```
