cellscreen 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.
- cellscreen-0.1.0/.agents/skills/cellscreen/SKILL.md +59 -0
- cellscreen-0.1.0/.agents/skills/cellscreen/references/reference.md +86 -0
- cellscreen-0.1.0/.claude/skills/cellscreen/SKILL.md +59 -0
- cellscreen-0.1.0/.gitignore +24 -0
- cellscreen-0.1.0/CHANGELOG.md +29 -0
- cellscreen-0.1.0/LICENSE +202 -0
- cellscreen-0.1.0/NOTICE +10 -0
- cellscreen-0.1.0/PKG-INFO +198 -0
- cellscreen-0.1.0/README.md +156 -0
- cellscreen-0.1.0/docs/guide.md +278 -0
- cellscreen-0.1.0/examples/k562_crispr.json +42 -0
- cellscreen-0.1.0/examples/tahoe_drugs.json +53 -0
- cellscreen-0.1.0/pyproject.toml +103 -0
- cellscreen-0.1.0/src/cellscreen/__init__.py +3 -0
- cellscreen-0.1.0/src/cellscreen/assets.py +125 -0
- cellscreen-0.1.0/src/cellscreen/bundled.py +154 -0
- cellscreen-0.1.0/src/cellscreen/cli.py +513 -0
- cellscreen-0.1.0/src/cellscreen/constants.py +117 -0
- cellscreen-0.1.0/src/cellscreen/decoder.py +222 -0
- cellscreen-0.1.0/src/cellscreen/fanner.py +366 -0
- cellscreen-0.1.0/src/cellscreen/prompts.py +142 -0
- cellscreen-0.1.0/src/cellscreen/quantize.py +118 -0
- cellscreen-0.1.0/src/cellscreen/report.py +1359 -0
- cellscreen-0.1.0/src/cellscreen/schemas.py +217 -0
- cellscreen-0.1.0/src/cellscreen/server.py +395 -0
- cellscreen-0.1.0/src/cellscreen/store.py +313 -0
- cellscreen-0.1.0/tests/test_bundled_and_packaging.py +66 -0
- cellscreen-0.1.0/tests/test_end_to_end_stateless.py +236 -0
- cellscreen-0.1.0/tests/test_health_and_defaults.py +110 -0
- cellscreen-0.1.0/tests/test_prompts_and_decoder.py +145 -0
- cellscreen-0.1.0/tests/test_quantize.py +84 -0
- cellscreen-0.1.0/tests/test_report_escaping.py +31 -0
- cellscreen-0.1.0/tests/test_server_mlx_engine.py +55 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cellscreen
|
|
3
|
+
description: >-
|
|
4
|
+
Run, resume, inspect and report CellGemma E4B in silico perturbation screens (drugs, CRISPR
|
|
5
|
+
knockdowns, cytokines, combinations) with CellScreen, on Apple MLX or a vLLM GPU server.
|
|
6
|
+
Use when the user wants to start or resume a screen, quantize or serve the model, check run
|
|
7
|
+
progress, rebuild report.html, or take over a run another agent started.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# CellScreen
|
|
11
|
+
|
|
12
|
+
All screen state lives in `runs/<run_id>/` (`manifest.json`, append-only `results.jsonl`,
|
|
13
|
+
`vectors/*.npz`, `report.html`). Any agent can pick up a run at any point.
|
|
14
|
+
|
|
15
|
+
## 1. Check disk and the server first
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv run cellscreen status runs/<run_id> --json
|
|
19
|
+
uv run cellscreen health --json # works for MLX, mock, and vLLM servers
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. Make sure a model server is running on port 8410
|
|
23
|
+
|
|
24
|
+
- **Apple Silicon:** quantize once, then serve.
|
|
25
|
+
```bash
|
|
26
|
+
uv run cellscreen quantize --output models/cellgemma-e4b-q8 --recipe ple_q8 # 16 GB Macs
|
|
27
|
+
uv run cellscreen serve --model models/cellgemma-e4b-q8 --port 8410
|
|
28
|
+
```
|
|
29
|
+
Use `--recipe ple_bf16` on 24 GB or more. Never use `uniform` for real screens.
|
|
30
|
+
- **NVIDIA GPU:** run vLLM with the flags in `docs/guide.md`.
|
|
31
|
+
- **Dry run with no model:** `uv run cellscreen serve --mock --port 8410`.
|
|
32
|
+
|
|
33
|
+
## 3. Create or resume the run
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv run cellscreen init runs/<run_id> --from <spec.json>
|
|
37
|
+
uv run cellscreen run runs/<run_id> # resumes; finished items are skipped
|
|
38
|
+
uv run cellscreen run runs/<run_id> --limit 3 # quick pilot
|
|
39
|
+
uv run cellscreen run runs/<run_id> --retry-errors
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Each perturbation generates up to 8,192 tokens and takes minutes (`--timeout` defaults to `1800` s;
|
|
43
|
+
raise it if needed). Pick the decoder (`dataset`) that matches the assay:
|
|
44
|
+
`uv run cellscreen list-decoders`.
|
|
45
|
+
|
|
46
|
+
## 4. Report and hand off
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv run cellscreen report runs/<run_id>
|
|
50
|
+
uv run cellscreen handoff runs/<run_id> --write
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
|
|
55
|
+
- Never edit `results.jsonl` by hand.
|
|
56
|
+
- Never change the CellGemma preamble or the Gemma 4 turn wrapper.
|
|
57
|
+
- Done means `status --json` shows `pending == 0` and `failed == 0`, or the remaining failures
|
|
58
|
+
are reported to the user with their errors.
|
|
59
|
+
- Perturbation schemas and the decoder list: [reference.md](./references/reference.md).
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# CellScreen Reference Guide
|
|
2
|
+
|
|
3
|
+
## 13 Pretrained CellGemma Stage-2 ExpressionDecoders
|
|
4
|
+
|
|
5
|
+
| Dataset | Modality | Assay / Context |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| `tahoe` | `small_molecule` | Tahoe-100M single-cell cancer line chemical screen |
|
|
8
|
+
| `l1000` | `small_molecule` | LINCS L1000 bulk chemical screen |
|
|
9
|
+
| `emeraldbay` | `small_molecule` | Single-cell cancer pharmacology (targeted & combo drugs) |
|
|
10
|
+
| `sciplex` | `small_molecule` | SciPlex 3 single-cell screen (A549, K562, MCF7) |
|
|
11
|
+
| `hepg2` | `crispr` | Nadig/Replogle HepG2 CRISPRi knockdowns |
|
|
12
|
+
| `jurkat` | `crispr` | Nadig/Replogle Jurkat CRISPRi knockdowns |
|
|
13
|
+
| `k562` | `crispr` | Nadig/Replogle K562 CRISPRi knockdowns |
|
|
14
|
+
| `rpe1` | `crispr` | Nadig/Replogle RPE1 CRISPRi knockdowns |
|
|
15
|
+
| `vcc` | `crispr` | Virtual Cell Challenge hESC CRISPR knockdowns |
|
|
16
|
+
| `norman` | `crispr` | Norman single & combinatorial CRISPRa in K562 |
|
|
17
|
+
| `parse` | `cytokine` | Parse 10M PBMC combinatorial cytokine screen |
|
|
18
|
+
| `dong` | `cytokine` | Dong PBMC single/combinatorial cytokine screen |
|
|
19
|
+
| `tisch` | `clinical` | TISCH2 clinical tumor microenvironment cohorts |
|
|
20
|
+
|
|
21
|
+
> **Important:** Pick the decoder whose assay/normalization matches your perturbation modality.
|
|
22
|
+
> Sampling follows the model card: `temperature=0.7`, `max_new_tokens=8192`, stopping on `<eos>` or `<turn|>`.
|
|
23
|
+
|
|
24
|
+
## Perturbation Spec JSON Schemas
|
|
25
|
+
|
|
26
|
+
### Small Molecule
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"label": "Panobinostat 0.5 uM",
|
|
30
|
+
"modality": "small_molecule",
|
|
31
|
+
"drug_name": "Panobinostat",
|
|
32
|
+
"smiles": "Cc1[nH]c2ccccc2c1CCNCc1ccc(/C=C/C(=O)NO)cc1",
|
|
33
|
+
"concentration": "0.5 uM"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Single CRISPR Knockdown (auto-hydrates from `kg_sentences.json`)
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"label": "MYC knockdown",
|
|
41
|
+
"modality": "crispr",
|
|
42
|
+
"gene": "MYC"
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Cytokine (auto-hydrates from `kg_sentences.json`)
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"label": "IFN-gamma stimulation",
|
|
50
|
+
"modality": "cytokine",
|
|
51
|
+
"gene": "IFNG"
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Clinical Treatment
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"label": "Pembrolizumab",
|
|
59
|
+
"modality": "clinical",
|
|
60
|
+
"treatment": "Pembrolizumab"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Combinatorial Perturbation
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"label": "MYC + TP53 dual knockdown",
|
|
68
|
+
"modality": "combinatorial",
|
|
69
|
+
"components": [
|
|
70
|
+
{ "modality": "crispr", "gene": "MYC" },
|
|
71
|
+
{ "modality": "crispr", "gene": "TP53" }
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Stateless Run Directory Layout
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
runs/<run_id>/
|
|
80
|
+
├── manifest.json # Immutable run spec + content-hashed item_ids
|
|
81
|
+
├── results.jsonl # Append-only fsync'd records (source of truth for resume)
|
|
82
|
+
├── vectors/<item_id>.npz # Full float32 predicted_expr & predicted_lfc arrays
|
|
83
|
+
├── report.html # Offline interactive scientific-editorial HTML report
|
|
84
|
+
├── HANDOFF.md # Optional cross-agent summary (`cellscreen handoff --write`)
|
|
85
|
+
└── .run.lock # OS advisory flock (auto-released on crash/exit)
|
|
86
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cellscreen
|
|
3
|
+
description: >-
|
|
4
|
+
Run, resume, inspect and report CellGemma E4B in silico perturbation screens (drugs, CRISPR
|
|
5
|
+
knockdowns, cytokines, combinations) with CellScreen, on Apple MLX or a vLLM GPU server.
|
|
6
|
+
Use when the user wants to start or resume a screen, quantize or serve the model, check run
|
|
7
|
+
progress, rebuild report.html, or take over a run another agent started.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# CellScreen
|
|
11
|
+
|
|
12
|
+
All screen state lives in `runs/<run_id>/` (`manifest.json`, append-only `results.jsonl`,
|
|
13
|
+
`vectors/*.npz`, `report.html`). Any agent can pick up a run at any point.
|
|
14
|
+
|
|
15
|
+
## 1. Check disk and the server first
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv run cellscreen status runs/<run_id> --json
|
|
19
|
+
uv run cellscreen health --json # works for MLX, mock, and vLLM servers
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. Make sure a model server is running on port 8410
|
|
23
|
+
|
|
24
|
+
- **Apple Silicon:** quantize once, then serve.
|
|
25
|
+
```bash
|
|
26
|
+
uv run cellscreen quantize --output models/cellgemma-e4b-q8 --recipe ple_q8 # 16 GB Macs
|
|
27
|
+
uv run cellscreen serve --model models/cellgemma-e4b-q8 --port 8410
|
|
28
|
+
```
|
|
29
|
+
Use `--recipe ple_bf16` on 24 GB or more. Never use `uniform` for real screens.
|
|
30
|
+
- **NVIDIA GPU:** run vLLM with the flags in `docs/guide.md`.
|
|
31
|
+
- **Dry run with no model:** `uv run cellscreen serve --mock --port 8410`.
|
|
32
|
+
|
|
33
|
+
## 3. Create or resume the run
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv run cellscreen init runs/<run_id> --from <spec.json>
|
|
37
|
+
uv run cellscreen run runs/<run_id> # resumes; finished items are skipped
|
|
38
|
+
uv run cellscreen run runs/<run_id> --limit 3 # quick pilot
|
|
39
|
+
uv run cellscreen run runs/<run_id> --retry-errors
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Each perturbation generates up to 8,192 tokens and takes minutes (`--timeout` defaults to `1800` s;
|
|
43
|
+
raise it if needed). Pick the decoder (`dataset`) that matches the assay:
|
|
44
|
+
`uv run cellscreen list-decoders`.
|
|
45
|
+
|
|
46
|
+
## 4. Report and hand off
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uv run cellscreen report runs/<run_id>
|
|
50
|
+
uv run cellscreen handoff runs/<run_id> --write
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Rules
|
|
54
|
+
|
|
55
|
+
- Never edit `results.jsonl` by hand.
|
|
56
|
+
- Never change the CellGemma preamble or the Gemma 4 turn wrapper.
|
|
57
|
+
- Done means `status --json` shows `pending == 0` and `failed == 0`, or the remaining failures
|
|
58
|
+
are reported to the user with their errors.
|
|
59
|
+
- Perturbation schemas and the decoder list: `.agents/skills/cellscreen/references/reference.md`.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
.venv/
|
|
6
|
+
venv/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.ruff_cache/
|
|
12
|
+
|
|
13
|
+
# Local model caches & run artifacts
|
|
14
|
+
.cellscreen/
|
|
15
|
+
models/
|
|
16
|
+
runs/
|
|
17
|
+
*.safetensors
|
|
18
|
+
*.npz
|
|
19
|
+
|
|
20
|
+
# OS
|
|
21
|
+
.DS_Store
|
|
22
|
+
logs/
|
|
23
|
+
*.tgz
|
|
24
|
+
*.log
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to CellScreen are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] — 2026-12-02
|
|
6
|
+
|
|
7
|
+
Initial open-source release of CellScreen.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **PLE-safe Apple MLX quantizer (`cellscreen quantize`)** with `ple_q8` (for 16 GB Macs) and
|
|
11
|
+
`ple_bf16` (for 24 GB+ Macs) recipes, executing conversion on CPU to avoid macOS Metal GPU
|
|
12
|
+
watchdogs on external/swapped volumes.
|
|
13
|
+
- **Stateless local MLX inference server (`cellscreen serve`)** exposing OpenAI-compatible
|
|
14
|
+
`/v1/completions`, `/v1/models`, `/health`, and `/metrics`, running model load and generation
|
|
15
|
+
on a dedicated MLX thread, plus a `--mock` backend for zero-download dry runs.
|
|
16
|
+
- **Exact CellGemma E4B two-stage pipeline:** verbatim model-card prompt formatting for small
|
|
17
|
+
molecules, CRISPR knockdowns, cytokines, clinical treatments, and combinatorial perturbations
|
|
18
|
+
(with `stop_token_ids` for vLLM compatibility) plus pure-NumPy Stage-2 `ExpressionDecoder`
|
|
19
|
+
reconstruction for all 13 pretrained decoders.
|
|
20
|
+
- **Stateless run store & async fanner (`cellscreen init`, `run`, `status`, `handoff`)** using
|
|
21
|
+
`manifest.json` + fsync-flushed append-only `results.jsonl` + `vectors/*.npz` + OS advisory
|
|
22
|
+
locking for seamless pause/resume across machines and coding agents.
|
|
23
|
+
- **Offline interactive HTML report (`cellscreen report`)** with rank-salience volcano plot,
|
|
24
|
+
cross-perturbation LFC heatmap, sortable/filterable candidate table, dark-mode toggle,
|
|
25
|
+
escaped DOM rendering, and CSV/JSON export.
|
|
26
|
+
- **vLLM & OpenAI-compatible server health fallback** in `cellscreen health` and 1,800 s
|
|
27
|
+
default per-request timeout.
|
|
28
|
+
- **Bundled package ergonomics:** `cellscreen examples`, `cellscreen init --example tahoe|k562`,
|
|
29
|
+
and `cellscreen install-skills` for Claude Code, Codex, and Antigravity.
|
cellscreen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
cellscreen-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CellScreen
|
|
2
|
+
Copyright 2026 CellScreen Contributors
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
CellScreen downloads and runs the CellGemma E4B model and its ExpressionDecoder
|
|
7
|
+
assets (https://huggingface.co/google/cellgemma-e4b), which Google publishes
|
|
8
|
+
under the Apache License, Version 2.0. Those weights are not redistributed here.
|
|
9
|
+
CellScreen is an independent project and is not affiliated with or endorsed by
|
|
10
|
+
Google or Google DeepMind.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cellscreen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Run in silico perturbation screens with CellGemma E4B on Apple MLX or a vLLM GPU server
|
|
5
|
+
Project-URL: Homepage, https://github.com/ayushgml/cellscreen
|
|
6
|
+
Project-URL: Repository, https://github.com/ayushgml/cellscreen
|
|
7
|
+
Project-URL: Documentation, https://github.com/ayushgml/cellscreen/blob/main/docs/guide.md
|
|
8
|
+
Project-URL: Changelog, https://github.com/ayushgml/cellscreen/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/ayushgml/cellscreen/issues
|
|
10
|
+
Author: CellScreen Contributors
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Keywords: apple-silicon,bioinformatics,cellgemma,mlx,perturbation-screening,single-cell,transcriptomics
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Requires-Dist: fastapi>=0.115.0
|
|
27
|
+
Requires-Dist: httpx>=0.28.0
|
|
28
|
+
Requires-Dist: huggingface-hub>=0.29.0
|
|
29
|
+
Requires-Dist: mlx-lm>=0.24.0; sys_platform == 'darwin' and platform_machine == 'arm64'
|
|
30
|
+
Requires-Dist: mlx>=0.25.0; sys_platform == 'darwin' and platform_machine == 'arm64'
|
|
31
|
+
Requires-Dist: numpy>=1.26.0
|
|
32
|
+
Requires-Dist: pydantic>=2.10.0
|
|
33
|
+
Requires-Dist: rich>=13.9.0
|
|
34
|
+
Requires-Dist: safetensors>=0.5.0
|
|
35
|
+
Requires-Dist: typer>=0.15.0
|
|
36
|
+
Requires-Dist: uvicorn>=0.34.0
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=8.3.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: ruff>=0.9.0; extra == 'dev'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<img src="https://raw.githubusercontent.com/ayushgml/cellscreen/main/assets/logo.svg" width="112" alt="CellScreen logo">
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<h1 align="center">CellScreen</h1>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
Run in silico perturbation screens with
|
|
51
|
+
<a href="https://huggingface.co/google/cellgemma-e4b">CellGemma E4B</a>
|
|
52
|
+
on your own Mac or on any NVIDIA GPU.
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<a href="https://pypi.org/project/cellscreen/"><img alt="PyPI" src="https://img.shields.io/pypi/v/cellscreen?color=2F5BD3"></a>
|
|
57
|
+
<a href="https://github.com/ayushgml/cellscreen/blob/main/LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-2F5BD3"></a>
|
|
58
|
+
<img alt="Python 3.11+" src="https://img.shields.io/badge/python-3.11%2B-2F5BD3">
|
|
59
|
+
<img alt="Backends: MLX and vLLM" src="https://img.shields.io/badge/backends-MLX%20%7C%20vLLM-7A8AA0">
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
You describe a panel of perturbations in a JSON file: drugs, CRISPR knockdowns, cytokines or
|
|
63
|
+
combinations of them. CellScreen asks CellGemma how a cell's transcriptome responds to each
|
|
64
|
+
one, decodes the answer into predicted expression and log-fold changes for every gene, and
|
|
65
|
+
writes everything to a folder you can resume, share or open as an interactive report.
|
|
66
|
+
|
|
67
|
+
<p align="center">
|
|
68
|
+
<img src="https://raw.githubusercontent.com/ayushgml/cellscreen/main/assets/report-preview.png" width="860" alt="CellScreen report for a four-drug pilot screen: summary figures, a rank-salience plot, top up- and down-regulated genes, and a cross-perturbation heatmap">
|
|
69
|
+
</p>
|
|
70
|
+
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
- **Runs where you are.** Use Apple MLX on an Apple Silicon Mac (16 GB is enough), or point
|
|
74
|
+
it at a vLLM server on an NVIDIA GPU, including a Google Colab VM driven from the terminal.
|
|
75
|
+
- **Faithful to the model card.** Prompts use CellGemma's exact preamble, section order and
|
|
76
|
+
Gemma 4 turn format, and the 13 pretrained Stage-2 decoders reconstruct full expression and
|
|
77
|
+
LFC vectors in plain NumPy.
|
|
78
|
+
- **Quantization that keeps the model intact.** `cellscreen quantize` compresses attention and
|
|
79
|
+
MLP weights to 4-bit but keeps Gemma 4's Per-Layer Embeddings at 8-bit or bf16.
|
|
80
|
+
- **Resumable by design.** All state lives in the run folder. Stop, restart, move machines or
|
|
81
|
+
switch coding agents, and `cellscreen run` picks up where it stopped.
|
|
82
|
+
- **An offline report.** One self-contained HTML file with a rank-salience plot, a
|
|
83
|
+
cross-perturbation heatmap, a sortable table and CSV and JSON export.
|
|
84
|
+
- **Agent skills included.** Run `cellscreen install-skills` to install bundled skills for
|
|
85
|
+
Claude Code, Codex and Antigravity without cloning the repo.
|
|
86
|
+
|
|
87
|
+
## Install
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# uv (recommended)
|
|
91
|
+
uv tool install cellscreen
|
|
92
|
+
|
|
93
|
+
# pip
|
|
94
|
+
pip install cellscreen
|
|
95
|
+
|
|
96
|
+
# Homebrew (macOS)
|
|
97
|
+
brew install ayushgml/tap/cellscreen
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or try it immediately with zero setup using the bundled mock backend and example panel:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cellscreen serve --mock --port 8410 &
|
|
104
|
+
cellscreen init runs/demo --example tahoe
|
|
105
|
+
cellscreen run runs/demo
|
|
106
|
+
open runs/demo/report.html
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Install the bundled coding-agent skills (Claude Code, Codex, Antigravity) globally:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cellscreen install-skills
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### On an Apple Silicon Mac
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cellscreen quantize --output models/cellgemma-e4b-q8 --recipe ple_q8 # once, 15.6 GB download
|
|
119
|
+
cellscreen serve --model models/cellgemma-e4b-q8 --port 8410
|
|
120
|
+
cellscreen init runs/tahoe-pilot --example tahoe
|
|
121
|
+
cellscreen run runs/tahoe-pilot
|
|
122
|
+
open runs/tahoe-pilot/report.html
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Use `--recipe ple_bf16` instead if your Mac has 24 GB or more.
|
|
126
|
+
|
|
127
|
+
### On an NVIDIA GPU
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install vllm cellscreen
|
|
131
|
+
vllm serve google/cellgemma-e4b --served-model-name google/cellgemma-e4b \
|
|
132
|
+
--max-model-len 12992 --max-num-seqs 4 --max-num-batched-tokens 4096 \
|
|
133
|
+
--gpu-memory-utilization 0.95 --enforce-eager --port 8410
|
|
134
|
+
cellscreen init runs/tahoe-pilot --example tahoe
|
|
135
|
+
cellscreen run runs/tahoe-pilot --concurrency 2
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
These flags fit a 24 GB L4. The [guide](https://github.com/ayushgml/cellscreen/blob/main/docs/guide.md#run-on-an-nvidia-gpu-with-vllm)
|
|
139
|
+
explains them and shows how to run on Google Colab without opening a browser.
|
|
140
|
+
|
|
141
|
+
## Measured performance
|
|
142
|
+
|
|
143
|
+
Each perturbation generates up to the 8,192 tokens the model card recommends.
|
|
144
|
+
|
|
145
|
+
| Setup | Model | Time per perturbation | Memory |
|
|
146
|
+
| --- | --- | --- | --- |
|
|
147
|
+
| Apple M4, 16 GB, MLX | `ple_q8` checkpoint (5.9 GB) | 360–430 s (43 s when stopping early) | 7.2 GB peak |
|
|
148
|
+
| NVIDIA L4, 24 GB, vLLM | bf16 original | about 520 s; 4 in 17 min at concurrency 2 | 14.6 GB weights |
|
|
149
|
+
|
|
150
|
+
The 8-bit Mac checkpoint tracks the full-precision model closely across all four pilot drugs:
|
|
151
|
+
same-drug predicted log-fold changes correlate at `r = 0.74–0.92` (mean `0.85`) across 19,720
|
|
152
|
+
genes against the bf16 GPU run, compared to `0.21–0.51` between different drugs.
|
|
153
|
+
|
|
154
|
+
## Documentation
|
|
155
|
+
|
|
156
|
+
- [Guide](https://github.com/ayushgml/cellscreen/blob/main/docs/guide.md): installing, choosing hardware, writing screens, reading results, troubleshooting
|
|
157
|
+
- [Perturbation schemas and decoders](https://github.com/ayushgml/cellscreen/blob/main/.agents/skills/cellscreen/references/reference.md)
|
|
158
|
+
- [Agent contract](https://github.com/ayushgml/cellscreen/blob/main/AGENTS.md): how coding agents should work with run folders
|
|
159
|
+
- [Changelog](https://github.com/ayushgml/cellscreen/blob/main/CHANGELOG.md)
|
|
160
|
+
|
|
161
|
+
## Commands
|
|
162
|
+
|
|
163
|
+
| Command | What it does |
|
|
164
|
+
| --- | --- |
|
|
165
|
+
| `cellscreen quantize` | Convert CellGemma to a PLE-safe MLX checkpoint |
|
|
166
|
+
| `cellscreen serve` | Start the local MLX server (`--mock` for a model-free dry run) |
|
|
167
|
+
| `cellscreen health` | Check a local MLX or vLLM server and its status |
|
|
168
|
+
| `cellscreen list-decoders` | List the 13 Stage-2 decoders |
|
|
169
|
+
| `cellscreen examples` | List or inspect bundled example screen JSONs (`tahoe`, `k562`) |
|
|
170
|
+
| `cellscreen init` | Create a run folder from `--from <file>` or `--example <name>` |
|
|
171
|
+
| `cellscreen run` | Run or resume pending perturbations and refresh the report |
|
|
172
|
+
| `cellscreen status` | Show progress and top genes from disk |
|
|
173
|
+
| `cellscreen report` | Rebuild `report.html` |
|
|
174
|
+
| `cellscreen handoff` | Write a short summary for another agent |
|
|
175
|
+
| `cellscreen install-skills` | Install bundled skills for Claude Code, Codex, and Antigravity |
|
|
176
|
+
|
|
177
|
+
## Development
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
git clone https://github.com/ayushgml/cellscreen.git
|
|
181
|
+
cd cellscreen
|
|
182
|
+
uv sync --extra dev
|
|
183
|
+
uv run pytest
|
|
184
|
+
uv run ruff check src tests
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Contributions are welcome. Open an issue to discuss larger changes first.
|
|
188
|
+
|
|
189
|
+
## License and attribution
|
|
190
|
+
|
|
191
|
+
CellScreen is licensed under the [Apache License 2.0](https://github.com/ayushgml/cellscreen/blob/main/LICENSE). It downloads CellGemma E4B and
|
|
192
|
+
its decoders from [`google/cellgemma-e4b`](https://huggingface.co/google/cellgemma-e4b), which
|
|
193
|
+
Google publishes under Apache 2.0; no model weights are included in this repository.
|
|
194
|
+
CellScreen is an independent project, not affiliated with or endorsed by Google or Google
|
|
195
|
+
DeepMind.
|
|
196
|
+
|
|
197
|
+
CellGemma predictions are statistical hypotheses for research use. Validate them
|
|
198
|
+
experimentally; they are not intended for clinical diagnosis or patient care.
|