# zhangzm0128/pcm-protein-structure-prediction architecture

> Architecture diagram of the GitHub repository zhangzm0128/pcm-protein-structure-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zhangzm0128/pcm-protein-structure-prediction
- Repository: https://github.com/zhangzm0128/pcm-protein-structure-prediction

## Overview

##### Project Type & Purpose
- The project is a specialized scientific computing application for protein structure prediction using a many-objective evolutionary algorithm (PCM).
- It integrates multiple energy functions (e.g., Charmm, dDFIRE, EDTSurf, TMscore, RWplus) and external binaries to evaluate candidate protein conformations.
- The algorithm focuses on optimizing conflicting energy functions by employing both Pareto-based archiving and a coordinated selection strategy.

##### Analyzing the File Structure
- Key top-level folders:
- bin: Contains external binary executables and parameter files (e.g., amino.dat, charmm27.prm) supporting energy evaluation functions.
- config: Holds JSON configuration files (PCM configuration, energy configuration, and protein configuration) necessary for initializing experiments.
- energy: Provides implementations of energy function calculations with modules like Charmm.py and energy.py. This is where energy evaluation logic resides.
- search: Contains the implementation of the many-objective evolutionary algorithm (MOEA.py) and the PCM-specific optimization strategy (PCM.py).
- utils: Offers helper functions for logging, handling protein data (ProteinUtils, protein_distance), and other utilities.
- main.py: Serves as the entry point that ties all modules together, handling configuration loading, workflow orchestration, and overall coordination.
- protein_structure: Stores the protein sequence files used as input data for prediction.
- logs: Used to record runtime information and debugging outputs.
- The clean separation between modules (energy, search, config, utils) indicates a design with clear separation of concerns.

##### Examining the README Insights
- The README provides a high-level view of the PCM framework and references an external image (framework.png) which likely outlines the flow, reinforcing the modular organization.
- It emphasizes the key roles of configuration inputs, external energy calculations, and the innovative search strategy using many-objective optimization.
- The provided usage example shows the orchestration: main.py loads various config files and then delegates to the search module and energy evaluation routines.

To accurately capture the architecture:
a. Main Components:
- Configuration Manager: Representing the config directory and JSON files (config_PCM_1ZDD.json, energy_config.json, protein_config.json).
- Input Data Layer: Protein sequence data housed under the protein_structure directory.
- Application Orchestrator: The main.py file that initializes the system.
- Search/Optimization Engine: The search module with key classes in MOEA.py and PCM.py responsible for the evolutionary algorithm. Emphasize the PCM module implementing the Pareto archive and coordinated selection strategy.
- Energy Evaluation Layer: The energy module (energy.py, Charmm.py) that integrates multiple energy function evaluations.
- External Binary Tools: The bin folder representing executables (EDTSurf, TMscore, dDFIRE, calRWplus, etc.) and their associated parameter files.
- Utility Modules: The utils folder (logging, distance calculations, protein processing) used across the project.
- Logging/Output: The logs folder collecting runtime information and possibly output data.

b. Relationships & Interactions:
- The Search Engine should in turn interact with the Energy Evaluation Layer to query energy values during the optimization loop.
- Utility Modules should be depicted as helper services that are accessed by both the Search Engine and Energy Evaluation for logging, data processing, and calculations.
- Finally, include output/log flows directed towards the logs component.

c. Architectural Patterns & Design Principles:
- Modularity via separate components (input/config, processing, evaluation, and logging).
- Separation of concerns: The optimization strategy (PCM) is decoupled from energy computations and external tool invocation.

d. Relevant Technologies & Frameworks:
- Python is the core language, leveraging standard modules for configuration parsing and numeric computation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CM["Configuration Manager\n(config/*.json)"]:::config
    ID["Input Data Layer\n(protein_structure)"]:::input
    MO["Application Orchestrator\n(main.py)"]:::orchestrator
    SE["Search Engine (PCM)\n(search/MOEA.py, search/PCM.py)"]:::search
    EE["Energy Evaluation Layer\n(energy/Charmm.py, energy/energy.py)"]:::energy
    EB["External Binary Tools\n(bin/*, bin/params)"]:::binaries
    UM["Utility Modules\n(utils/*)"]:::utils
    LO["Logging/Output\n(logs)"]:::logging

    %% Data Flow
    CM --> MO
    ID --> MO
    MO --> SE
    MO --> EE
    SE --> EE
    EE --> EB

    %% Utility Support (dotted lines)
    SE -.-> UM
    EE -.-> UM

    %% Logging
    MO --> LO
    SE --> LO
    EE --> LO

    %% Click Events
    click CM "https://github.com/zhangzm0128/pcm-protein-structure-prediction/blob/main/config/config_PCM_1ZDD.json"
    click ID "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/protein_structure"
    click MO "https://github.com/zhangzm0128/pcm-protein-structure-prediction/blob/main/main.py"
    click SE "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/search"
    click EE "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/energy"
    click EB "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/bin"
    click UM "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/utils"
    click LO "https://github.com/zhangzm0128/pcm-protein-structure-prediction/tree/main/logs"

    %% Styles
    classDef config fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef input fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef orchestrator fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef search fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef energy fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef binaries fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef utils fill:#fefefe,stroke:#ced4da,stroke-width:2px;
    classDef logging fill:#e8daef,stroke:#6f42c1,stroke-width:2px;
```
