# dhanumjayareddy/plexcal architecture

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

- Interactive diagram: https://gitdiagram.com/dhanumjayareddy/plexcal
- Repository: https://github.com/dhanumjayareddy/plexcal

## Overview

Plexcal is a structure-aware scientific application for viewing PDB structures and comparing FRET and DET diffusion-length calculations. The main workflow is: a user uploads a PDB or requests an RCSB/AlphaFold structure, previews it, then submits it for both calculations and views the metrics and charts. The repository also contains a separate static PDB-record lookup and a batch-calculation workflow. Server and browser excerpts establish the main API interactions; unsampled internals are represented only where the README documents their capabilities.

Main entry points: [`server.py`](https://github.com/dhanumjayareddy/plexcal/blob/main/server.py) (Local API server), [`fret_upload.js`](https://github.com/dhanumjayareddy/plexcal/blob/main/fret_upload.js) (Structure and results UI), [`process_all_pdbs.py`](https://github.com/dhanumjayareddy/plexcal/blob/main/process_all_pdbs.py) (Batch runner), [`github_pages.js`](https://github.com/dhanumjayareddy/plexcal/blob/main/github_pages.js) (Static lookup UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Structure workspace"]
  node_browser["Workspace interface<br/>[index.html]"]
  node_browser_logic["Structure and results UI<br/>[fret_upload.js]"]
  node_api["Local API server<br/>[server.py]"]
  node_pdb_input["PDB structure"]
  node_rcsb["RCSB PDB"]
  node_alphafold["AlphaFold DB"]
  node_molstar["PDBe Mol*"]
end

subgraph group_analysis["Diffusion analysis"]
  node_fret["FRET calculation"]
  node_det["DET calculation<br/>[det_code_clean.py]"]
  node_analysis_results["Metrics and charts<br/>[fret_upload.js]"]
end

subgraph group_static["Static record lookup"]
  node_lookup_ui["Static lookup UI<br/>[github_pages.js]"]
  node_manifest["Shard manifest<br/>[index.json]"]
  node_shards["PDB record shards"]
end

subgraph group_batch["Batch processing"]
  node_batch_runner["Batch runner"]
  node_csv_results["Batch CSV results"]
end

node_user(("User"))

node_user -->|"uses"| node_browser
node_browser -->|"runs"| node_browser_logic
node_browser_logic -->|"requests structure"| node_api
node_browser_logic -->|"submits analysis"| node_api
node_api -->|"accepts or downloads"| node_pdb_input
node_api -->|"fetches structures and metadata"| node_rcsb
node_api -->|"fetches models and metadata"| node_alphafold
node_browser_logic -->|"loads viewer"| node_molstar
node_api -->|"invokes"| node_fret
node_api -->|"invokes"| node_det
node_browser_logic -->|"renders results"| node_analysis_results
node_user -.->|"searches records"| node_lookup_ui
node_lookup_ui -->|"loads"| node_manifest
node_lookup_ui -->|"loads matching shard"| node_shards
node_user -->|"starts batch"| node_batch_runner
node_batch_runner -->|"runs per structure"| node_fret
node_batch_runner -->|"runs per structure"| node_det
node_batch_runner -->|"writes"| node_csv_results

click node_browser "https://github.com/dhanumjayareddy/plexcal/blob/main/index.html"
click node_browser_logic "https://github.com/dhanumjayareddy/plexcal/blob/main/fret_upload.js"
click node_api "https://github.com/dhanumjayareddy/plexcal/blob/main/server.py"
click node_fret "https://github.com/dhanumjayareddy/plexcal/blob/main/process_single_pdb.py"
click node_det "https://github.com/dhanumjayareddy/plexcal/blob/main/det_code_clean.py"
click node_analysis_results "https://github.com/dhanumjayareddy/plexcal/blob/main/fret_upload.js"
click node_batch_runner "https://github.com/dhanumjayareddy/plexcal/blob/main/process_all_pdbs.py"
click node_csv_results "https://github.com/dhanumjayareddy/plexcal/blob/main/process_all_pdbs.py"
click node_lookup_ui "https://github.com/dhanumjayareddy/plexcal/blob/main/github_pages.js"
click node_manifest "https://github.com/dhanumjayareddy/plexcal/blob/main/docs/data/index.json"
click node_shards "https://github.com/dhanumjayareddy/plexcal/tree/main/docs/data/shards"

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_browser,node_browser_logic,node_api,node_pdb_input,node_rcsb,node_alphafold,node_molstar,node_user toneBlue
class node_fret,node_det,node_analysis_results toneAmber
class node_lookup_ui,node_manifest,node_shards toneMint
class node_batch_runner,node_csv_results toneRose
```

## Components

### Structure workspace

- [Workspace interface](https://github.com/dhanumjayareddy/plexcal/blob/main/index.html): `index.html`
- [Structure and results UI](https://github.com/dhanumjayareddy/plexcal/blob/main/fret_upload.js): `fret_upload.js`
- [Local API server](https://github.com/dhanumjayareddy/plexcal/blob/main/server.py): `server.py`
- **PDB structure**
- **RCSB PDB**
- **AlphaFold DB**
- **PDBe Mol***

### Diffusion analysis

- [FRET calculation](https://github.com/dhanumjayareddy/plexcal/blob/main/process_single_pdb.py): `process_single_pdb.py`
- [DET calculation](https://github.com/dhanumjayareddy/plexcal/blob/main/det_code_clean.py): `det_code_clean.py`
- [Metrics and charts](https://github.com/dhanumjayareddy/plexcal/blob/main/fret_upload.js): `fret_upload.js`

### Static record lookup

- [Static lookup UI](https://github.com/dhanumjayareddy/plexcal/blob/main/github_pages.js): `github_pages.js`
- [Shard manifest](https://github.com/dhanumjayareddy/plexcal/blob/main/docs/data/index.json): `docs/data/index.json`
- [PDB record shards](https://github.com/dhanumjayareddy/plexcal/tree/main/docs/data/shards): `docs/data/shards`

### Batch processing

- [Batch runner](https://github.com/dhanumjayareddy/plexcal/blob/main/process_all_pdbs.py): `process_all_pdbs.py`
- [Batch CSV results](https://github.com/dhanumjayareddy/plexcal/blob/main/process_all_pdbs.py): `process_all_pdbs.py`

### Other components

- **User**

## Connections

- User → Workspace interface: uses (evidence: `README.md`)
- Workspace interface → Structure and results UI: runs (evidence: `README.md`)
- Structure and results UI → Local API server: requests structure (evidence: `fret_upload.js`)
- Structure and results UI → Local API server: submits analysis (evidence: `fret_upload.js`)
- Local API server → PDB structure: accepts or downloads (evidence: `server.py`)
- Local API server → RCSB PDB: fetches structures and metadata (evidence: `README.md`)
- Local API server → AlphaFold DB: fetches models and metadata (evidence: `README.md`)
- Structure and results UI → PDBe Mol*: loads viewer (evidence: `README.md`)
- Local API server → FRET calculation: invokes (evidence: `server.py`)
- Local API server → DET calculation: invokes (evidence: `server.py`)
- Structure and results UI → Metrics and charts: renders results (evidence: `fret_upload.js`)
- User → Static lookup UI: searches records (evidence: `github_pages.js`)
- Static lookup UI → Shard manifest: loads (evidence: `github_pages.js`)
- Static lookup UI → PDB record shards: loads matching shard (evidence: `github_pages.js`)
- User → Batch runner: starts batch (evidence: `README.md`)
- Batch runner → FRET calculation: runs per structure (evidence: `process_all_pdbs.py`)
- Batch runner → DET calculation: runs per structure (evidence: `process_all_pdbs.py`)
- Batch runner → Batch CSV results: writes (evidence: `process_all_pdbs.py`)
