cp-bg-bench-anon commited on
Commit
9a0a6db
·
verified ·
1 Parent(s): fd00522

Tighten README: trim noise, fix repo names, ASCII-only.

Browse files
Files changed (1) hide show
  1. README.md +62 -112
README.md CHANGED
@@ -8,9 +8,7 @@ task_categories:
8
  tags:
9
  - cell-painting
10
  - microscopy
11
- - representation-learning
12
  - single-cell
13
- - biology
14
  - jump-cp
15
  configs:
16
  - config_name: default
@@ -19,138 +17,90 @@ configs:
19
  path: data/shard-*.tar
20
  ---
21
 
22
- # CP-BG-Bench: JUMP view SD (background-masked + density-augmented cell crop)
23
 
24
- This dataset is one of four paired views of the same single-cell tiles from
25
- the JUMP-CP Cell Painting consortium, prepared for the CP-BG-Bench evaluation
26
- framework.
27
 
28
- The four views C (raw crop), S (background-masked crop), CD (density-augmented),
29
- SD (background-masked + density-augmented) — are released as separate
30
- repositories. They are **row-aligned**: each `row_key` exists in all four
31
- views and refers to the same underlying cell. Each view ships the same
32
- schema (cell + mask + metadata); only the `cell.bin` content differs.
 
33
 
34
- This repository contains view **SD**: background-masked + density-augmented cell crop.
35
 
36
- ## Format
37
 
38
- WebDataset tar shards. Each cell occupies one sample with four files sharing a
39
- key:
40
 
41
- - `{key}.cell.bin` — raw uint8 bytes, shape `(5, 224, 224)`, channel-first.
42
- View-specific image content (raw / background-masked / density-augmented).
43
- - `{key}.mask.bin` — raw uint8 bytes, shape `(2, 224, 224)`, channel-first.
44
- Segmentation mask (`[nucleus, cell]`); identical across all four views.
45
- - `{key}.json` — per-cell metadata (see below).
46
 
47
- Note: the binary blobs are **raw bytes**, not PNG/NPY. Decode with:
 
 
 
48
 
49
- ```python
50
- import numpy as np
51
- cell = np.frombuffer(cell_bytes, dtype=np.uint8).reshape((5, 224, 224))
52
- mask = np.frombuffer(mask_bytes, dtype=np.uint8).reshape((2, 224, 224))
53
  ```
54
 
55
- ## Channels
56
-
57
- The 5 channels are stored in this order:
58
 
59
- | index | label | stain |
60
  |---|---|---|
61
- | 0 | DNA | Hoechst 33342 |
62
- | 1 | AGP | Phalloidin + WGA |
63
- | 2 | ER | Concanavalin A |
64
- | 3 | Mito | MitoTracker Deep Red |
65
- | 4 | RNA | SYTO 14 |
66
 
67
- > **Note: this on-disk order is `[DNA, AGP, ER, Mito, RNA]`, which differs
68
- > from both the JUMP-CP v2 publication order `[DNA, ER, RNA, AGP, Mito]` and
69
- > the Recursion RxRx order `[DNA, ER, AGP, RNA, Mito, ...]`.** Code that
70
- > assumes a particular order without checking will feed the wrong stain to
71
- > downstream channel slots. A machine-readable `channels.json` is provided at
72
- > the repo root; please use it. The CP-BG-Bench framework resolves channels
73
- > by name and is robust to per-dataset reorderings.
74
 
 
75
 
76
- The 2 mask channels are stored in this order:
 
 
77
 
78
- | index | label | description |
79
- |---|---|---|
80
- | 0 | nucleus | binary nucleus segmentation mask |
81
- | 1 | cell | binary whole-cell segmentation mask |
82
 
83
- Masks are uint8 with values in `{0, 255}` (or another non-zero label).
84
- A machine-readable `channels.json` is provided at the repo root.
85
 
 
 
 
86
 
87
- ## Metadata fields
88
 
89
- Each `.json` sidecar contains:
90
 
91
- | Field | Type | Description |
92
  |---|---|---|
