huggingbahl21 commited on
Commit
ae82f59
·
verified ·
1 Parent(s): 26abf1e

Shorten dataset card to sources, preprocessing and use

Browse files
Files changed (1) hide show
  1. README.md +50 -66
README.md CHANGED
@@ -20,25 +20,47 @@ configs:
20
 
21
  # CausalBench: K562 and RPE1
22
 
23
- Both filtered datasets in one place, prepared from Replogle et al.’s Perturb-seq
24
- count matrices using CausalBench’s preprocessing. These files are unchanged
25
- from the earlier [K562](https://huggingface.co/datasets/huggingbahl21/causalbench-k562)
26
- and [RPE1](https://huggingface.co/datasets/huggingbahl21/causalbench-rpe1) uploads.
27
 
28
- | Dataset | Cells | Gene columns |
29
- | --- | ---: | ---: |
30
- | K562 | 162,751 | 622 |
31
- | RPE1 | 162,733 | 383 |
32
 
33
  Rows are cells. Gene columns use Ensembl IDs and contain normalized,
34
- log-transformed expression. The extra `intervention` column names the target:
35
- `non-targeting` means control; `excluded` means an unsupported target whose row
36
- was kept. **Excluded cells are not controls.** No ground-truth causal graph or
37
- training/test split is included; each subset contains the full filtered data.
38
-
39
- ## Use the data
40
-
41
- Install `pandas` and `huggingface_hub`, then:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ```python
44
  import pandas as pd
@@ -53,56 +75,18 @@ expression = pd.read_csv(path, sep="\t")
53
  interventions = expression.pop("intervention")
54
  ```
55
 
56
- ## Preparation
57
-
58
- ```text
59
- data/raw/ → prepare.py → data/prepared/
60
- ```
61
-
62
- The inputs are the published [K562](https://ndownloader.figshare.com/files/35773219)
63
- and [RPE1](https://ndownloader.figshare.com/files/35775606) count matrices and the
64
- [perturbation summary workbook](https://ars.els-cdn.com/content/image/1-s2.0-S0092867422005979-mmc2.xlsx).
65
- The download links and sheet names are in [`prepare.py`](prepare.py).
66
-
67
- CausalBench keeps controls and strong perturbations (>50 DEGs, knockdown ≤−0.3,
68
- >25 cells), filters measured targets at the control 10th percentile, removes
69
- zero-total cells, normalizes totals across all original genes to the retained-cell
70
- median, and applies `log1p`. It then keeps genes targeted in >100 retained cells
71
- and labels unsupported targets `excluded`.
72
-
73
- [`upstream/preprocessing.py`](upstream/preprocessing.py) is copied **unchanged,
74
- byte for byte**, from [CausalBench commit 1a2143c](https://github.com/causalbench/causalbench/blob/1a2143cffdc85f835b41ce8d52034be1bf903e71/causalscbench/data_access/utils/preprocessing.py).
75
- `prepare.py` is our small download/export wrapper, not copied upstream code.
76
- The existing K562 file used the original function; RPE1 used an equivalent
77
- memory-saving implementation. New rebuilds call the original function directly.
78
-
79
- To rebuild locally:
80
-
81
- ```bash
82
- uv sync --locked
83
- uv run prepare.py --output-dir data/rebuilt
84
- ```
85
-
86
- The Hub stores prepared TSVs and the code. Raw inputs stay local. Rebuilding
87
- needs substantial RAM; the original function loads the full matrix. The summary
88
- workbook’s URL returned HTTP 403 when checked, so you may need to place an
89
- existing copy at `data/raw/summary_stats.xlsx`.
90
-
91
- ## Saved checks
92
-
93
- [`verification.json`](verification.json), previously called `results.json`,
94
- records file fingerprints, dimensions, and data comparisons—not model scores
95
- or CausalBench benchmark results. On 1 November 2026, both raw files matched
96
- publisher checksums, reconstructed NPZ values and ordered labels matched exactly,
97
- and both TSVs matched the earlier Hub uploads byte for byte.
98
 
99
- The full inputs were reconstructed in chunks; the original function was checked
100
- on a small fixture rather than rerun on the full datasets. TSV decimal conversion
101
- introduced differences of at most about 0.00000024. The summary workbook was
102
- checked locally; a fresh remote copy could not be verified.
 
 
103
 
104
- ## Credit
 
 
105
 
106
- Data: [Replogle et al. (2022)](https://doi.org/10.25452/figshare.plus.20029387.v1),
107
- CC BY 4.0. Preprocessing: [CausalBench / Chevalley et al. (2025)](https://www.nature.com/articles/s42003-025-07764-y).
108
- The copied code retains its original attribution and [Apache 2.0 license](upstream/LICENSE.txt).
 
20
 
21
  # CausalBench: K562 and RPE1
22
 
23
+ Filtered single-cell CRISPRi perturbation data from
24
+ [Replogle et al. (2022)](https://doi.org/10.25452/figshare.plus.20029387.v1),
25
+ prepared following [CausalBench](https://www.nature.com/articles/s42003-025-07764-y).
 
26
 
27
+ | Dataset | Cells | Genes | File |
28
+ | --- | ---: | ---: | --- |
29
+ | K562 | 162,751 | 622 | `data/prepared/causalbench_k562.tsv.gz` |
30
+ | RPE1 | 162,733 | 383 | `data/prepared/causalbench_rpe1.tsv.gz` |
31
 
32
  Rows are cells. Gene columns use Ensembl IDs and contain normalized,
33
+ log-transformed expression. Each table also has an `intervention` column:
34
+
35
+ - A gene ID identifies the targeted gene.
36
+ - `non-targeting` identifies control cells.
37
+ - `excluded` identifies unsupported targets. These rows remain in the data
38
+ and **must not be treated as controls**.
39
+
40
+ ## Sources and preprocessing
41
+
42
+ Inputs: [K562 counts](https://ndownloader.figshare.com/files/35773219),
43
+ [RPE1 counts](https://ndownloader.figshare.com/files/35775606), and the
44
+ [perturbation summary workbook](https://ars.els-cdn.com/content/image/1-s2.0-S0092867422005979-mmc2.xlsx)
45
+ (sheets `TabB_K562_day6_summary_stat` and `TabC_RPE1_summary_statistic`).
46
+
47
+ 1. Keep controls and strong perturbations: >50 differentially expressed genes,
48
+ knockdown ≤−0.3, and >25 filtered cells in the summary.
49
+ 2. For measured targets, retain perturbed cells with target expression at or
50
+ below the control 10th percentile.
51
+ 3. Remove zero-total cells. Normalize each cell’s total to the retained-cell
52
+ median using **all original genes**, then apply natural `log1p`.
53
+ 4. Keep measured genes targeted in >100 retained cells. Preserve gene order
54
+ and relabel unsupported targets `excluded` without removing their rows.
55
+
56
+ [`upstream/preprocessing.py`](upstream/preprocessing.py) is copied byte for byte
57
+ from [CausalBench commit 1a2143c](https://github.com/causalbench/causalbench/blob/1a2143cffdc85f835b41ce8d52034be1bf903e71/causalscbench/data_access/utils/preprocessing.py).
58
+ [`prepare.py`](prepare.py) is our download/export wrapper. K562 was prepared
59
+ with the original function; RPE1 used a memory-saving implementation of the
60
+ same rules. Reconstructing both datasets from the raw inputs reproduced all
61
+ saved expression values and ordered labels exactly.
62
+
63
+ ## Load a table
64
 
65
  ```python
66
  import pandas as pd
 
75
  interventions = expression.pop("intervention")
76
  ```
77
 
78
+ ## Notes for downstream use
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
+ These are filtered expression values, not raw counts. The target-expression
81
+ filter selects cells with lower target expression, so knockdown strength in
82
+ these tables is partly determined by that selection. The tables mix control
83
+ and perturbed cells; separating the label column does not make them observational.
84
+ No complete ground-truth causal graph or train/test split is provided.
85
+ Perturbation effects can include indirect effects and do not establish direct edges.
86
 
87
+ [`verification.json`](verification.json) records file checksums and data checks,
88
+ not model performance or benchmark results. The local summary workbook was
89
+ recorded, but its publisher URL returned HTTP 403 during verification.
90
 
91
+ Data: **CC BY 4.0**, credited to Replogle et al. Copied CausalBench code retains
92
+ its original attribution and [Apache 2.0 license](upstream/LICENSE.txt).