derman-cell 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- derman_cell-0.1.0/.dockerignore +10 -0
- derman_cell-0.1.0/.gitignore +11 -0
- derman_cell-0.1.0/Dockerfile +16 -0
- derman_cell-0.1.0/PKG-INFO +251 -0
- derman_cell-0.1.0/README.md +204 -0
- derman_cell-0.1.0/docs/ARCHITECTURE.md +209 -0
- derman_cell-0.1.0/pyproject.toml +74 -0
- derman_cell-0.1.0/src/derman/__init__.py +4 -0
- derman_cell-0.1.0/src/derman/anndata_io.py +240 -0
- derman_cell-0.1.0/src/derman/auditor.py +446 -0
- derman_cell-0.1.0/src/derman/backend.py +448 -0
- derman_cell-0.1.0/src/derman/cli.py +1003 -0
- derman_cell-0.1.0/src/derman/decoder.py +227 -0
- derman_cell-0.1.0/src/derman/engine.py +125 -0
- derman_cell-0.1.0/src/derman/preprocessing.py +217 -0
- derman_cell-0.1.0/src/derman/regulons.py +192 -0
- derman_cell-0.1.0/src/derman/router.py +463 -0
- derman_cell-0.1.0/src/derman/schema.py +546 -0
- derman_cell-0.1.0/src/derman/screener.py +288 -0
- derman_cell-0.1.0/src/derman/sequencer.py +599 -0
- derman_cell-0.1.0/src/derman/server.py +474 -0
- derman_cell-0.1.0/src/derman/static/index.html +827 -0
- derman_cell-0.1.0/src/derman/template.py +154 -0
- derman_cell-0.1.0/tests/test_step1_engine.py +131 -0
- derman_cell-0.1.0/tests/test_step2_screener.py +60 -0
- derman_cell-0.1.0/tests/test_step3_auditor.py +100 -0
- derman_cell-0.1.0/tests/test_step4_sequencer.py +96 -0
- derman_cell-0.1.0/tests/test_step5_server_ui.py +104 -0
- derman_cell-0.1.0/uv.lock +2303 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
4
|
+
PYTHONUNBUFFERED=1 \
|
|
5
|
+
UV_NO_DEV=1
|
|
6
|
+
|
|
7
|
+
RUN pip install --no-cache-dir uv
|
|
8
|
+
|
|
9
|
+
WORKDIR /app
|
|
10
|
+
COPY pyproject.toml README.md ./
|
|
11
|
+
COPY src ./src
|
|
12
|
+
|
|
13
|
+
RUN uv pip install --system --no-cache ".[api]"
|
|
14
|
+
|
|
15
|
+
EXPOSE 8765
|
|
16
|
+
CMD ["derman", "serve", "--host", "0.0.0.0", "--port", "8765", "--backend", "mock"]
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: derman-cell
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: On-device virtual-cell perturbation, therapeutic-window selectivity, and causal calibration auditor for CellGemma
|
|
5
|
+
Author-email: Aslan Satary Dizaji <aslansatary@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Keywords: cellgemma,drug-discovery,gemma-4,perturbation-prediction,scientific-provenance,scrna-seq,single-cell,therapeutic-window
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: daftar>=1.3.1
|
|
10
|
+
Requires-Dist: numpy>=1.26
|
|
11
|
+
Requires-Dist: pydantic>=2.7
|
|
12
|
+
Requires-Dist: rich>=13.7
|
|
13
|
+
Requires-Dist: typer>=0.12
|
|
14
|
+
Provides-Extra: all
|
|
15
|
+
Requires-Dist: anndata>=0.10; extra == 'all'
|
|
16
|
+
Requires-Dist: fastapi>=0.115; extra == 'all'
|
|
17
|
+
Requires-Dist: h5py>=3.11; extra == 'all'
|
|
18
|
+
Requires-Dist: huggingface-hub>=0.25; extra == 'all'
|
|
19
|
+
Requires-Dist: llama-cpp-python>=0.3.1; extra == 'all'
|
|
20
|
+
Requires-Dist: ollama>=0.4.7; extra == 'all'
|
|
21
|
+
Requires-Dist: safetensors>=0.4.5; extra == 'all'
|
|
22
|
+
Requires-Dist: scipy>=1.13; extra == 'all'
|
|
23
|
+
Requires-Dist: uvicorn>=0.32; extra == 'all'
|
|
24
|
+
Provides-Extra: anndata
|
|
25
|
+
Requires-Dist: anndata>=0.10; extra == 'anndata'
|
|
26
|
+
Requires-Dist: h5py>=3.11; extra == 'anndata'
|
|
27
|
+
Requires-Dist: scipy>=1.13; extra == 'anndata'
|
|
28
|
+
Provides-Extra: api
|
|
29
|
+
Requires-Dist: fastapi>=0.115; extra == 'api'
|
|
30
|
+
Requires-Dist: uvicorn>=0.32; extra == 'api'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
35
|
+
Requires-Dist: safetensors>=0.4.5; extra == 'dev'
|
|
36
|
+
Provides-Extra: gguf
|
|
37
|
+
Requires-Dist: huggingface-hub>=0.25; extra == 'gguf'
|
|
38
|
+
Requires-Dist: llama-cpp-python>=0.3.1; extra == 'gguf'
|
|
39
|
+
Requires-Dist: safetensors>=0.4.5; extra == 'gguf'
|
|
40
|
+
Provides-Extra: mlx
|
|
41
|
+
Requires-Dist: huggingface-hub>=0.25; extra == 'mlx'
|
|
42
|
+
Requires-Dist: mlx-lm>=0.22; extra == 'mlx'
|
|
43
|
+
Requires-Dist: safetensors>=0.4.5; extra == 'mlx'
|
|
44
|
+
Provides-Extra: ollama
|
|
45
|
+
Requires-Dist: ollama>=0.4.7; extra == 'ollama'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# derman
|
|
49
|
+
|
|
50
|
+
**derman** (Azerbaijani: **dərman** · Turkish: **derman** · Persian: **درمان** *darmān* — *remedy, medicine, treatment*) is an on-device virtual-cell perturbation, therapeutic-window selectivity, causal calibration, and sequential sensitization workstation for **CellGemma (`google/cellgemma-e4b`)**, backed by immutable **`daftar`** scientific provenance tracking.
|
|
51
|
+
|
|
52
|
+
Designed specifically for air-gapped **16 GB Apple Silicon** workstations (and CUDA/CPU hosts), **derman** pairs quantized **CellGemma-E4B** (`ollama` raw mode, `llama-server` / `llama.cpp` Metal GGUF, or `mlx`) with a template-locked prompt compiler, a pure-NumPy/`safetensors` Stage 2 **`ExpressionDecoder`**, an optional local **FunctionGemma / Ollama** natural-language lab router, and a **zero-CDN localhost FastAPI workstation UI**. Proprietary patient single-cell RNA-seq profiles (`.h5ad`) never leave your machine, and every perturbation prompt hash, decoder checkpoint, random seed, falsification probe, and sequential rollout is logged in a reproducible `daftar` audit trail.
|
|
53
|
+
|
|
54
|
+
> **Research Use Only:** `derman` is a computational hypothesis-generation and auditing workstation for research use only. It is not intended for clinical diagnosis or patient treatment decisions.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Core Capabilities (Steps 1–5)
|
|
59
|
+
|
|
60
|
+
| Step | Status | Capability |
|
|
61
|
+
| :--- | :--- | :--- |
|
|
62
|
+
| **1. Quantized CellGemma Engine & Provenance** | **Implemented** | Modular Stage 1 backends (`mock`, loopback `ollama` in raw mode, zero-compile `llama-server`, Metal `gguf`, Apple Silicon `mlx`), strict non-conversational CellGemma prompt compiler, NumPy/`safetensors` Stage 2 `ExpressionDecoder`, pseudobulk $\log(1+x)$ preprocessing, and `daftar` lineage logging. |
|
|
63
|
+
| **2. Therapeutic-Window Screener** | **Implemented** | Local `.h5ad` inspection and pseudobulk ingestion (`anndata`), CSV/JSON/JSONL compound library loading, paired target-cell vs. healthy-bystander virtual screening, Monte Carlo ($T = 0.7$) rank-stability uncertainty estimation, Therapeutic Window Index ($\text{TWI}$), and Pareto frontier JSON/Markdown export. |
|
|
64
|
+
| **3. Falsification & Calibration Suite** | **Implemented** | 4-axis perturbation falsification auditor (`derman audit`) evaluating (1) mean-shift gain & DMSO/vehicle contrast, (2) SMILES-vs-drug-name shortcut ablation, (3) simulated 10x single-cell gene dropout & near-tie rank-jitter stability, and (4) CollecTRI/DoRothEA-aligned human TF-regulon directional concordance & module coherence with JSON/Markdown scorecards. |
|
|
65
|
+
| **4. Closed-Loop 2-Step Sensitization Simulator** | **Implemented** | Autoregressive closed-loop state feedback ($s_0 \xrightarrow{A} s_1 \xrightarrow{B} s_2$) paired with healthy-bystander tracking ($b_0 \xrightarrow{A} b_1 \xrightarrow{B} b_2$), single-pair order-asymmetry testing (`derman sequence`), library-wide 2-step beam planning (`derman plan-sequence`), priming synergy gain, compensatory survival/escape pathway detection (`CD274`, `ABCB1`, `BCL2`, `DDIT3`, `ATF4`, `VIM`, `VEGFA`), and closed-loop extrapolation drift guardrails. |
|
|
66
|
+
| **5. Zero-CDN Workstation UI & Lab Router** | **Implemented** | Localhost (`127.0.0.1`) FastAPI workstation (`derman serve`), self-contained zero-CDN HTML/CSS/SVG workbench (Pareto frontier scatter plot, 4-axis calibration gauge cards, $s_0 \to s_1 \to s_2$ trajectory sparklines, diverging $\log_2\text{FC}$ bar charts, `daftar` artifact history browser), optional local FunctionGemma/Ollama natural-language tool router (`derman ask` with deterministic offline fallback), and Docker containerization. |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Hardware & Memory Profile (16 GB Apple M1)
|
|
71
|
+
|
|
72
|
+
`google/cellgemma-e4b` uses Gemma 4 E4B with Per-Layer Embeddings ($7.7\text{B}$–$8\text{B}$ total parameters, $\approx 4.5\text{B}$ effective parameters per token) and an extended $282\text{K}$ vocabulary containing $20{,}256$ dedicated single tokens for human protein-coding genes:
|
|
73
|
+
|
|
74
|
+
| Runtime / Quantization | Approx. Peak RAM ($4\text{K}$–$8\text{K}$ ctx) | 16 GB Apple M1 Feasibility |
|
|
75
|
+
| :--- | :--- | :--- |
|
|
76
|
+
| **BF16 / FP16** (raw PyTorch) | $\approx 17$–$18\text{ GB}$ | Swaps heavily or OOMs on $16\text{ GB}$ |
|
|
77
|
+
| **INT8 / `Q8_0`** (`llama.cpp` / MLX) | $\approx 8.5$–$12.7\text{ GB}$ | Tight on $16\text{ GB}$ (close heavy background apps) |
|
|
78
|
+
| **`Q6_K` GGUF (`ollama` raw / `llama-server`)** | $\approx 6.8$–$8.5\text{ GB}$ | **Recommended (verified on 16 GB M1)** — exact HF `USER_DEFINED` gene-token match via `galinilin/cellgemma-e4b-GGUF:Q6_K` |
|
|
79
|
+
| **INT4 / `Q4_K_M`** (`llama-server` / MLX) | $\approx 4.5$–$6.0\text{ GB}$ | Fits easily, though `Q6_K` preserves gene-rank fidelity much better |
|
|
80
|
+
|
|
81
|
+
Stage 2 (`ExpressionDecoder`) executes strictly in NumPy + `safetensors`, avoiding any resident PyTorch memory overhead during local screening, auditing, and closed-loop planning.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
`derman` (PyPI distribution: `derman-cell`) isolates optional runtimes into extras so the core CLI, template compiler, Stage 2 NumPy decoder, Therapeutic-Window Screener, Calibration Auditor, Closed-Loop Sequencer, and offline mock pharmacology simulator stay lightweight:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Core CLI + deterministic offline mock CellGemma + httpx for Ollama/llama-server
|
|
91
|
+
uv sync --extra dev
|
|
92
|
+
|
|
93
|
+
# Local workstation UI (FastAPI/uvicorn) + .h5ad single-cell ingestion + dev tests
|
|
94
|
+
uv sync --extra api --extra anndata --extra dev
|
|
95
|
+
|
|
96
|
+
# Or add native Apple Silicon MLX inference (prebuilt arm64 Metal wheels)
|
|
97
|
+
uv sync --extra mlx --extra api --extra anndata --extra dev
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Available extras: `gguf`, `mlx`, `anndata`, `ollama`, `api`, `all`, `dev`.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Quickstart
|
|
105
|
+
|
|
106
|
+
### 1. Offline Verification, Router & Zero-CDN Workstation UI
|
|
107
|
+
|
|
108
|
+
All commands default to `--backend mock` (`mock-cellgemma-e4b-micro`) for instant, deterministic offline verification:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
uv run --no-sync ruff check src tests
|
|
112
|
+
uv run --no-sync pytest -v
|
|
113
|
+
|
|
114
|
+
# Step 1: Compile and validate a strict template-locked CellGemma prompt
|
|
115
|
+
uv run --no-sync derman compile-prompt --drug Trametinib
|
|
116
|
+
|
|
117
|
+
# Step 1: Single-perturbation Stage 1 + Stage 2 prediction
|
|
118
|
+
uv run --no-sync derman predict --drug Trametinib --preset thyroid_tumor_low_gpnmb
|
|
119
|
+
uv run --no-sync derman predict --drug Panobinostat --preset healthy_bystander_epithelium
|
|
120
|
+
|
|
121
|
+
# Step 2: Paired Target vs. Healthy-Bystander therapeutic-window screen (3 Monte Carlo replicates)
|
|
122
|
+
uv run --no-sync derman screen --replicates 3 --temperature 0.7
|
|
123
|
+
|
|
124
|
+
# Step 3: 4-axis falsification & calibration audit (SMILES-grounded vs. name-memorization shortcut)
|
|
125
|
+
uv run --no-sync derman audit --drug Trametinib
|
|
126
|
+
uv run --no-sync derman audit \
|
|
127
|
+
--drug Panobinostat \
|
|
128
|
+
--smiles "CC1=C(C2=CC=CC=C2N1)CCNCC3=CC=C(C=C3)C=CC(=O)NO"
|
|
129
|
+
|
|
130
|
+
# Step 4: Closed-loop 2-step order-asymmetry & escape check + library beam search
|
|
131
|
+
uv run --no-sync derman sequence --primer Trametinib --followup IFNG
|
|
132
|
+
uv run --no-sync derman plan-sequence --beam-width 3
|
|
133
|
+
|
|
134
|
+
# Step 5: Natural-language lab router (offline deterministic or --use-ollama-router)
|
|
135
|
+
uv run --no-sync derman ask "Audit Panobinostat for SMILES shortcut risk"
|
|
136
|
+
uv run --no-sync derman ask "Simulate Trametinib followed by IFNG"
|
|
137
|
+
|
|
138
|
+
# Step 5: Launch the zero-CDN localhost workstation UI at http://127.0.0.1:8765
|
|
139
|
+
uv run --no-sync derman serve --backend mock --port 8765
|
|
140
|
+
|
|
141
|
+
# Inspect immutable scientific provenance
|
|
142
|
+
uv run --no-sync daftar list
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 2. Running Real Quantized CellGemma-E4B on a 16 GB Apple M1
|
|
146
|
+
|
|
147
|
+
#### Option A: Zero-Compile Local Ollama (Raw Mode, Recommended)
|
|
148
|
+
|
|
149
|
+
`derman` calls Ollama's `/api/generate` endpoint with `"raw": true` and `num_ctx=8192` so CellGemma's strict non-conversational turn template and $20{,}256$ `USER_DEFINED` gene tokens are preserved intact:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# 1. Pull the tokenizer-fixed Q6_K GGUF once (~6.8 GB), and optionally FunctionGemma for NL routing
|
|
153
|
+
ollama pull hf.co/galinilin/cellgemma-e4b-GGUF:Q6_K
|
|
154
|
+
ollama pull functiongemma
|
|
155
|
+
|
|
156
|
+
# 2. Run a real CellGemma-E4B prediction, 4-axis audit, and closed-loop 2-step sequence
|
|
157
|
+
uv run --no-sync derman predict \
|
|
158
|
+
--backend ollama --drug Trametinib --preset thyroid_tumor_low_gpnmb --max-new-tokens 128
|
|
159
|
+
|
|
160
|
+
uv run --no-sync derman audit \
|
|
161
|
+
--backend ollama --drug Trametinib --max-new-tokens 128 --dropout-probes 1
|
|
162
|
+
|
|
163
|
+
uv run --no-sync derman sequence \
|
|
164
|
+
--backend ollama --primer Trametinib --followup IFNG --max-new-tokens 128
|
|
165
|
+
|
|
166
|
+
# 3. Launch the interactive UI backed directly by live CellGemma-E4B + FunctionGemma router
|
|
167
|
+
uv run --no-sync derman serve \
|
|
168
|
+
--backend ollama \
|
|
169
|
+
--use-ollama-router \
|
|
170
|
+
--router-model functiongemma \
|
|
171
|
+
--port 8765
|
|
172
|
+
|
|
173
|
+
# 4. Run a paired screen or 2-step beam plan on a local .h5ad patient cohort
|
|
174
|
+
uv run --no-sync derman plan-sequence \
|
|
175
|
+
--h5ad path/to/patient_cohort.h5ad \
|
|
176
|
+
--cell-type-col cell_type \
|
|
177
|
+
--target-group "Tumor_Epithelial" \
|
|
178
|
+
--bystander-group "Healthy_Epithelial" \
|
|
179
|
+
--library path/to/compounds.csv \
|
|
180
|
+
--beam-width 2 \
|
|
181
|
+
--backend ollama
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Option B: Local `llama-server` (Exact HF Sampler Order)
|
|
185
|
+
|
|
186
|
+
If you want `temperature=0.7` applied strictly before `top_k=64` and `top_p=0.95` to match Google DeepMind's exact benchmark sampler, serve the same GGUF with a native `arm64` `llama-server` binary and pass `--backend llama-server --server-url http://127.0.0.1:8080`.
|
|
187
|
+
|
|
188
|
+
#### Optional: Official Stage 2 `ExpressionDecoder`
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
uv pip install huggingface-hub
|
|
192
|
+
uv run --no-sync derman fetch-decoder --list
|
|
193
|
+
uv run --no-sync derman fetch-decoder --dataset norman
|
|
194
|
+
# Pass --decoder-dir decoders/decoders/norman to predict, screen, audit, sequence, plan-sequence, ask, or serve
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 3. Packaging & Docker
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Build sdist and wheel (bundles src/derman/static/index.html)
|
|
201
|
+
uv build
|
|
202
|
+
|
|
203
|
+
# Build and run the offline-capable container image
|
|
204
|
+
docker build -t derman:latest .
|
|
205
|
+
docker run --rm -p 8765:8765 \
|
|
206
|
+
-v "$(pwd)/derman_workspace:/app/derman_workspace" \
|
|
207
|
+
derman:latest
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Verified Local Benchmarks (Apple Silicon M1, 16 GB)
|
|
213
|
+
|
|
214
|
+
All $13$ automated unit and integration tests across Steps 1–5 cover preprocessing, strict template guardrails, residual parsing, `safetensors` MLP decoding, paired selectivity screening, Pareto frontier ranking, CSV library loading, SMILES-vs-name shortcut ablation, dropout/jitter stability, TF-regulon contradictions, closed-loop priming synergy, order asymmetry, compensatory escape detection, deterministic lab routing, zero-CDN HTML verification, and end-to-end FastAPI workstation endpoints (`uv run --no-sync pytest -v`).
|
|
215
|
+
|
|
216
|
+
### Step 2: Offline Mock Therapeutic-Window Screen (`screen-537e01cbd9`, `daftar: r-4b22a31c`)
|
|
217
|
+
|
|
218
|
+
| Rank | Candidate | Mechanism Class | Target Efficacy | Bystander Shift | Window ($\text{TWI}$) | Stability | Pareto |
|
|
219
|
+
| ---: | :--- | :--- | ---: | ---: | ---: | ---: | :---: |
|
|
220
|
+
| 1 | Trametinib ($0.5\;\mu\text{M}$) | MEK1/2 inhibitor (selective) | $+2.197$ ($\pm 0.01$) | $0.000$ ($\pm 0.00$) | **$+2.197$** | $100.0\%$ | **YES** |
|
|
221
|
+
| 2 | Selumetinib ($1.0\;\mu\text{M}$) | MEK1/2 inhibitor (selective) | $+1.489$ ($\pm 0.03$) | $0.000$ ($\pm 0.00$) | **$+1.489$** | $100.0\%$ | |
|
|
222
|
+
| 3 | IFNG ($10\;\text{ng/mL}$) | Cytokine (MHC-I immune priming) | $+1.284$ ($\pm 0.02$) | $0.353$ ($\pm 0.00$) | **$+0.930$** | $100.0\%$ | |
|
|
223
|
+
| 4 | Metformin ($10\;\mu\text{M}$) | Metabolic control (off-pathway) | $-0.350$ ($\pm 0.01$) | $0.000$ ($\pm 0.00$) | **$-0.350$** | $100.0\%$ | |
|
|
224
|
+
| 5 | Vorinostat ($2.0\;\mu\text{M}$) | Pan-HDAC inhibitor (broad toxicity) | $+1.091$ ($\pm 0.01$) | $2.288$ ($\pm 0.02$) | **$-1.197$** | $91.7\%$ | |
|
|
225
|
+
| 6 | Panobinostat ($0.5\;\mu\text{M}$) | Pan-HDAC inhibitor (broad toxicity) | $+1.071$ ($\pm 0.02$) | $2.297$ ($\pm 0.02$) | **$-1.226$** | $100.0\%$ | |
|
|
226
|
+
|
|
227
|
+
### Step 3: 4-Axis Falsification & Calibration Audits (Mock + Live `CellGemma-E4B Q6_K`)
|
|
228
|
+
|
|
229
|
+
| Run / Audit ID (`daftar`) | Backend & Drug | Mean-Shift & DMSO | SMILES vs. Name | Dropout & Jitter | TF-Regulon | Composite / Verdict |
|
|
230
|
+
| :--- | :--- | ---: | ---: | ---: | ---: | :--- |
|
|
231
|
+
| `audit-8813d71c1a` (`r-6df92f6b`) | Mock · Trametinib | $99.0\%$ | $99.9\%$ (`LOW`) | $97.9\%$ | $100.0\%$ ($5/5$) | **$99.2\%$ · `HIGH_CONFIDENCE`** |
|
|
232
|
+
| `audit-1030d58b01` (`r-89f664e6`) | Mock · Panobinostat | $98.0\%$ | $7.9\%$ (`HIGH`) | $92.7\%$ | $100.0\%$ ($3/3$) | **$74.7\%$ · `MODERATE_VERIFY`** |
|
|
233
|
+
| `audit-cadb12bf0f` (`r-e9a5c670`) | **Live Ollama `CellGemma-E4B Q6_K`** · Trametinib ($40$-gene preset) | $98.1\%$ | $18.4\%$ (`HIGH`) | $29.5\%$ | $50.0\%$ ($0/0$) | **$49.0\%$ · `LOW_CONFIDENCE_FLAGGED`** |
|
|
234
|
+
|
|
235
|
+
### Step 4: Closed-Loop 2-Step Sensitization Plans (Mock + Live `CellGemma-E4B Q6_K`)
|
|
236
|
+
|
|
237
|
+
| Run / Plan ID (`daftar`) | Backend & Mode | Top Pareto Sequence | Key Findings |
|
|
238
|
+
| :--- | :--- | :--- | :--- |
|
|
239
|
+
| `seq-f94f9d9830` (`r-4cbbe855`) | Mock · Pair (`Trametinib` $\leftrightarrow$ `IFNG`) | `Trametinib -> IFNG` | Strong priming synergy ($\approx +1.9$) and order asymmetry ($\approx +1.8$) with $0.000$ bystander shift and $0$ escapes; reverse `IFNG -> Trametinib` triggers persistent `CD274` (PD-L1) escape ($\text{step1} = +1.85$, $\text{cum} = +3.76$). |
|
|
240
|
+
| `seqplan-062113262d` (`r-46ca1b49`) | Mock · Beam Plan ($\text{beam} = 3$, $18$ regimens) | `Trametinib -> IFNG` | Ranks all $18$ sequences; catches emergent `ABCB1` ($+2.22$) & `BCL2` ($+2.32$) escape on repeated `Trametinib -> Trametinib` and ER-stress (`DDIT3`/`ATF4`) on HDAC follow-ups. |
|
|
241
|
+
| `seq-7951cc0cec` (`r-95d87834`) | **Live Ollama `CellGemma-E4B Q6_K`** · Pair ($128$ tok, $40$-gene preset) | `IFNG -> Trametinib` | Completes all $8$ closed-loop forward passes cleanly on $16\text{ GB}$ M1 and automatically flags `HIGH` autoregressive extrapolation drift on the truncated $40$-gene preset, reinforcing the requirement for full $\sim 1{,}000$-gene `.h5ad` inputs + matched Stage 2 decoders. |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Architecture & Provenance
|
|
246
|
+
|
|
247
|
+
Every `derman` CLI command and Web UI action persists validated JSON (and Markdown for screens, audits, and sequential plans) artifacts under `derman_workspace/` (`predictions/`, `screens/`, `audits/`, `sequences/`) and logs an immutable `daftar` run (`derman.perturbation.predict`, `derman.screen.therapeutic_window`, `derman.audit.calibration`, `derman.sequence.simulate_pair`, `derman.sequence.plan_beam`). See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for mathematical definitions, regulon scoring, closed-loop dynamics, REST API contracts, and module architecture.
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
Apache-2.0
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# derman
|
|
2
|
+
|
|
3
|
+
**derman** (Azerbaijani: **dərman** · Turkish: **derman** · Persian: **درمان** *darmān* — *remedy, medicine, treatment*) is an on-device virtual-cell perturbation, therapeutic-window selectivity, causal calibration, and sequential sensitization workstation for **CellGemma (`google/cellgemma-e4b`)**, backed by immutable **`daftar`** scientific provenance tracking.
|
|
4
|
+
|
|
5
|
+
Designed specifically for air-gapped **16 GB Apple Silicon** workstations (and CUDA/CPU hosts), **derman** pairs quantized **CellGemma-E4B** (`ollama` raw mode, `llama-server` / `llama.cpp` Metal GGUF, or `mlx`) with a template-locked prompt compiler, a pure-NumPy/`safetensors` Stage 2 **`ExpressionDecoder`**, an optional local **FunctionGemma / Ollama** natural-language lab router, and a **zero-CDN localhost FastAPI workstation UI**. Proprietary patient single-cell RNA-seq profiles (`.h5ad`) never leave your machine, and every perturbation prompt hash, decoder checkpoint, random seed, falsification probe, and sequential rollout is logged in a reproducible `daftar` audit trail.
|
|
6
|
+
|
|
7
|
+
> **Research Use Only:** `derman` is a computational hypothesis-generation and auditing workstation for research use only. It is not intended for clinical diagnosis or patient treatment decisions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Core Capabilities (Steps 1–5)
|
|
12
|
+
|
|
13
|
+
| Step | Status | Capability |
|
|
14
|
+
| :--- | :--- | :--- |
|
|
15
|
+
| **1. Quantized CellGemma Engine & Provenance** | **Implemented** | Modular Stage 1 backends (`mock`, loopback `ollama` in raw mode, zero-compile `llama-server`, Metal `gguf`, Apple Silicon `mlx`), strict non-conversational CellGemma prompt compiler, NumPy/`safetensors` Stage 2 `ExpressionDecoder`, pseudobulk $\log(1+x)$ preprocessing, and `daftar` lineage logging. |
|
|
16
|
+
| **2. Therapeutic-Window Screener** | **Implemented** | Local `.h5ad` inspection and pseudobulk ingestion (`anndata`), CSV/JSON/JSONL compound library loading, paired target-cell vs. healthy-bystander virtual screening, Monte Carlo ($T = 0.7$) rank-stability uncertainty estimation, Therapeutic Window Index ($\text{TWI}$), and Pareto frontier JSON/Markdown export. |
|
|
17
|
+
| **3. Falsification & Calibration Suite** | **Implemented** | 4-axis perturbation falsification auditor (`derman audit`) evaluating (1) mean-shift gain & DMSO/vehicle contrast, (2) SMILES-vs-drug-name shortcut ablation, (3) simulated 10x single-cell gene dropout & near-tie rank-jitter stability, and (4) CollecTRI/DoRothEA-aligned human TF-regulon directional concordance & module coherence with JSON/Markdown scorecards. |
|
|
18
|
+
| **4. Closed-Loop 2-Step Sensitization Simulator** | **Implemented** | Autoregressive closed-loop state feedback ($s_0 \xrightarrow{A} s_1 \xrightarrow{B} s_2$) paired with healthy-bystander tracking ($b_0 \xrightarrow{A} b_1 \xrightarrow{B} b_2$), single-pair order-asymmetry testing (`derman sequence`), library-wide 2-step beam planning (`derman plan-sequence`), priming synergy gain, compensatory survival/escape pathway detection (`CD274`, `ABCB1`, `BCL2`, `DDIT3`, `ATF4`, `VIM`, `VEGFA`), and closed-loop extrapolation drift guardrails. |
|
|
19
|
+
| **5. Zero-CDN Workstation UI & Lab Router** | **Implemented** | Localhost (`127.0.0.1`) FastAPI workstation (`derman serve`), self-contained zero-CDN HTML/CSS/SVG workbench (Pareto frontier scatter plot, 4-axis calibration gauge cards, $s_0 \to s_1 \to s_2$ trajectory sparklines, diverging $\log_2\text{FC}$ bar charts, `daftar` artifact history browser), optional local FunctionGemma/Ollama natural-language tool router (`derman ask` with deterministic offline fallback), and Docker containerization. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Hardware & Memory Profile (16 GB Apple M1)
|
|
24
|
+
|
|
25
|
+
`google/cellgemma-e4b` uses Gemma 4 E4B with Per-Layer Embeddings ($7.7\text{B}$–$8\text{B}$ total parameters, $\approx 4.5\text{B}$ effective parameters per token) and an extended $282\text{K}$ vocabulary containing $20{,}256$ dedicated single tokens for human protein-coding genes:
|
|
26
|
+
|
|
27
|
+
| Runtime / Quantization | Approx. Peak RAM ($4\text{K}$–$8\text{K}$ ctx) | 16 GB Apple M1 Feasibility |
|
|
28
|
+
| :--- | :--- | :--- |
|
|
29
|
+
| **BF16 / FP16** (raw PyTorch) | $\approx 17$–$18\text{ GB}$ | Swaps heavily or OOMs on $16\text{ GB}$ |
|
|
30
|
+
| **INT8 / `Q8_0`** (`llama.cpp` / MLX) | $\approx 8.5$–$12.7\text{ GB}$ | Tight on $16\text{ GB}$ (close heavy background apps) |
|
|
31
|
+
| **`Q6_K` GGUF (`ollama` raw / `llama-server`)** | $\approx 6.8$–$8.5\text{ GB}$ | **Recommended (verified on 16 GB M1)** — exact HF `USER_DEFINED` gene-token match via `galinilin/cellgemma-e4b-GGUF:Q6_K` |
|
|
32
|
+
| **INT4 / `Q4_K_M`** (`llama-server` / MLX) | $\approx 4.5$–$6.0\text{ GB}$ | Fits easily, though `Q6_K` preserves gene-rank fidelity much better |
|
|
33
|
+
|
|
34
|
+
Stage 2 (`ExpressionDecoder`) executes strictly in NumPy + `safetensors`, avoiding any resident PyTorch memory overhead during local screening, auditing, and closed-loop planning.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
`derman` (PyPI distribution: `derman-cell`) isolates optional runtimes into extras so the core CLI, template compiler, Stage 2 NumPy decoder, Therapeutic-Window Screener, Calibration Auditor, Closed-Loop Sequencer, and offline mock pharmacology simulator stay lightweight:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Core CLI + deterministic offline mock CellGemma + httpx for Ollama/llama-server
|
|
44
|
+
uv sync --extra dev
|
|
45
|
+
|
|
46
|
+
# Local workstation UI (FastAPI/uvicorn) + .h5ad single-cell ingestion + dev tests
|
|
47
|
+
uv sync --extra api --extra anndata --extra dev
|
|
48
|
+
|
|
49
|
+
# Or add native Apple Silicon MLX inference (prebuilt arm64 Metal wheels)
|
|
50
|
+
uv sync --extra mlx --extra api --extra anndata --extra dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Available extras: `gguf`, `mlx`, `anndata`, `ollama`, `api`, `all`, `dev`.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Quickstart
|
|
58
|
+
|
|
59
|
+
### 1. Offline Verification, Router & Zero-CDN Workstation UI
|
|
60
|
+
|
|
61
|
+
All commands default to `--backend mock` (`mock-cellgemma-e4b-micro`) for instant, deterministic offline verification:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
uv run --no-sync ruff check src tests
|
|
65
|
+
uv run --no-sync pytest -v
|
|
66
|
+
|
|
67
|
+
# Step 1: Compile and validate a strict template-locked CellGemma prompt
|
|
68
|
+
uv run --no-sync derman compile-prompt --drug Trametinib
|
|
69
|
+
|
|
70
|
+
# Step 1: Single-perturbation Stage 1 + Stage 2 prediction
|
|
71
|
+
uv run --no-sync derman predict --drug Trametinib --preset thyroid_tumor_low_gpnmb
|
|
72
|
+
uv run --no-sync derman predict --drug Panobinostat --preset healthy_bystander_epithelium
|
|
73
|
+
|
|
74
|
+
# Step 2: Paired Target vs. Healthy-Bystander therapeutic-window screen (3 Monte Carlo replicates)
|
|
75
|
+
uv run --no-sync derman screen --replicates 3 --temperature 0.7
|
|
76
|
+
|
|
77
|
+
# Step 3: 4-axis falsification & calibration audit (SMILES-grounded vs. name-memorization shortcut)
|
|
78
|
+
uv run --no-sync derman audit --drug Trametinib
|
|
79
|
+
uv run --no-sync derman audit \
|
|
80
|
+
--drug Panobinostat \
|
|
81
|
+
--smiles "CC1=C(C2=CC=CC=C2N1)CCNCC3=CC=C(C=C3)C=CC(=O)NO"
|
|
82
|
+
|
|
83
|
+
# Step 4: Closed-loop 2-step order-asymmetry & escape check + library beam search
|
|
84
|
+
uv run --no-sync derman sequence --primer Trametinib --followup IFNG
|
|
85
|
+
uv run --no-sync derman plan-sequence --beam-width 3
|
|
86
|
+
|
|
87
|
+
# Step 5: Natural-language lab router (offline deterministic or --use-ollama-router)
|
|
88
|
+
uv run --no-sync derman ask "Audit Panobinostat for SMILES shortcut risk"
|
|
89
|
+
uv run --no-sync derman ask "Simulate Trametinib followed by IFNG"
|
|
90
|
+
|
|
91
|
+
# Step 5: Launch the zero-CDN localhost workstation UI at http://127.0.0.1:8765
|
|
92
|
+
uv run --no-sync derman serve --backend mock --port 8765
|
|
93
|
+
|
|
94
|
+
# Inspect immutable scientific provenance
|
|
95
|
+
uv run --no-sync daftar list
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2. Running Real Quantized CellGemma-E4B on a 16 GB Apple M1
|
|
99
|
+
|
|
100
|
+
#### Option A: Zero-Compile Local Ollama (Raw Mode, Recommended)
|
|
101
|
+
|
|
102
|
+
`derman` calls Ollama's `/api/generate` endpoint with `"raw": true` and `num_ctx=8192` so CellGemma's strict non-conversational turn template and $20{,}256$ `USER_DEFINED` gene tokens are preserved intact:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 1. Pull the tokenizer-fixed Q6_K GGUF once (~6.8 GB), and optionally FunctionGemma for NL routing
|
|
106
|
+
ollama pull hf.co/galinilin/cellgemma-e4b-GGUF:Q6_K
|
|
107
|
+
ollama pull functiongemma
|
|
108
|
+
|
|
109
|
+
# 2. Run a real CellGemma-E4B prediction, 4-axis audit, and closed-loop 2-step sequence
|
|
110
|
+
uv run --no-sync derman predict \
|
|
111
|
+
--backend ollama --drug Trametinib --preset thyroid_tumor_low_gpnmb --max-new-tokens 128
|
|
112
|
+
|
|
113
|
+
uv run --no-sync derman audit \
|
|
114
|
+
--backend ollama --drug Trametinib --max-new-tokens 128 --dropout-probes 1
|
|
115
|
+
|
|
116
|
+
uv run --no-sync derman sequence \
|
|
117
|
+
--backend ollama --primer Trametinib --followup IFNG --max-new-tokens 128
|
|
118
|
+
|
|
119
|
+
# 3. Launch the interactive UI backed directly by live CellGemma-E4B + FunctionGemma router
|
|
120
|
+
uv run --no-sync derman serve \
|
|
121
|
+
--backend ollama \
|
|
122
|
+
--use-ollama-router \
|
|
123
|
+
--router-model functiongemma \
|
|
124
|
+
--port 8765
|
|
125
|
+
|
|
126
|
+
# 4. Run a paired screen or 2-step beam plan on a local .h5ad patient cohort
|
|
127
|
+
uv run --no-sync derman plan-sequence \
|
|
128
|
+
--h5ad path/to/patient_cohort.h5ad \
|
|
129
|
+
--cell-type-col cell_type \
|
|
130
|
+
--target-group "Tumor_Epithelial" \
|
|
131
|
+
--bystander-group "Healthy_Epithelial" \
|
|
132
|
+
--library path/to/compounds.csv \
|
|
133
|
+
--beam-width 2 \
|
|
134
|
+
--backend ollama
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Option B: Local `llama-server` (Exact HF Sampler Order)
|
|
138
|
+
|
|
139
|
+
If you want `temperature=0.7` applied strictly before `top_k=64` and `top_p=0.95` to match Google DeepMind's exact benchmark sampler, serve the same GGUF with a native `arm64` `llama-server` binary and pass `--backend llama-server --server-url http://127.0.0.1:8080`.
|
|
140
|
+
|
|
141
|
+
#### Optional: Official Stage 2 `ExpressionDecoder`
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
uv pip install huggingface-hub
|
|
145
|
+
uv run --no-sync derman fetch-decoder --list
|
|
146
|
+
uv run --no-sync derman fetch-decoder --dataset norman
|
|
147
|
+
# Pass --decoder-dir decoders/decoders/norman to predict, screen, audit, sequence, plan-sequence, ask, or serve
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 3. Packaging & Docker
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Build sdist and wheel (bundles src/derman/static/index.html)
|
|
154
|
+
uv build
|
|
155
|
+
|
|
156
|
+
# Build and run the offline-capable container image
|
|
157
|
+
docker build -t derman:latest .
|
|
158
|
+
docker run --rm -p 8765:8765 \
|
|
159
|
+
-v "$(pwd)/derman_workspace:/app/derman_workspace" \
|
|
160
|
+
derman:latest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Verified Local Benchmarks (Apple Silicon M1, 16 GB)
|
|
166
|
+
|
|
167
|
+
All $13$ automated unit and integration tests across Steps 1–5 cover preprocessing, strict template guardrails, residual parsing, `safetensors` MLP decoding, paired selectivity screening, Pareto frontier ranking, CSV library loading, SMILES-vs-name shortcut ablation, dropout/jitter stability, TF-regulon contradictions, closed-loop priming synergy, order asymmetry, compensatory escape detection, deterministic lab routing, zero-CDN HTML verification, and end-to-end FastAPI workstation endpoints (`uv run --no-sync pytest -v`).
|
|
168
|
+
|
|
169
|
+
### Step 2: Offline Mock Therapeutic-Window Screen (`screen-537e01cbd9`, `daftar: r-4b22a31c`)
|
|
170
|
+
|
|
171
|
+
| Rank | Candidate | Mechanism Class | Target Efficacy | Bystander Shift | Window ($\text{TWI}$) | Stability | Pareto |
|
|
172
|
+
| ---: | :--- | :--- | ---: | ---: | ---: | ---: | :---: |
|
|
173
|
+
| 1 | Trametinib ($0.5\;\mu\text{M}$) | MEK1/2 inhibitor (selective) | $+2.197$ ($\pm 0.01$) | $0.000$ ($\pm 0.00$) | **$+2.197$** | $100.0\%$ | **YES** |
|
|
174
|
+
| 2 | Selumetinib ($1.0\;\mu\text{M}$) | MEK1/2 inhibitor (selective) | $+1.489$ ($\pm 0.03$) | $0.000$ ($\pm 0.00$) | **$+1.489$** | $100.0\%$ | |
|
|
175
|
+
| 3 | IFNG ($10\;\text{ng/mL}$) | Cytokine (MHC-I immune priming) | $+1.284$ ($\pm 0.02$) | $0.353$ ($\pm 0.00$) | **$+0.930$** | $100.0\%$ | |
|
|
176
|
+
| 4 | Metformin ($10\;\mu\text{M}$) | Metabolic control (off-pathway) | $-0.350$ ($\pm 0.01$) | $0.000$ ($\pm 0.00$) | **$-0.350$** | $100.0\%$ | |
|
|
177
|
+
| 5 | Vorinostat ($2.0\;\mu\text{M}$) | Pan-HDAC inhibitor (broad toxicity) | $+1.091$ ($\pm 0.01$) | $2.288$ ($\pm 0.02$) | **$-1.197$** | $91.7\%$ | |
|
|
178
|
+
| 6 | Panobinostat ($0.5\;\mu\text{M}$) | Pan-HDAC inhibitor (broad toxicity) | $+1.071$ ($\pm 0.02$) | $2.297$ ($\pm 0.02$) | **$-1.226$** | $100.0\%$ | |
|
|
179
|
+
|
|
180
|
+
### Step 3: 4-Axis Falsification & Calibration Audits (Mock + Live `CellGemma-E4B Q6_K`)
|
|
181
|
+
|
|
182
|
+
| Run / Audit ID (`daftar`) | Backend & Drug | Mean-Shift & DMSO | SMILES vs. Name | Dropout & Jitter | TF-Regulon | Composite / Verdict |
|
|
183
|
+
| :--- | :--- | ---: | ---: | ---: | ---: | :--- |
|
|
184
|
+
| `audit-8813d71c1a` (`r-6df92f6b`) | Mock · Trametinib | $99.0\%$ | $99.9\%$ (`LOW`) | $97.9\%$ | $100.0\%$ ($5/5$) | **$99.2\%$ · `HIGH_CONFIDENCE`** |
|
|
185
|
+
| `audit-1030d58b01` (`r-89f664e6`) | Mock · Panobinostat | $98.0\%$ | $7.9\%$ (`HIGH`) | $92.7\%$ | $100.0\%$ ($3/3$) | **$74.7\%$ · `MODERATE_VERIFY`** |
|
|
186
|
+
| `audit-cadb12bf0f` (`r-e9a5c670`) | **Live Ollama `CellGemma-E4B Q6_K`** · Trametinib ($40$-gene preset) | $98.1\%$ | $18.4\%$ (`HIGH`) | $29.5\%$ | $50.0\%$ ($0/0$) | **$49.0\%$ · `LOW_CONFIDENCE_FLAGGED`** |
|
|
187
|
+
|
|
188
|
+
### Step 4: Closed-Loop 2-Step Sensitization Plans (Mock + Live `CellGemma-E4B Q6_K`)
|
|
189
|
+
|
|
190
|
+
| Run / Plan ID (`daftar`) | Backend & Mode | Top Pareto Sequence | Key Findings |
|
|
191
|
+
| :--- | :--- | :--- | :--- |
|
|
192
|
+
| `seq-f94f9d9830` (`r-4cbbe855`) | Mock · Pair (`Trametinib` $\leftrightarrow$ `IFNG`) | `Trametinib -> IFNG` | Strong priming synergy ($\approx +1.9$) and order asymmetry ($\approx +1.8$) with $0.000$ bystander shift and $0$ escapes; reverse `IFNG -> Trametinib` triggers persistent `CD274` (PD-L1) escape ($\text{step1} = +1.85$, $\text{cum} = +3.76$). |
|
|
193
|
+
| `seqplan-062113262d` (`r-46ca1b49`) | Mock · Beam Plan ($\text{beam} = 3$, $18$ regimens) | `Trametinib -> IFNG` | Ranks all $18$ sequences; catches emergent `ABCB1` ($+2.22$) & `BCL2` ($+2.32$) escape on repeated `Trametinib -> Trametinib` and ER-stress (`DDIT3`/`ATF4`) on HDAC follow-ups. |
|
|
194
|
+
| `seq-7951cc0cec` (`r-95d87834`) | **Live Ollama `CellGemma-E4B Q6_K`** · Pair ($128$ tok, $40$-gene preset) | `IFNG -> Trametinib` | Completes all $8$ closed-loop forward passes cleanly on $16\text{ GB}$ M1 and automatically flags `HIGH` autoregressive extrapolation drift on the truncated $40$-gene preset, reinforcing the requirement for full $\sim 1{,}000$-gene `.h5ad` inputs + matched Stage 2 decoders. |
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Architecture & Provenance
|
|
199
|
+
|
|
200
|
+
Every `derman` CLI command and Web UI action persists validated JSON (and Markdown for screens, audits, and sequential plans) artifacts under `derman_workspace/` (`predictions/`, `screens/`, `audits/`, `sequences/`) and logs an immutable `daftar` run (`derman.perturbation.predict`, `derman.screen.therapeutic_window`, `derman.audit.calibration`, `derman.sequence.simulate_pair`, `derman.sequence.plan_beam`). See [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for mathematical definitions, regulon scoring, closed-loop dynamics, REST API contracts, and module architecture.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
Apache-2.0
|