93
- | `row_key` | str | Stable cell identifier (`source__date_run__plate__well__tile__id`) |
94
- | `source` | str | JUMP partner code (e.g. `source_4`) |
95
- | `batch` | str | Batch identifier (= `source` for JUMP-CP) |
96
- | `plate` | str | JUMP plate identifier |
97
- | `well` | str | Well coordinate (e.g. `B02`) |
98
- | `tile` | str | Site index within well |
99
- | `id_local` | int | Per-tile cell index |
100
- | `perturbation` | str | Compound InChIKey (= `Metadata_InChIKey`) |
101
- | `Metadata_InChIKey` | str | Public PubChem-derivable compound ID |
102
- | `Metadata_PlateType` | str | `TARGET2` or `COMPOUND` |
103
- | `nuc_area`, `cyto_area`, `nuc_cyto_ratio` | num | Single-cell QC features |
104
- | `n_cells_in_fov`, `n_cells_scaled` | num | Local density features |
105
-
106
- A flat `metadata.parquet` covering all rows (with `shard_index` and
107
- `key_in_shard` columns) is provided at the repo root for fast subsetting
108
- without scanning the tar shards.
109
-
110
- ## Statistics
111
-
112
- - Total cells: 645,390
113
- - Shards: 43
114
- - Approximate shard size: ~5.3 GB
115
- - Plate types: COMPOUND: 445,968, TARGET2: 199,422
116
- - Sources (JUMP partners): 10
117
- - Plates: 900
118
- - Unique perturbations (InChIKeys): 1467
119
-
120
- ## Splits
121
-
122
- A natural held-out batch is `source_4` (21,177 cells), used in the
123
- CP-BG-Bench cross-batch retrieval evaluation. Filter with:
124
-
125
- ```python
126
- ds = ds.filter(lambda r: r["source"] == "source_4")
127
- ```
128
-
129
- ## Pairing across views
130
-
131
- The four CP-BG-Bench JUMP repos share `row_key` exactly. To use a paired
132
- dataloader, load all four and join on `row_key` (the `metadata.parquet` files
133
- make this cheap):
134
-
135
- - `<anon-org>/jump-c-target2` (this view: C)
136
- - `<anon-org>/jump-s-target2`
137
- - `<anon-org>/jump-cd-target2`
138
- - `<anon-org>/jump-sd-target2`
139
-
140
- ## Shard ordering
141
-
142
- - Rows are written in the order they appear in the source HF Datasets
143
- directory. Shuffle at load time (PyTorch `DataLoader(shuffle=True)` or
144
- `webdataset.WebDataset(...).shuffle(N)`); shards are not pre-shuffled.
145
- - `(shard_index, key_in_shard)` for every row is in `metadata.parquet`.
146
 
147
  ## License
148
 
149
- CC0 1.0 Universal. Underlying JUMP-CP data is released by the JUMP-Cell
150
- Painting consortium under CC0 1.0.
151
-
152
- ## Citation
153
-
154
- Anonymous submission to NeurIPS 2026 Datasets & Benchmarks Track.
155
-
156
- For the underlying JUMP-CP data, please cite the JUMP-CP consortium release.
 
8
  tags:
9
  - cell-painting
10
  - microscopy
 
11
  - single-cell
 
12
  - jump-cp
13
  configs:
14
  - config_name: default
 
17
  path: data/shard-*.tar
18
  ---
19
 
20
+ # CP-BG-Bench JUMP SD: background-masked + density-augmented cell crop
21
 
22
+ Single-cell tiles from JUMP-CP, packaged for the CP-BG-Bench evaluation.
23
+ This is one of four row-aligned views of the same 645,390 cells:
 
24
 
25
+ | view | repo | cell.bin content |
26
+ |---|---|---|
27
+ | C | `cp-bg-bench-anon/jump-c` | raw 5-channel crop |
28
+ | S | `cp-bg-bench-anon/jump-s` | background-masked crop |
29
+ | CD | `cp-bg-bench-anon/jump-cd` | density-augmented crop |
30
+ | SD | `cp-bg-bench-anon/jump-sd` | background-masked + density-augmented |
31
 
32
+ All four share `row_key`. Join on it to combine views.
33
 
34
+ ## Loading
35
 
36
+ ```python
37
+ import json, numpy as np, webdataset as wds
38
 
39
+ URLS = "https://huggingface.co/datasets/cp-bg-bench-anon/jump-sd/resolve/main/data/shard-{{00000..00042}}.tar"
 
 
 
 
40
 
41
+ def decode(s):
42
+ cell = np.frombuffer(s["cell.bin"], dtype=np.uint8).reshape(5, 224, 224)
43
+ mask = np.frombuffer(s["mask.bin"], dtype=np.uint8).reshape(2, 224, 224)
44
+ return cell, mask, json.loads(s["json"])
45
 
46
+ ds = wds.WebDataset(URLS, shardshuffle=True).shuffle(2000).map(decode)
 
 
 
47
  ```
48
 
49
+ ## Per-cell payload
 
 
50
 
51
+ | file | shape | dtype |
52
  |---|---|---|
53
+ | `<key>.cell.bin` | (5, 224, 224) | uint8 |
54
+ | `<key>.mask.bin` | (2, 224, 224) | uint8 |
55
+ | `<key>.json` | - | json |
 
 
56
 
57
+ `cell.bin` and `mask.bin` are raw bytes. Channel order is in `channels.json`.
 
 
 
 
 
 
58
 
59
+ ### Image channels (cell.bin)
60
 
61
+ | 0 | 1 | 2 | 3 | 4 |
62
+ |---|---|---|---|---|
63
+ | DNA (Hoechst) | AGP (Phalloidin+WGA) | ER (ConA) | Mito (MitoTracker DR) | RNA (SYTO 14) |
64
 
65
+ This order differs from JUMP-CP v2 `[DNA, ER, RNA, AGP, Mito]` and Recursion
66
+ `[DNA, ER, AGP, RNA, Mito, ...]`. Cross-dataset code must remap by name.
 
 
67
 
68
+ ### Mask channels (mask.bin)
 
69
 
70
+ | 0 | 1 |
71
+ |---|---|
72
+ | nucleus | cell |
73
 
74
+ Binary uint8 in {0, 255}. Identical across all four views.
75
 
76
+ ### JSON metadata
77
 
78
+ | field | dtype | example |
79
  |---|---|---|
80
+ | `row_key` | str | `source_4__20210922_Run1__BR00121430__J18__1__27` |
81
+ | `source` | str | `source_4` |
82
+ | `batch` | str | `source_4` |
83
+ | `plate` | str | `BR00121430` |
84
+ | `well` | str | `J18` |
85
+ | `tile` | str | `1` |
86
+ | `id_local` | int | `27` |
87
+ | `perturbation` | str | `IAZDPXIOMUYVGZ-UHFFFAOYSA-N` |
88
+ | `Metadata_InChIKey` | str | `IAZDPXIOMUYVGZ-UHFFFAOYSA-N` |
89
+ | `Metadata_PlateType` | str | `COMPOUND` or `TARGET2` |
90
+ | `nuc_area`, `cyto_area` | int | nuclear / cytoplasm pixel counts |
91
+ | `nuc_cyto_ratio` | float | derived |
92
+ | `n_cells_in_fov`, `n_cells_scaled` | int, float | local density |
93
+
94
+ `metadata.parquet` mirrors the JSON fields and adds `shard_index` and
95
+ `key_in_shard` for direct cell lookup.
96
+
97
+ ## Stats
98
+
99
+ 645,390 cells, 43 shards, 10 sources, 900 plates,
100
+ 1467 compounds. Plate library: COMPOUND 445,968 cells, TARGET2 199,422 cells.
101
+ Held-out evaluation batch: `source_4` (21,177 cells).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  ## License
104
 
105
+ CC0 1.0. Anonymous NeurIPS 2026 Datasets and Benchmarks submission; citation
106
+ on acceptance.