# redomic/neuthera-drug-discovery-toolkit architecture

> Architecture diagram of the GitHub repository redomic/neuthera-drug-discovery-toolkit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redomic/neuthera-drug-discovery-toolkit
- Repository: https://github.com/redomic/neuthera-drug-discovery-toolkit

## Overview

##### Project type and purpose
- NeuThera is a full-stack, modular AI-driven drug discovery toolkit. It blends data ingestion, multiple ML model services (TamGen, DeepPurpose, chemBERTa, a DTI predictor), external scientific tools (AutoDock, MMseqs2), a graph database (ArangoDB), and an interactive UI (Streamlit + Jupyter notebook).
- Its goal: end-to-end and interactive drug candidate generation, validation (docking + affinity prediction), embedding/indexing, retrieval, and lead optimization.

##### File structure
- Top level:
- app.py, start.ipynb, Streamlit config (.streamlit/) → interactive frontend & notebook
- docker-compose.yml → ArangoDB service
- data/ & database/ → raw molecular data, prebuilt caches
- DTI_model/, gpt_model/ → pretrained model artifacts
- TamGen/ → core generative model code & submodules (fairseq integration, molecule_utils, scripts, tests)
- preprocess.py, db.py, tools.py → orchestration & utility scripts
- scripts/ → shell/python helpers for data preparation, training, inference
- requirements.txt, setup.py → build & install

##### README for additional insights
- Core modules: TamGen (fairseq-based SMILES generator + docking), DeepPurpose (affinity prediction), chemBERTa (SMILES embeddings + vector indexing)
- Knowledge graph: ArangoDB holds entities & embeddings, vector index for similarity
- Workflow: preprocess → TamGen generate → docking → DeepPurpose score → chemBERTa embed → graph ingestion → retrieval/analytics → UI

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Layer"
        DataRaw["Raw Data\ndata/"]:::service
        DataCache["Prebuilt Caches\ndatabase/"]:::service
    end

    subgraph "Orchestration & Utilities"
        Preprocess["preprocess.py"]:::service
        DBUtils["db.py"]:::service
        Tools["tools.py"]:::service
        Scripts["Shell/Python Helpers\n(TamGen/scripts/)"]:::service
    end

    subgraph "Generative & Predictive Engines"
        subgraph TamGenService["TamGen Service"]
            TamGenCore["TamGen/\nfairseq + modules"]:::service
        end
        DTI["DTI Predictor\nDTI_model/"]:::service
        DeepPurpose["DeepPurpose"]:::service
        ChemBERTa["chemBERTa Embedding\ngpt_model/"]:::service
    end

    subgraph "External Bioinformatics Tools"
        AutoDock["AutoDock/SMINA"]:::external
        MMseqs2["MMseqs2"]:::external
    end

    subgraph "Persistence Layer"
        ArangoProvision["docker-compose.yml\n(ArangoDB Service)"]:::db
        GraphDB["ArangoDB\nGraph + Vector Index"]:::db
    end

    subgraph "UI & Notebook"
        StreamlitUI["Streamlit App\napp.py"]:::ui
        StreamlitConfig["Streamlit Config\n.streamlit/config.toml"]:::ui
        Notebook["Jupyter Notebook\nstart.ipynb"]:::ui
    end

    subgraph "CLI Interfaces"
        GenCLI["generate.py"]:::service
        TrainCLI["train.py"]:::service
        InteractiveCLI["interactive.py"]:::service
    end

    %% Connections
    DataRaw -->|provides raw data| Preprocess
    DataCache -->|provides caches| Preprocess
    Preprocess -->|clean data| Scripts
    Scripts -->|invoke| TamGenCore
    TamGenCore -->|SMILES| AutoDock
    AutoDock -->|docked structures| TamGenCore
    TamGenCore -->|SMILES| DeepPurpose
    DeepPurpose -->|affinity scores| ChemBERTa
    ChemBERTa -->|embeddings| GraphDB
    DeepPurpose -->|scores| GraphDB
    TamGenCore -->|generated SMILES| ChemBERTa
    DBUtils -->|writes/reads| GraphDB
    ArangoProvision -->|provisions| GraphDB
    StreamlitUI -->|queries| GraphDB
    Notebook -->|queries| GraphDB
    StreamlitUI -->|triggers| Preprocess
    Notebook -->|triggers| Scripts
    GenCLI -->|invokes| TamGenCore
    TrainCLI -->|invokes| TamGenCore
    InteractiveCLI -->|interactive mode| TamGenCore

    %% Click Events
    click DataRaw "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/data/"
    click DataCache "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/database/"
    click Preprocess "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/preprocess.py"
    click DBUtils "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/db.py"
    click Tools "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/tools.py"
    click Scripts "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/TamGen/scripts/"
    click TamGenCore "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/TamGen/"
    click DTI "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/DTI_model/"
    click ChemBERTa "https://github.com/redomic/neuthera-drug-discovery-toolkit/tree/main/gpt_model/"
    click AutoDock "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/TamGen/fairseq/molecule_utils/external_tools/autodock_smina.py"
    click MMseqs2 "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/TamGen/fairseq/molecule_utils/external_tools/mmseqs2.py"
    click ArangoProvision "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/docker-compose.yml"
    click StreamlitUI "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/app.py"
    click Notebook "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/start.ipynb"
    click StreamlitConfig "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/.streamlit/config.toml"
    click GenCLI "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/TamGen/generate.py"
    click TrainCLI "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/TamGen/train.py"
    click InteractiveCLI "https://github.com/redomic/neuthera-drug-discovery-toolkit/blob/main/TamGen/interactive.py"

    %% Styles
    classDef service fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef db fill:#90EE90,stroke:#333,stroke-width:1px
    classDef external fill:#FFD700,stroke:#333,stroke-width:1px
    classDef ui fill:#FFA500,stroke:#333,stroke-width:1px
```
