# phenolophthaleinum/phastdna architecture

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

- Interactive diagram: https://gitdiagram.com/phenolophthaleinum/phastdna
- Repository: https://github.com/phenolophthaleinum/phastdna

## Overview

##### Main Components
- CLI Interface: Represented by “phastdna.py” which users invoke with command-line options for both prediction and training.
- GUI/Web Interface: Represented by “phastDNA_gui.py” and supported by the “static” folder (containing assets like gsap.js, phastDNA_ui.css, task-*.html files, etc.). This component provides a local web server (likely via Flask or another lightweight framework) and serves as an accessible interface for non-expert users.
- Computational Core (fastDNA module): Located in the “fastDNA” directory, this component consists of both the core C/C++ source files (inside fastDNA/src) and Python bindings (inside fastDNA/python/fastDNA). It is optionally built and provides the optimized routines for running predictions/training.
- Data Management & I/O: Consider including components that manage datasets (like the Edwards et al. dataset) and handle input/output operations – guided by scripts like “learning.py”, “scoring.py”, and others that support data pre-/post-processing.
- Dependency & Build Layer: Include the “requirements.txt” and installation script “install.sh” which capture environmental dependencies. Also note build files (Makefile, MANIFEST.in, setup.cfg) for the fastDNA module.

##### Relationships and Interactions
- Both the CLI and GUI components act as entry points that capture user inputs. They then pass relevant data to the core logic.
- The application core (written in Python) processes inputs or controls the workflow (training or prediction) and, when required, delegates heavy computation or sequence analysis to the fastDNA module.
- The fastDNA module interacts through its Python bindings (in fastDNA/python/fastDNA) with the main Python application, exposing its computational routines.
- The GUI module uses static web assets to render a user-friendly interface and interacts with the local server’s endpoints.
- External datasets (such as the Edwards et al. dataset) and configuration parameters establish input/output data flow and resource management.

##### Architectural Patterns and Design Principles
- Layered Architecture: The separation between presentation (GUI/CLI), business logic (Python scripts), and the computational core (fastDNA) is clear.
- Separation of Concerns: Different directories and files are dedicated to independent functionalities (e.g., UI assets in “static”, computation in fastDNA, and Python logic in the root).
- Optional Integration: The fastDNA module is optional and built from source if needed, indicating a design that supports modular compilation and interfacing across languages.

##### Relevant Technologies and Libraries
- Python 3.8+ is the primary environment for the CLI and GUI.
- The fastDNA component’s C/C++ source files are compiled (using the provided Makefile) and then used via Python integration.
- Web technologies (HTML, CSS, JavaScript) are used for the GUI.
- Dependency management is handled by pip (dependencies specified in requirements.txt).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "User Interfaces"
        cli["CLI Interface"]:::interface
        gui["GUI/Web Interface"]:::interface
        static["Static Assets"]:::interface
    end

    coreLogic["Python Application Core"]:::core

    subgraph "Computational Core"
        comp1["C/C++ Source"]:::core
        comp2["Python Bindings"]:::core
    end

    subgraph "Data Management & I/O"
        learning["Learning"]:::data
        scoring["Scoring"]:::data
        taxonomy["Taxonomy"]:::data
        dataUtils["Utils"]:::data
    end

    subgraph "Dependency & Build"
        req["Requirements.txt"]:::deps
        install["Install Script"]:::deps
        makefile["Makefile"]:::deps
        setupcfg["setup.cfg"]:::deps
        manifest["MANIFEST.in"]:::deps
    end

    cli --> coreLogic
    gui --> coreLogic
    gui --> static
    coreLogic --> comp1
    coreLogic --> comp2
    coreLogic --> learning
    coreLogic --> scoring
    coreLogic --> taxonomy
    coreLogic --> dataUtils
    req --> coreLogic
    install --> comp1
    makefile --> comp1
    setupcfg --> comp1
    manifest --> comp1

    click cli "https://github.com/phenolophthaleinum/phastdna/blob/master/phastdna.py"
    click gui "https://github.com/phenolophthaleinum/phastdna/blob/master/phastDNA_gui.py"
    click static "https://github.com/phenolophthaleinum/phastdna/tree/master/static/"
    click comp1 "https://github.com/phenolophthaleinum/phastdna/tree/master/fastDNA/src/"
    click comp2 "https://github.com/phenolophthaleinum/phastdna/tree/master/fastDNA/python/fastDNA/"
    click learning "https://github.com/phenolophthaleinum/phastdna/blob/master/learning.py"
    click scoring "https://github.com/phenolophthaleinum/phastdna/blob/master/scoring.py"
    click taxonomy "https://github.com/phenolophthaleinum/phastdna/blob/master/taxonomy.py"
    click dataUtils "https://github.com/phenolophthaleinum/phastdna/blob/master/utils.py"
    click req "https://github.com/phenolophthaleinum/phastdna/blob/master/requirements.txt"
    click install "https://github.com/phenolophthaleinum/phastdna/blob/master/install.sh"
    click makefile "https://github.com/phenolophthaleinum/phastdna/tree/master/fastDNA/Makefile"
    click setupcfg "https://github.com/phenolophthaleinum/phastdna/blob/master/fastDNA/setup.cfg"
    click manifest "https://github.com/phenolophthaleinum/phastdna/blob/master/fastDNA/MANIFEST.in"

    classDef interface fill:#f9c,stroke:#333,stroke-width:2px;
    classDef core fill:#ccf,stroke:#333,stroke-width:2px;
    classDef data fill:#fc9,stroke:#333,stroke-width:2px;
    classDef deps fill:#cfc,stroke:#333,stroke-width:2px;
```
