# kimj941002/pdbdatabase architecture

> Architecture diagram of the GitHub repository kimj941002/pdbdatabase, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kimj941002/pdbdatabase
- Repository: https://github.com/kimj941002/pdbdatabase

## Overview

Protein Construct Builder is a Streamlit application for selecting proteins, collecting UniProt and PDB data, and inspecting structures and related annotations. Its main user workflow runs from protein selection through structure collection to filtered results and export; it also offers database questions with Claude and saved chat history. The graph preserves the indexed fetchers and analysis modules as product capabilities. Some orchestration is outside the excerpts, so uncertain links are omitted rather than inferred.

Main entry points: [`app.py`](https://github.com/kimj941002/pdbdatabase/blob/main/app.py) (Builder UI), [`llm_query.py`](https://github.com/kimj941002/pdbdatabase/blob/main/llm_query.py) (AI Database Query), [`uniprot_fetcher.py`](https://github.com/kimj941002/pdbdatabase/blob/main/uniprot_fetcher.py) (Protein Fetcher), [`klifs_fetcher.py`](https://github.com/kimj941002/pdbdatabase/blob/main/klifs_fetcher.py) (KLIFS Fetcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application"]
  node_streamlit["Builder UI<br/>[app.py]"]
  node_legacy["Legacy UI"]
end

subgraph group_collect["Data Collection"]
  node_uniprot["Protein Fetcher<br/>[uniprot_fetcher.py]"]
  node_pdb["Structure Fetcher<br/>[pdb_fetcher.py]"]
  node_complex["Complex Fetcher<br/>[complex_fetcher.py]"]
  node_klifs["KLIFS Fetcher<br/>[klifs_fetcher.py]"]
end

subgraph group_analysis["Analysis and Enrichment"]
  node_mutation["Mutation Analyzer"]
  node_llm["AI Database Query<br/>[llm_query.py]"]
end

subgraph group_persist["Persistence and Queries"]
  node_database[("Protein Database<br/>[database.py]")]
  node_chat["Chat History<br/>[chat_store.py]"]
  node_config["API Configuration<br/>[config.py]"]
  node_utils["API Utilities<br/>[utils.py]"]
end

node_user(("User"))
node_uniprot_api["UniProt API"]
node_rcsb["RCSB APIs"]
node_klifs_api["KLIFS API"]
node_sifts["SIFTS API"]
node_anthropic["Anthropic API"]
node_sqlite[("SQLite")]

node_user -->|"uses"| node_streamlit
node_streamlit -->|"queries"| node_llm
node_streamlit -->|"collects structures"| node_pdb
node_uniprot -->|"fetches proteins"| node_uniprot_api
node_uniprot -->|"searches structures"| node_rcsb
node_pdb -->|"fetches structures"| node_rcsb
node_complex -->|"fetches complex data"| node_rcsb
node_klifs -->|"fetches kinase data"| node_klifs_api
node_klifs -->|"stores annotations"| node_database
node_mutation -->|"maps residues"| node_sifts
node_mutation -->|"reads and stores"| node_database
node_llm -->|"requests answers"| node_anthropic
node_llm -->|"runs SQL"| node_sqlite
node_chat -.->|"stores chats"| node_sqlite
node_streamlit -->|"saves chats"| node_chat

click node_streamlit "https://github.com/kimj941002/pdbdatabase/blob/main/app.py"
click node_legacy "https://github.com/kimj941002/pdbdatabase/blob/main/archive_legacy_code/snapshots/app_v1_streamlit_dataframe.py"
click node_uniprot "https://github.com/kimj941002/pdbdatabase/blob/main/uniprot_fetcher.py"
click node_pdb "https://github.com/kimj941002/pdbdatabase/blob/main/pdb_fetcher.py"
click node_complex "https://github.com/kimj941002/pdbdatabase/blob/main/complex_fetcher.py"
click node_klifs "https://github.com/kimj941002/pdbdatabase/blob/main/klifs_fetcher.py"
click node_mutation "https://github.com/kimj941002/pdbdatabase/blob/main/mutation_analyzer.py"
click node_llm "https://github.com/kimj941002/pdbdatabase/blob/main/llm_query.py"
click node_database "https://github.com/kimj941002/pdbdatabase/blob/main/database.py"
click node_chat "https://github.com/kimj941002/pdbdatabase/blob/main/chat_store.py"
click node_config "https://github.com/kimj941002/pdbdatabase/blob/main/config.py"
click node_utils "https://github.com/kimj941002/pdbdatabase/blob/main/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_streamlit,node_legacy,node_user toneBlue
class node_uniprot,node_pdb,node_complex,node_klifs,node_sqlite toneAmber
class node_mutation,node_llm,node_uniprot_api,node_rcsb,node_klifs_api,node_sifts,node_anthropic toneMint
class node_database,node_chat,node_config,node_utils toneRose
```

## Components

### Application

- [Builder UI](https://github.com/kimj941002/pdbdatabase/blob/main/app.py): `app.py`
- [Legacy UI](https://github.com/kimj941002/pdbdatabase/blob/main/archive_legacy_code/snapshots/app_v1_streamlit_dataframe.py): `archive_legacy_code/snapshots/app_v1_streamlit_dataframe.py`

### Data Collection

- [Protein Fetcher](https://github.com/kimj941002/pdbdatabase/blob/main/uniprot_fetcher.py): `uniprot_fetcher.py`
- [Structure Fetcher](https://github.com/kimj941002/pdbdatabase/blob/main/pdb_fetcher.py): `pdb_fetcher.py`
- [Complex Fetcher](https://github.com/kimj941002/pdbdatabase/blob/main/complex_fetcher.py): `complex_fetcher.py`
- [KLIFS Fetcher](https://github.com/kimj941002/pdbdatabase/blob/main/klifs_fetcher.py): `klifs_fetcher.py`

### Analysis and Enrichment

- [Mutation Analyzer](https://github.com/kimj941002/pdbdatabase/blob/main/mutation_analyzer.py): `mutation_analyzer.py`
- [AI Database Query](https://github.com/kimj941002/pdbdatabase/blob/main/llm_query.py): `llm_query.py`

### Persistence and Queries

- [Protein Database](https://github.com/kimj941002/pdbdatabase/blob/main/database.py): `database.py`
- [Chat History](https://github.com/kimj941002/pdbdatabase/blob/main/chat_store.py): `chat_store.py`
- [API Configuration](https://github.com/kimj941002/pdbdatabase/blob/main/config.py): `config.py`
- [API Utilities](https://github.com/kimj941002/pdbdatabase/blob/main/utils.py): `utils.py`

### Other components

- **User**
- **UniProt API**
- **RCSB APIs**
- **KLIFS API**
- **SIFTS API**
- **Anthropic API**
- **SQLite**

## Connections

- User → Builder UI: uses (evidence: `app.py`)
- Builder UI → AI Database Query: queries (evidence: `app.py`)
- Builder UI → Structure Fetcher: collects structures (evidence: `app.py`)
- Protein Fetcher → UniProt API: fetches proteins (evidence: `uniprot_fetcher.py`)
- Protein Fetcher → RCSB APIs: searches structures (evidence: `uniprot_fetcher.py`)
- Structure Fetcher → RCSB APIs: fetches structures (evidence: `pdb_fetcher.py`)
- Complex Fetcher → RCSB APIs: fetches complex data (evidence: `complex_fetcher.py`)
- KLIFS Fetcher → KLIFS API: fetches kinase data (evidence: `klifs_fetcher.py`)
- KLIFS Fetcher → Protein Database: stores annotations (evidence: `klifs_fetcher.py`)
- Mutation Analyzer → SIFTS API: maps residues (evidence: `mutation_analyzer.py`)
- Mutation Analyzer → Protein Database: reads and stores (evidence: `mutation_analyzer.py`)
- AI Database Query → Anthropic API: requests answers (evidence: `llm_query.py`)
- AI Database Query → SQLite: runs SQL (evidence: `llm_query.py`)
- Chat History → SQLite: stores chats
- Builder UI → Chat History: saves chats (evidence: `app.py`)
