# srichandra30/protein2smiles architecture

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

- Interactive diagram: https://gitdiagram.com/srichandra30/protein2smiles
- Repository: https://github.com/srichandra30/protein2smiles

## Overview

Protein2SMILES is a web application that predicts a molecular SMILES string from a protein sequence and returns a rendered structure image. The user enters a sequence in the React interface; its page submits it to Flask, which invokes the inference module and renders the returned string with RDKit. Inference uses a Transformer and the saved vocabularies and checkpoint. Source excerpts support this runtime flow; the tree also contains a training notebook, but its behavior is not sampled, so it is not mapped as a workflow.

Main entry points: [`prot2smil/backend/predict.py`](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/predict.py) (SMILES inference), [`prot2smil/frontend/src/pages/protein2smiles.jsx`](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/pages/protein2smiles.jsx) (Sequence form), [`prot2smil/backend/app.py`](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/app.py) (Flask API), [`prot2smil/frontend/src/App.jsx`](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/App.jsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["App shell<br/>[App.jsx]"]
  node_form["Sequence form<br/>[protein2smiles.jsx]"]
  node_result["SMILES and image<br/>[protein2smiles.jsx]"]
end

subgraph group_api["Prediction API"]
  node_flask["Flask API<br/>[app.py]"]
end

subgraph group_inference["Model inference"]
  node_predict["SMILES inference<br/>[predict.py]"]
  node_transformer["Transformer model<br/>[Transformer.py]"]
  node_protein_vocab["Protein vocabulary<br/>[protein-vocab.pt]"]
  node_smiles_vocab["SMILES vocabulary<br/>[smiles-vocab.pt]"]
  node_checkpoint["Model checkpoint<br/>[checkpoint.pth]"]
end

subgraph group_rendering["Structure rendering"]
  node_rdkit["RDKit"]
end

node_user(("User"))

node_user -->|"enters sequence"| node_form
node_entry -->|"renders"| node_app
node_app -->|"mounts"| node_form
node_form -->|"posts sequence"| node_flask
node_flask -->|"requests prediction"| node_predict
node_predict -->|"loads vocabulary"| node_protein_vocab
node_predict -->|"loads vocabulary"| node_smiles_vocab
node_predict -->|"loads weights"| node_checkpoint
node_predict -->|"runs generation"| node_transformer
node_flask -->|"renders molecule"| node_rdkit
node_flask -->|"returns JSON"| node_form
node_form -->|"displays result"| node_result

click node_entry "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/main.jsx"
click node_app "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/App.jsx"
click node_form "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/pages/protein2smiles.jsx"
click node_flask "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/app.py"
click node_predict "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/predict.py"
click node_transformer "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/models/Transformer.py"
click node_protein_vocab "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/utils/protein-vocab.pt"
click node_smiles_vocab "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/utils/smiles-vocab.pt"
click node_checkpoint "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/checkpoints/checkpoint.pth"
click node_result "https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/pages/protein2smiles.jsx"

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_entry,node_app,node_form,node_result,node_user toneBlue
class node_flask toneAmber
class node_predict,node_transformer,node_protein_vocab,node_smiles_vocab,node_checkpoint toneMint
class node_rdkit toneRose
```

## Components

### Web interface

- [React entry](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/main.jsx): `prot2smil/frontend/src/main.jsx`
- [App shell](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/App.jsx): `prot2smil/frontend/src/App.jsx`
- [Sequence form](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/pages/protein2smiles.jsx): `prot2smil/frontend/src/pages/protein2smiles.jsx`
- [SMILES and image](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/frontend/src/pages/protein2smiles.jsx): `prot2smil/frontend/src/pages/protein2smiles.jsx`

### Prediction API

- [Flask API](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/app.py): `prot2smil/backend/app.py`

### Model inference

- [SMILES inference](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/predict.py): `prot2smil/backend/predict.py`
- [Transformer model](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/models/Transformer.py): `prot2smil/backend/models/Transformer.py`
- [Protein vocabulary](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/utils/protein-vocab.pt): `prot2smil/backend/utils/protein-vocab.pt`
- [SMILES vocabulary](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/utils/smiles-vocab.pt): `prot2smil/backend/utils/smiles-vocab.pt`
- [Model checkpoint](https://github.com/srichandra30/protein2smiles/blob/main/prot2smil/backend/checkpoints/checkpoint.pth): `prot2smil/backend/checkpoints/checkpoint.pth`

### Structure rendering

- **RDKit**

### Other components

- **User**

## Connections

- User → Sequence form: enters sequence
- React entry → App shell: renders
- App shell → Sequence form: mounts
- Sequence form → Flask API: posts sequence
- Flask API → SMILES inference: requests prediction
- SMILES inference → Protein vocabulary: loads vocabulary
- SMILES inference → SMILES vocabulary: loads vocabulary
- SMILES inference → Model checkpoint: loads weights
- SMILES inference → Transformer model: runs generation
- Flask API → RDKit: renders molecule
- Flask API → Sequence form: returns JSON
- Sequence form → SMILES and image: displays result
