# kalralab/plexcal architecture

> Architecture diagram of the GitHub repository kalralab/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/kalralab/plexcal
- Repository: https://github.com/kalralab/plexcal

## Overview

PLEXCAL is a protein-structure analysis application that calculates FRET- and DET-based diffusion metrics from PDB structures. The principal web workflow accepts an uploaded structure or retrieves one by structure identifier, then invokes the calculation models and returns results; metadata lookup is a separate capability. A batch runner processes PDB files and writes CSV output. The README provides no further capability details, and the UI and some server implementation were not excerpted, so those connections are left unverified.

Main entry points: [`server.py`](https://github.com/kalralab/plexcal/blob/main/server.py) (HTTP API), [`process_all_pdbs.py`](https://github.com/kalralab/plexcal/blob/main/process_all_pdbs.py) (Batch runner), [`index.html`](https://github.com/kalralab/plexcal/blob/main/index.html) (Web UI), [`process_single_pdb.py`](https://github.com/kalralab/plexcal/blob/main/process_single_pdb.py) (FRET model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_web_ui["Web UI<br/>[index.html]"]
  node_web_style["Web styling<br/>[style.css]"]
  node_http_server["HTTP API<br/>[server.py]"]
  node_web_results["Calculation response<br/>[server.py]"]
end

subgraph group_inputs["Structure inputs"]
  node_structure_upload["Structure upload<br/>[server.py]"]
  node_structure_lookup["Structure retrieval<br/>[server.py]"]
  node_metadata_lookup["Metadata lookup<br/>[server.py]"]
  node_pdb_data["PDB structure"]
end

subgraph group_analysis["Diffusion analysis"]
  node_fret["FRET model"]
  node_det["DET model<br/>[det_code_clean.py]"]
end

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

node_user(("User"))
node_rcsb["RCSB PDB"]
node_alphafold["AlphaFold DB"]

node_user -.->|"uses"| node_web_ui
node_web_ui -.->|"sends requests"| node_http_server
node_http_server -->|"routes uploads"| node_structure_upload
node_http_server -->|"downloads structures"| node_structure_lookup
node_structure_lookup -->|"queries"| node_rcsb
node_structure_lookup -->|"queries"| node_alphafold
node_structure_lookup -->|"returns PDB"| node_pdb_data
node_http_server -->|"routes metadata"| node_metadata_lookup
node_metadata_lookup -->|"queries metadata"| node_rcsb
node_metadata_lookup -->|"queries metadata"| node_alphafold
node_http_server -->|"invokes"| node_fret
node_http_server -->|"invokes"| node_det
node_http_server -->|"returns results"| node_web_results
node_batch_runner -->|"runs FRET"| node_fret
node_batch_runner -->|"runs DET"| node_det
node_batch_runner -->|"writes CSV"| node_csv_results
node_web_ui -.->|"uses styles"| node_web_style

click node_web_ui "https://github.com/kalralab/plexcal/blob/main/index.html"
click node_web_style "https://github.com/kalralab/plexcal/blob/main/style.css"
click node_http_server "https://github.com/kalralab/plexcal/blob/main/server.py"
click node_structure_upload "https://github.com/kalralab/plexcal/blob/main/server.py"
click node_structure_lookup "https://github.com/kalralab/plexcal/blob/main/server.py"
click node_metadata_lookup "https://github.com/kalralab/plexcal/blob/main/server.py"
click node_fret "https://github.com/kalralab/plexcal/blob/main/process_single_pdb.py"
click node_det "https://github.com/kalralab/plexcal/blob/main/det_code_clean.py"
click node_web_results "https://github.com/kalralab/plexcal/blob/main/server.py"
click node_batch_runner "https://github.com/kalralab/plexcal/blob/main/process_all_pdbs.py"
click node_csv_results "https://github.com/kalralab/plexcal/blob/main/process_all_pdbs.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_web_ui,node_web_style,node_http_server,node_web_results,node_user toneBlue
class node_structure_upload,node_structure_lookup,node_metadata_lookup,node_pdb_data toneAmber
class node_fret,node_det toneMint
class node_batch_runner,node_csv_results toneRose
class node_rcsb,node_alphafold toneIndigo
```

## Components

### Web interface

- [Web UI](https://github.com/kalralab/plexcal/blob/main/index.html): `index.html`
- [Web styling](https://github.com/kalralab/plexcal/blob/main/style.css): `style.css`
- [HTTP API](https://github.com/kalralab/plexcal/blob/main/server.py): `server.py`
- [Calculation response](https://github.com/kalralab/plexcal/blob/main/server.py): `server.py`

### Structure inputs

- [Structure upload](https://github.com/kalralab/plexcal/blob/main/server.py): `server.py`
- [Structure retrieval](https://github.com/kalralab/plexcal/blob/main/server.py): `server.py`
- [Metadata lookup](https://github.com/kalralab/plexcal/blob/main/server.py): `server.py`
- **PDB structure**

### Diffusion analysis

- [FRET model](https://github.com/kalralab/plexcal/blob/main/process_single_pdb.py): `process_single_pdb.py`
- [DET model](https://github.com/kalralab/plexcal/blob/main/det_code_clean.py): `det_code_clean.py`

### Batch processing

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

### Other components

- **User**
- **RCSB PDB**
- **AlphaFold DB**

## Connections

- User → Web UI: uses
- Web UI → HTTP API: sends requests
- HTTP API → Structure upload: routes uploads (evidence: `server.py`)
- HTTP API → Structure retrieval: downloads structures (evidence: `server.py`)
- Structure retrieval → RCSB PDB: queries (evidence: `server.py`)
- Structure retrieval → AlphaFold DB: queries (evidence: `server.py`)
- Structure retrieval → PDB structure: returns PDB (evidence: `server.py`)
- HTTP API → Metadata lookup: routes metadata (evidence: `server.py`)
- Metadata lookup → RCSB PDB: queries metadata (evidence: `server.py`)
- Metadata lookup → AlphaFold DB: queries metadata (evidence: `server.py`)
- HTTP API → FRET model: invokes (evidence: `server.py`)
- HTTP API → DET model: invokes (evidence: `server.py`)
- HTTP API → Calculation response: returns results (evidence: `server.py`)
- Batch runner → FRET model: runs FRET (evidence: `process_all_pdbs.py`)
- Batch runner → DET model: runs DET (evidence: `process_all_pdbs.py`)
- Batch runner → Results CSV: writes CSV (evidence: `process_all_pdbs.py`)
- Web UI → Web styling: uses styles
