# mwasifanwar/biosynther architecture

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

- Interactive diagram: https://gitdiagram.com/mwasifanwar/biosynther
- Repository: https://github.com/mwasifanwar/biosynther

## Overview

##### Project Type and Purpose
- BioSynther is a Python-based CLI/library tool—a generative AI pipeline for designing synthetic biological circuits and organisms.
- Its use cases include environmental cleanup, medicine production, and sustainable manufacturing.

##### File Structure
Top-level entry points and directories:
- design_organism.py & train_generator.py – CLI scripts or orchestration.
- src/ – core pipeline modules:
– circuit_designer.py
– dna_generator.py
– protein_designer.py
– metabolic_engine.py
– fitness_evaluator.py
– config.py
– utils/ (bioinformatics.py, chemistry.py)
- models/ – machine-learning or generative models (empty init suggests future extensibility).
- tests/ – unit tests for dna generation and metabolic engineering.
- setup.py & requirements.txt – packaging and dependencies.

##### README
– “Generative AI system” emphasizes a multi-stage pipeline driven by AI/ML.
– No frontend; interactions occur via CLI or library calls.

##### Main Components and Their Interactions
a. Entry Points
- design_organism.py – user invokes full design pipeline.
- train_generator.py – trains or fine-tunes generative models.
b. Configuration Loader
- src/config.py – reads parameters (target pathways, organism constraints).
c. Generation Modules (Design Stage)
- dna_generator.py – proposes DNA sequences.
- protein_designer.py – translates sequences into protein structures.
d. Simulation & Evaluation
- metabolic_engine.py – simulates metabolic pathways in silico.
- fitness_evaluator.py – scores or ranks designs against objectives.
e. Circuit Composition
- circuit_designer.py – combines high-scoring elements into a final circuit.
f. Utilities & Models
- src/utils/bioinformatics.py & chemistry.py – shared helpers (format conversions, scoring functions).
- models/ – stores trained generative or predictive models.
g. Tests
- tests/ – validate correctness of key modules.

##### Architectural Patterns and Principles
– Pipeline/chain of responsibility: data flows sequentially through generation → simulation → evaluation → assembly.
– Modular separation: each domain (DNA, protein, metabolism, fitness, circuit) is a standalone component.
– Layered utilities: common helpers abstract bioinformatics and chemical operations.
– Extensibility: models/ and utils/ allow plugging in new algorithms or ML models.

User CLI → Config → DNA Generator → Protein Designer → Metabolic Engine → Fitness Evaluator → Circuit Designer → Output
c. Off to the side, show:
– models/ as a data store that both dna_generator.py and train_generator.py read from/write to.
– utils/ as a shared library used by all core modules.
– tests/ as a separate validation layer (can be depicted beneath core pipeline).
– Orchestration (CLI scripts)
– Core pipeline modules
– Utility libraries
– Data/model repositories
– Testing components
f. Technologies: Python, any key libraries from requirements.txt (e.g., TensorFlow/PyTorch if present), JSON/YAML for config, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    design["design_organism.py"]:::orchestration
    train["train_generator.py"]:::orchestration

    config["src/config.py"]:::config

    dna["src/dna_generator.py"]:::core
    protein["src/protein_designer.py"]:::core
    metabolic["src/metabolic_engine.py"]:::core
    fitness["src/fitness_evaluator.py"]:::core
    circuit["src/circuit_designer.py"]:::core

    subgraph "Utilities"
        bioinfo["src/utils/bioinformatics.py"]:::util
        chem["src/utils/chemistry.py"]:::util
    end

    models["models/"]:::data

    subgraph "Tests"
        testdna["tests/test_dna_generation.py"]:::test
        testmet["tests/test_metabolic_engineering.py"]:::test
    end

    design --> config
    train --> config
    train --> models
    config --> dna
    dna --> protein
    protein --> metabolic
    metabolic --> fitness
    fitness --> circuit

    models --> dna
    models --> train

    bioinfo -->|helpers| dna
    bioinfo -->|helpers| protein
    bioinfo -->|helpers| metabolic
    bioinfo -->|helpers| fitness
    bioinfo -->|helpers| circuit

    chem -->|helpers| dna
    chem -->|helpers| protein
    chem -->|helpers| metabolic
    chem -->|helpers| fitness
    chem -->|helpers| circuit

    circuit -->|"Generates Output"| output["Final Circuit Output"]

    testdna -.-> dna
    testmet -.-> metabolic

    click design "https://github.com/mwasifanwar/biosynther/blob/main/design_organism.py"
    click train "https://github.com/mwasifanwar/biosynther/blob/main/train_generator.py"
    click config "https://github.com/mwasifanwar/biosynther/blob/main/src/config.py"
    click dna "https://github.com/mwasifanwar/biosynther/blob/main/src/dna_generator.py"
    click protein "https://github.com/mwasifanwar/biosynther/blob/main/src/protein_designer.py"
    click metabolic "https://github.com/mwasifanwar/biosynther/blob/main/src/metabolic_engine.py"
    click fitness "https://github.com/mwasifanwar/biosynther/blob/main/src/fitness_evaluator.py"
    click circuit "https://github.com/mwasifanwar/biosynther/blob/main/src/circuit_designer.py"
    click bioinfo "https://github.com/mwasifanwar/biosynther/blob/main/src/utils/bioinformatics.py"
    click chem "https://github.com/mwasifanwar/biosynther/blob/main/src/utils/chemistry.py"
    click models "https://github.com/mwasifanwar/biosynther/tree/main/models/"
    click testdna "https://github.com/mwasifanwar/biosynther/blob/main/tests/test_dna_generation.py"
    click testmet "https://github.com/mwasifanwar/biosynther/blob/main/tests/test_metabolic_engineering.py"

    classDef orchestration fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef core fill:#90EE90,stroke:#000,stroke-width:1px
    classDef util fill:#FFA500,stroke:#000,stroke-width:1px
    classDef config fill:#FFFF99,stroke:#000,stroke-width:1px
    classDef data fill:#FFC0CB,stroke:#000,stroke-width:1px
    classDef test fill:#D3D3D3,stroke:#000,stroke-width:1px
```
