Skip to content

Repository files navigation

MicrobioLab

AI-powered synthetic microbiome design platform. From natural language to synthesizable microbial communities in minutes.

Built on Evo 2 (Arc Institute, 40B parameter DNA foundation model).


What it does

You describe what you want a microbial community to do. MicrobioLab returns:

  • Complete genome sequences (FASTA) for each strain
  • Stability simulation (30/60/90-day predictions with Bayesian confidence intervals)
  • Safety report (pathogenicity screening, BSL classification, HGT risk)
  • Synthesis cost estimate (Twist Bioscience pricing)

Example input:

"Design a stable 4-strain soil consortium that fixes atmospheric nitrogen at >60% efficiency of synthetic fertilizer, tolerates pH 5.5-7.5 clay soils, budget under $800, no BSL-2+ organisms."


Repo structure

microbiolab/
├── backend/                  Python — FastAPI + pipeline
│   ├── api/                  FastAPI server + job queue
│   ├── pipeline/             LangGraph agent pipeline (4 nodes)
│   │   └── nodes/            planner, generator, simulator, validator
│   ├── gnn/                  GNN stability simulator
│   │   ├── data/             Schema, synthetic data, PyG dataset
│   │   ├── model/            4-layer GAT (PyTorch Geometric)
│   │   └── training/         Training script + WandB
│   ├── finetune/             Evo 2 LoRA fine-tuning (6 verticals)
│   ├── data/
│   │   ├── kegg/             KEGG REST API client + ETL
│   │   ├── mgnify/           MGnify API client + ETL
│   │   └── corpus/           Unified corpus builder
│   ├── db/                   Supabase client + auth middleware
│   ├── synthesis/            Synthesis provider integration
│   └── utils/                Output formatting (FASTA, JSON, report)
├── frontend/                 Next.js — web UI
│   ├── app/
│   │   ├── page.tsx          Design input + constraint sliders
│   │   ├── design/[id]/      Results dashboard
│   │   ├── history/          Past designs
│   │   └── auth/             Login + signup
│   ├── components/           Nav
│   └── lib/                  API client + Supabase helpers
├── supabase/
│   ├── migrations/           SQL schema (run once in Supabase dashboard)
│   └── SETUP.md              Step-by-step Supabase setup guide
├── scripts/
│   ├── run_design.py         CLI — run a design locally
│   └── serve.py              Start the FastAPI server
└── tests/                    166 tests across all backend modules

Quickstart

Backend

# Install Python deps
pip install -r requirements.txt

# Configure
cp .env.example .env
# Add ANTHROPIC_API_KEY for LLM-powered planning
# Leave USE_EVO2=false for mock mode (no GPU needed)

# Run a design via CLI
python scripts/run_design.py --example soil
python scripts/run_design.py --example gut

# Start the API server
python scripts/serve.py
# → http://localhost:8000
# → http://localhost:8000/docs  (interactive API docs)

Frontend

cd frontend
npm install
cp .env.example .env.local
# Set NEXT_PUBLIC_API_URL=http://localhost:8000
npm run dev
# → http://localhost:3000

API usage (curl)

# Submit a design job
curl -X POST http://localhost:8000/api/design \
  -H "Content-Type: application/json" \
  -d '{"goal": "4-strain nitrogen-fixing soil consortium", "constraints": {"budget_usd": 800, "max_bsl": 1}}'
# → {"job_id": "...", "status": "pending"}

# Poll for results
curl http://localhost:8000/api/jobs/{job_id}

# Download FASTA sequences
curl http://localhost:8000/api/jobs/{job_id}/fasta --output design.zip

# Get text report
curl http://localhost:8000/api/jobs/{job_id}/report

Google Colab (GPU)

!git clone https://github.com/YOUR_USERNAME/microbiolab.git
%cd microbiolab
!pip install -r requirements.txt
!pip install pyngrok

# Expose API with public URL
from pyngrok import ngrok
import subprocess
proc = subprocess.Popen(["python", "scripts/serve.py", "--no-reload"])
public_url = ngrok.connect(8000)
print(f"API: {public_url}")
# Paste this URL into frontend/.env.local as NEXT_PUBLIC_API_URL

Environment variables

Backend (.env)

Variable Default Description
ANTHROPIC_API_KEY Claude API key (LLM-powered Planner)
USE_EVO2 false true to use real Evo 2 (GPU required)
EVO2_MODEL arcinstitute/evo2-7b Evo 2 variant
USE_GNN false true to use trained GNN (needs checkpoint)
GNN_WEIGHTS_PATH Path to checkpoints/best_model.pt
SUPABASE_URL Supabase project URL
SUPABASE_KEY Supabase anon key

Frontend (frontend/.env.local)

Variable Description
NEXT_PUBLIC_API_URL Backend URL (e.g. http://localhost:8000 or ngrok URL)
NEXT_PUBLIC_SUPABASE_URL Supabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase anon key

Supabase setup

See supabase/SETUP.md for step-by-step instructions. Takes ~10 minutes.

Short version:

  1. Create project at supabase.com
  2. Run supabase/migrations/001_initial_schema.sql in the SQL editor
  3. Copy URL + anon key into .env and frontend/.env.local
  4. pip install supabase (backend) — frontend uses @supabase/supabase-js (already in package.json)

GNN training

# Synthetic data only (no network, fast)
python -m backend.gnn.training.train --n-samples 20000 --epochs 100 --save-dir checkpoints/

# Build real corpus from KEGG + MGnify (requires network, run once)
python -m backend.data.corpus.build --output data/corpus/corpus.npz

# Train on real corpus
python -m backend.gnn.training.train --data-path data/corpus/corpus.npz --epochs 100

LoRA fine-tuning (GPU required)

python backend/finetune/train.py --model arcinstitute/evo2-7b --save-dir checkpoints/lora/

Supported verticals

Vertical Token Focus
Agriculture [AGRICULTURE] Soil inoculants, N-fixation, biocontrol
Pharmaceutical [PHARMACEUTICAL] Gut LBPs, IBD, butyrate production
Biomanufacturing [BIOMANUFACTURING] Biofuels, specialty chemicals
Environmental [ENVIRONMENTAL] PFAS/hydrocarbon remediation
Food & Beverage [FOOD_BEVERAGE] Starter cultures, fermentation
Animal Health [ANIMAL_HEALTH] Livestock gut, aquaculture

Tests

pytest tests/ -v           # all 166 tests
pytest tests/test_api.py   # API layer
pytest tests/test_gnn.py   # GNN data pipeline
pytest tests/test_db.py    # database layer

Deployment

  • BackendRailway or Modal (GPU for Evo 2)
  • FrontendVercel (connect GitHub repo, set env vars, deploy)

Set NEXT_PUBLIC_API_URL in Vercel to your Railway backend URL.


Built at University of Illinois Urbana-Champaign · March 2026

About

AI-powered synthetic microbiome design platform. From natural language to synthesizable microbial communities in minutes. Built on Evo 2 (Arc Institute, 40B parameter DNA foundation model).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages