# neringi/protein-structure-viewe architecture

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

- Interactive diagram: https://gitdiagram.com/neringi/protein-structure-viewe
- Repository: https://github.com/neringi/protein-structure-viewe

## Overview

##### Main Components

A. Data Pipeline Components:
- Gene Data Collection System
- UniProt API Integration
- RCSB PDB Data Fetcher
- Data Storage System

B. Web Application Components:
- Flask Web Server
- Frontend Interface
- Mol* Viewer Integration
- File Storage System

##### Data Pipeline Flow (Top Section)
- Gene Files → Gene List Extractor → UniProt API → PDB ID Fetcher → PDB File Downloader

##### Storage Layer (Middle Section)
- gene_file_list.txt ←→ gene_pdb_dict.json ←→ PDB Files Storage

##### Web Application (Bottom Section)
- Flask Server ←→ Templates ←→ Mol* Viewer

##### Component Details

- External APIs (Hexagons):
- UniProt API
- RCSB API

- Data Processing Scripts (Rectangles):
- get_gene_list.py
- get_pbd_id_uniprot.py
- download_pdb.py
- load_pdb_ids_to_ps.py

- gene_file_list.txt
- gene_pdb_dict.json
- /web/pdb/ directory

- Web Components (Rounded Rectangles):
- Flask Application (app.py)
- HTML Templates
- Mol* Viewer

##### Additional Elements

Annotations for:
- File formats (.pdb, .json, .txt)
- API endpoints
- Key technologies (Flask, Mol*)
- Data transformation steps

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef api fill:#FFA07A,stroke:#333,stroke-width:2px
    classDef storage fill:#90EE90,stroke:#333,stroke-width:2px
    classDef processing fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef web fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef frontend fill:#FFE4B5,stroke:#333,stroke-width:2px

    %% Data Pipeline Section
    subgraph DataPipeline["Data Pipeline Layer"]
        GeneCollector["Gene Data Collection"]:::processing
        UniProtAPI["UniProt API"]:::api
        RCSBAPI["RCSB PDB API"]:::api
        PDBFetcher["PDB Data Fetcher"]:::processing
        DataLoader["Data Pipeline Loader"]:::processing
    end

    %% Storage Section
    subgraph StorageLayer["Storage Layer"]
        GeneList["Gene List Storage"]:::storage
        GenePDBMap["Gene-PDB Mapping"]:::storage
        PDBStorage["PDB Files Storage"]:::storage
    end

    %% Web Application Section
    subgraph WebApp["Web Application Layer"]
        FlaskServer["Flask Web Server"]:::web
        subgraph Templates["Frontend Templates"]
            MainPage["Main Page"]:::frontend
            SearchPage["Search Interface"]:::frontend
            ResultsPage["Results Display"]:::frontend
            ViewerPage["Mol* Viewer Interface"]:::frontend
        end
    end

    %% Relationships
    GeneCollector --> GeneList
    GeneCollector --> UniProtAPI
    UniProtAPI --> GenePDBMap
    RCSBAPI --> PDBFetcher
    PDBFetcher --> PDBStorage
    DataLoader --> PDBStorage
    
    GeneList --> FlaskServer
    GenePDBMap --> FlaskServer
    PDBStorage --> FlaskServer
    
    FlaskServer --> MainPage
    FlaskServer --> SearchPage
    FlaskServer --> ResultsPage
    FlaskServer --> ViewerPage

    %% Click Events
    click GeneCollector "https://github.com/neringi/protein-structure-viewe/blob/main/get_gene_list.py"
    click UniProtAPI "https://github.com/neringi/protein-structure-viewe/blob/main/get_pbd_id_uniprot.py"
    click PDBFetcher "https://github.com/neringi/protein-structure-viewe/blob/main/download_pdb.py"
    click DataLoader "https://github.com/neringi/protein-structure-viewe/blob/main/load_pdb_ids_to_ps.py"
    click FlaskServer "https://github.com/neringi/protein-structure-viewe/blob/main/web/app.py"
    click Templates "https://github.com/neringi/protein-structure-viewe/tree/main/web/templates"
    click ViewerPage "https://github.com/neringi/protein-structure-viewe/blob/main/web/templates/view_pdb.html"
    click PDBStorage "https://github.com/neringi/protein-structure-viewe/tree/main/web/pdb"
    click GeneList "https://github.com/neringi/protein-structure-viewe/blob/main/gene_file_list.txt"
    click GenePDBMap "https://github.com/neringi/protein-structure-viewe/blob/main/gene_pdb_dict.json"
    click MainPage "https://github.com/neringi/protein-structure-viewe/blob/main/web/templates/index.html"
    click SearchPage "https://github.com/neringi/protein-structure-viewe/blob/main/web/templates/search.html"
    click ResultsPage "https://github.com/neringi/protein-structure-viewe/blob/main/web/templates/result.html"

    %% Legend
    subgraph Legend
        API["API Service"]:::api
        PROC["Processing Component"]:::processing
        STORE["Storage Component"]:::storage
        WEBCOMP["Web Component"]:::web
        FRONT["Frontend Component"]:::frontend
    end
```
