# ievapudz/temstapro architecture

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

- Interactive diagram: https://gitdiagram.com/ievapudz/temstapro
- Repository: https://github.com/ievapudz/temstapro

## Overview

TemStaPro predicts protein thermostability from FASTA sequences using ProtTrans embeddings and an ensemble of threshold classifiers. Its principal workflow runs from sequence parsing through embedding generation and inference to temperature labels, clash indicators, and TSV output. It also supports cached embeddings, per-residue and per-segment predictions, plots, and NPZ embedding loading. The CLI and some orchestration details are unsampled; the README documents the user workflow, while source excerpts show the individual processing and inference components.

Main entry points: [`temstapro`](https://github.com/ievapudz/temstapro/blob/main/temstapro) (CLI runner), [`prottrans_models.py`](https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py) (ProtTrans model), [`model_flow.py`](https://github.com/ievapudz/temstapro/blob/main/model_flow.py) (Ensemble inference), [`results.py`](https://github.com/ievapudz/temstapro/blob/main/results.py) (Label and clash interpretation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Input and embeddings"]
  node_sequence["FASTA parsing"]
  node_prottrans["ProtTrans model"]
  node_cache[("Embedding cache")]
  node_embedding_data["Embedding preparation<br/>[data_process.py]"]
  node_npz["NPZ loading<br/>[data_process.py]"]
end

subgraph group_prediction["Prediction"]
  node_inference["Ensemble inference<br/>[model_flow.py]"]
  node_classifier["MLP classifier<br/>[MLP.py]"]
end

subgraph group_output["Results"]
  node_interpretation["Label and clash interpretation<br/>[results.py]"]
  node_tables["Prediction TSV<br/>[results.py]"]
  node_plots["Prediction plots<br/>[results.py]"]
end

node_user(("Researcher"))
node_cli["CLI runner"]

node_user -->|"runs"| node_cli
node_cli -->|"provides FASTA"| node_sequence
node_sequence -.->|"supplies sequences"| node_prottrans
node_cli -->|"requests embeddings"| node_prottrans
node_prottrans -->|"saves embeddings"| node_cache
node_cache -->|"loads cached tensors"| node_embedding_data
node_npz -->|"loads tensors"| node_embedding_data
node_cli -->|"runs predictions"| node_inference
node_inference -->|"evaluates models"| node_classifier
node_cli -->|"interprets predictions"| node_interpretation
node_interpretation -->|"writes results"| node_tables
node_cli -->|"requests plots"| node_plots

click node_cli "https://github.com/ievapudz/temstapro/blob/main/temstapro"
click node_sequence "https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py"
click node_prottrans "https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py"
click node_cache "https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py"
click node_embedding_data "https://github.com/ievapudz/temstapro/blob/main/data_process.py"
click node_npz "https://github.com/ievapudz/temstapro/blob/main/data_process.py"
click node_inference "https://github.com/ievapudz/temstapro/blob/main/model_flow.py"
click node_classifier "https://github.com/ievapudz/temstapro/blob/main/MLP.py"
click node_interpretation "https://github.com/ievapudz/temstapro/blob/main/results.py"
click node_tables "https://github.com/ievapudz/temstapro/blob/main/results.py"
click node_plots "https://github.com/ievapudz/temstapro/blob/main/results.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_sequence,node_prottrans,node_cache,node_embedding_data,node_npz toneBlue
class node_inference,node_classifier toneAmber
class node_interpretation,node_tables,node_plots toneMint
class node_user toneIndigo
class node_cli toneTeal
```

## Components

### Input and embeddings

- [FASTA parsing](https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py): `prottrans_models.py`
- [ProtTrans model](https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py): `prottrans_models.py`
- [Embedding cache](https://github.com/ievapudz/temstapro/blob/main/prottrans_models.py): `prottrans_models.py`
- [Embedding preparation](https://github.com/ievapudz/temstapro/blob/main/data_process.py): `data_process.py`
- [NPZ loading](https://github.com/ievapudz/temstapro/blob/main/data_process.py): `data_process.py`

### Prediction

- [Ensemble inference](https://github.com/ievapudz/temstapro/blob/main/model_flow.py): `model_flow.py`
- [MLP classifier](https://github.com/ievapudz/temstapro/blob/main/MLP.py): `MLP.py`

### Results

- [Label and clash interpretation](https://github.com/ievapudz/temstapro/blob/main/results.py): `results.py`
- [Prediction TSV](https://github.com/ievapudz/temstapro/blob/main/results.py): `results.py`
- [Prediction plots](https://github.com/ievapudz/temstapro/blob/main/results.py): `results.py`

### Other components

- **Researcher**
- [CLI runner](https://github.com/ievapudz/temstapro/blob/main/temstapro): `temstapro`

## Connections

- Researcher → CLI runner: runs (evidence: `README.md`)
- CLI runner → FASTA parsing: provides FASTA (evidence: `README.md`)
- FASTA parsing → ProtTrans model: supplies sequences (evidence: `prottrans_models.py`)
- CLI runner → ProtTrans model: requests embeddings (evidence: `README.md`)
- ProtTrans model → Embedding cache: saves embeddings (evidence: `prottrans_models.py`)
- Embedding cache → Embedding preparation: loads cached tensors (evidence: `data_process.py`)
- NPZ loading → Embedding preparation: loads tensors (evidence: `data_process.py`)
- CLI runner → Ensemble inference: runs predictions (evidence: `README.md`)
- Ensemble inference → MLP classifier: evaluates models (evidence: `model_flow.py`)
- CLI runner → Label and clash interpretation: interprets predictions (evidence: `README.md`)
- Label and clash interpretation → Prediction TSV: writes results (evidence: `results.py`)
- CLI runner → Prediction plots: requests plots (evidence: `README.md`)
