# 310-ai/lib310 architecture

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

- Interactive diagram: https://gitdiagram.com/310-ai/lib310
- Repository: https://github.com/310-ai/lib310

## Overview

##### Main Components Identification

The system should be divided into these primary components:
- Core Library Components
- Database Integration
- Machine Learning Models
- Visualization Tools
- External Tools Integration

Use the following visual elements:
- Rounded rectangles: Sub-components
- Hexagons: External services/dependencies
- Blue: Core library components
- Green: Database related components
- Orange: Machine learning components
- Purple: External tools
- Yellow: Visualization components

##### Key Relationships to Highlight

- How the lazy_loader.py facilitates dynamic module loading
- Data flow from database queries to ML models
- Demonstrate how visualization components consume data from both ML and database layers
- Interaction between tools and core components

##### Implementation Details

**[External Services] ←→ [Database Layer] ←→ [Core Library] ←→ [Client Applications]**
- ↑
- [Machine Learning Models]

##### Technical Stack Indicators

- Python 3.x
- BigQuery
- Google Cloud Storage
- Machine Learning frameworks
- C++ components

Remember to include the two main workflows shown in the README:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External["External Services Layer"]
        BQ[("BigQuery")]
        GCS[("Google Cloud Storage")]
    end

    subgraph Core["Core Library Layer"]
        MainPkg["Main Package"]:::core
        DataMgmt["Data Management"]:::core
        Settings["Settings"]:::core
        LazyLoad["Lazy Loading"]:::core
    end

    subgraph DB["Database Layer"]
        DBCore["Database Core"]:::db
        BQCache["BigQuery Cache"]:::db
        DBClient["Database Client"]:::db
        GCSInt["GCS Integration"]:::db
        
        subgraph Models["Data Models"]
            InterModel["Interaction Model"]:::model
            SeqModel["Sequence Language Model"]:::model
        end
    end

    subgraph ML["Machine Learning Layer"]
        MLCore["ML Core"]:::ml
        GOA["GO Annotation"]:::ml
        LangModel["Language Model"]:::ml
        MLM["MLM Implementation"]:::ml
        MLIO["ML I/O Operations"]:::ml
    end

    subgraph Viz["Visualization Layer"]
        VizCore["Visualization Core"]:::viz
        DBViz["Database Visualization"]:::viz
        BubbleChart["Bubble Charts"]:::viz
        Repr["Representation"]:::viz
    end

    subgraph Tools["Tools Layer"]
        ToolsCore["Tools Core"]:::tool
        TMalign["TMalign"]:::tool
        TMscore["TMscore"]:::tool
        PDBTools["PDB Tools"]:::tool
        Clustering["Clustering"]:::tool
        TMInterface["TM Alignment Interface"]:::tool
    end

    %% Relationships
    BQ --> DBCore
    GCS --> GCSInt
    DBCore --> MainPkg
    MLCore --> MainPkg
    VizCore --> MainPkg
    ToolsCore --> MainPkg
    LazyLoad --> MainPkg
    Settings --> MainPkg
    DataMgmt --> MainPkg

    DBCore --> Models
    Models --> MLCore
    MLCore --> GOA
    MLCore --> LangModel
    MLCore --> MLM
    MLCore --> MLIO

    VizCore --> DBViz
    VizCore --> BubbleChart
    VizCore --> Repr

    ToolsCore --> TMalign
    ToolsCore --> TMscore
    ToolsCore --> PDBTools
    ToolsCore --> Clustering
    ToolsCore --> TMInterface

    %% Click Events
    click MainPkg "https://github.com/310-ai/lib310/tree/master/lib310/"
    click DataMgmt "https://github.com/310-ai/lib310/tree/master/lib310/data/"
    click Settings "https://github.com/310-ai/lib310/blob/master/lib310/_settings.py"
    click LazyLoad "https://github.com/310-ai/lib310/blob/master/lib310/lazy_loader.py"
    click DBCore "https://github.com/310-ai/lib310/tree/master/lib310/database/"
    click BQCache "https://github.com/310-ai/lib310/blob/master/lib310/database/cache_bgquery.py"
    click DBClient "https://github.com/310-ai/lib310/blob/master/lib310/database/client.py"
    click InterModel "https://github.com/310-ai/lib310/blob/master/lib310/database/models/InteractionModel.py"
    click SeqModel "https://github.com/310-ai/lib310/blob/master/lib310/database/models/SeqLangModel.py"
    click GCSInt "https://github.com/310-ai/lib310/blob/master/lib310/database/gcs_dataset.py"
    click MLCore "https://github.com/310-ai/lib310/tree/master/lib310/machinelearning/"
    click GOA "https://github.com/310-ai/lib310/blob/master/lib310/machinelearning/_goa.py"
    click LangModel "https://github.com/310-ai/lib310/blob/master/lib310/machinelearning/_lm.py"
    click MLM "https://github.com/310-ai/lib310/blob/master/lib310/machinelearning/_mlm.py"
    click MLIO "https://github.com/310-ai/lib310/blob/master/lib310/machinelearning/_io.py"
    click VizCore "https://github.com/310-ai/lib310/tree/master/lib310/visualization/"
    click DBViz "https://github.com/310-ai/lib310/blob/master/lib310/database/_visualize.py"
    click BubbleChart "https://github.com/310-ai/lib310/blob/master/lib310/database/charts/bubble_chart.py"
    click Repr "https://github.com/310-ai/lib310/blob/master/lib310/visualization/_repr.py"
    click ToolsCore "https://github.com/310-ai/lib310/tree/master/lib310/tools/"
    click TMalign "https://github.com/310-ai/lib310/blob/master/lib310/tools/TMalign.cpp"
    click TMscore "https://github.com/310-ai/lib310/blob/master/lib310/tools/TMscore.cpp"
    click PDBTools "https://github.com/310-ai/lib310/blob/master/lib310/tools/_pdb.py"
    click Clustering "https://github.com/310-ai/lib310/blob/master/lib310/tools/_clustering.py"
    click TMInterface "https://github.com/310-ai/lib310/blob/master/lib310/tools/_tmalign.py"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef db fill:#2ecc71,stroke:#27ae60,color:white
    classDef ml fill:#e67e22,stroke:#d35400,color:white
    classDef viz fill:#f1c40f,stroke:#f39c12,color:black
    classDef tool fill:#9b59b6,stroke:#8e44ad,color:white
    classDef model fill:#1abc9c,stroke:#16a085,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Database Components"]:::db
        L3["ML Components"]:::ml
        L4["Visualization"]:::viz
        L5["Tools"]:::tool
        L6["Models"]:::model
    end
```
