File size: 9,404 Bytes
ac4d27e
 
 
ee62d1d
ac4d27e
ee62d1d
 
 
 
ac4d27e
352cf24
 
 
 
ee62d1d
 
 
 
915f93e
 
 
 
9839891
 
 
 
 
07ec9b8
 
9839891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
07ec9b8
 
9839891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
07ec9b8
 
9839891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ac4d27e
 
e55fb61
ac4d27e
d56c170
 
 
 
 
 
 
 
 
 
 
 
 
68707ef
d56c170
 
 
 
 
 
 
 
 
 
 
76df1ac
ac4d27e
e55fb61
 
 
 
 
 
 
ac4d27e
e55fb61
 
 
 
 
 
d56c170
 
 
 
 
 
 
ac4d27e
d56c170
 
 
 
 
 
 
 
9839891
d56c170
 
ac4d27e
 
 
 
 
 
d56c170
 
e55fb61
d56c170
 
 
 
e55fb61
d56c170
 
 
 
e55fb61
d56c170
ac4d27e
 
d56c170
 
 
ac4d27e
d56c170
ac4d27e
d56c170
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
---
license: apache-2.0
task_categories:
- text-generation
tags:
- biology
- genomics
- dna
- benchmark
configs:
- config_name: motif_human
  data_files:
  - split: test
    path: motif_human/test-*
- config_name: syn_human
  data_files:
  - split: test
    path: syn_human/test-*
- config_name: syn_mouse
  data_files:
  - split: test
    path: syn_mouse/test-*
dataset_info:
- config_name: syn_human
  features:
  - name: benchmark_id
    dtype: string
  - name: script_version
    dtype: string
  - name: annotation_source
    dtype: string
  - name: genome_assembly
    dtype: string
  - name: codon_usage_source
    dtype: string
  - name: recoding_mode
    dtype: string
  - name: optimization_rate
    dtype: float64
  - name: random_seed
    dtype: int64
  - name: window_size_bp
    dtype: int64
  - name: species
    dtype: string
  - name: chr
    dtype: string
  - name: chrom_length
    dtype: int64
  - name: strand
    dtype: string
  - name: cds_genome_start
    dtype: int64
  - name: cds_genome_end
    dtype: int64
  - name: window_genome_start
    dtype: int64
  - name: window_genome_end
    dtype: int64
  - name: upstream_actual
    dtype: int64
  - name: downstream_actual
    dtype: int64
  - name: is_clamped
    dtype: int64
  - name: transcript_id
    dtype: string
  - name: gene_id
    dtype: string
  - name: gene_name
    dtype: string
  - name: exon_rank
    dtype: int64
  - name: is_first_exon
    dtype: int64
  - name: frame
    dtype: int64
  - name: phase_gtf
    dtype: int64
  - name: cds_start_in_seq
    dtype: int64
  - name: cds_end_in_seq
    dtype: int64
  - name: cds_length
    dtype: int64
  - name: patch_start_in_seq
    dtype: int64
  - name: patch_end_in_seq
    dtype: int64
  - name: patch_length
    dtype: int64
  - name: n_codons_total
    dtype: int64
  - name: n_codons_eligible
    dtype: int64
  - name: n_codons_changed
    dtype: int64
  - name: fraction_codons_changed
    dtype: float64
  - name: original_sequence
    dtype: string
  - name: sequence
    dtype: string
  splits:
  - name: test
    num_bytes: 335904126
    num_examples: 20000
  download_size: 152737063
  dataset_size: 335904126
- config_name: syn_mouse
  features:
  - name: benchmark_id
    dtype: string
  - name: script_version
    dtype: string
  - name: annotation_source
    dtype: string
  - name: genome_assembly
    dtype: string
  - name: codon_usage_source
    dtype: string
  - name: recoding_mode
    dtype: string
  - name: optimization_rate
    dtype: float64
  - name: random_seed
    dtype: int64
  - name: window_size_bp
    dtype: int64
  - name: species
    dtype: string
  - name: chr
    dtype: string
  - name: chrom_length
    dtype: int64
  - name: strand
    dtype: string
  - name: cds_genome_start
    dtype: int64
  - name: cds_genome_end
    dtype: int64
  - name: window_genome_start
    dtype: int64
  - name: window_genome_end
    dtype: int64
  - name: upstream_actual
    dtype: int64
  - name: downstream_actual
    dtype: int64
  - name: is_clamped
    dtype: int64
  - name: transcript_id
    dtype: string
  - name: gene_id
    dtype: string
  - name: gene_name
    dtype: string
  - name: exon_rank
    dtype: int64
  - name: is_first_exon
    dtype: int64
  - name: frame
    dtype: int64
  - name: phase_gtf
    dtype: int64
  - name: cds_start_in_seq
    dtype: int64
  - name: cds_end_in_seq
    dtype: int64
  - name: cds_length
    dtype: int64
  - name: patch_start_in_seq
    dtype: int64
  - name: patch_end_in_seq
    dtype: int64
  - name: patch_length
    dtype: int64
  - name: n_codons_total
    dtype: int64
  - name: n_codons_eligible
    dtype: int64
  - name: n_codons_changed
    dtype: int64
  - name: fraction_codons_changed
    dtype: float64
  - name: original_sequence
    dtype: string
  - name: sequence
    dtype: string
  splits:
  - name: test
    num_bytes: 336064778
    num_examples: 20000
  download_size: 152659316
  dataset_size: 336064778
- config_name: motif_human
  features:
  - name: benchmark_id
    dtype: string
  - name: script_version
    dtype: string
  - name: annotation_source
    dtype: string
  - name: genome_assembly
    dtype: string
  - name: upstream_flank_bp
    dtype: int64
  - name: motif
    dtype: string
  - name: actual_motif
    dtype: string
  - name: patch_len_bp
    dtype: int64
  - name: start_after_bp
    dtype: int64
  - name: random_seed
    dtype: int64
  - name: species
    dtype: string
  - name: chr
    dtype: string
  - name: chrom_length
    dtype: int64
  - name: strand
    dtype: string
  - name: cds_genome_start
    dtype: int64
  - name: cds_genome_end
    dtype: int64
  - name: window_genome_start
    dtype: int64
  - name: window_genome_end
    dtype: int64
  - name: upstream_actual
    dtype: int64
  - name: is_clamped
    dtype: int64
  - name: transcript_id
    dtype: string
  - name: gene_id
    dtype: string
  - name: gene_name
    dtype: string
  - name: exon_rank
    dtype: int64
  - name: is_first_exon
    dtype: int64
  - name: frame
    dtype: int64
  - name: phase_gtf
    dtype: int64
  - name: cds_start_in_seq
    dtype: int64
  - name: cds_end_in_seq
    dtype: int64
  - name: cds_length
    dtype: int64
  - name: patch_start_in_cds
    dtype: int64
  - name: patch_end_in_cds
    dtype: int64
  - name: patch_start_in_seq
    dtype: int64
  - name: patch_end_in_seq
    dtype: int64
  - name: original_sequence
    dtype: string
  - name: sequence
    dtype: string
  splits:
  - name: test
    num_bytes: 334784354
    num_examples: 20000
  download_size: 152132105
  dataset_size: 334784354
---

# Perturbation Bench

A benchmark of **sequence-level perturbation tasks** for evaluating DNA foundation models.
Each task presents pairs of genomic sequences — one real (unperturbed) and one structurally
altered — and asks whether the model assigns higher log-likelihood to the original.

**Metric**: pairwise discrimination accuracy = `mean(LL(original) > LL(perturbed))`

---

## Tasks

### `syn_human` · `syn_mouse` — Synonymous codon substitution (20,000 pairs each)

Codons within a real CDS are replaced with the highest-frequency synonym for the target
species, while the upstream and
downstream flanking sequence is left unchanged. Amino acid identity is preserved by
construction. The model should prefer the natural codon usage over the artificially
optimised variant.

- **Human** (`syn_human`): GENCODE v45 annotations on GRCh38/hg38; codon frequencies from
  CoCoPUTs (*H. sapiens* RefSeq CDS); 9,616 unique genes.
- **Mouse** (`syn_mouse`): GENCODE vM34 annotations on GRCm39/mm39; codon frequencies from
  CoCoPUTs (*M. musculus* RefSeq CDS); 10,253 unique genes.
- Window size: 8,192 bp centred on the CDS (`cds_start_in_seq` / `cds_end_in_seq`).
- Mean fraction of codons changed: ~55% (range 10–95%).

### `motif_human` — CAG repeat insertion (20,000 pairs) / Triplet Expansion

A 30 bp codon-aligned region beginning 60 bp downstream of the first complete codon of the
CDS exon is replaced with 10 consecutive CAG triplets
(`CAGCAGCAGCAGCAGCAGCAGCAGCAGCAG`), mimicking the pathological trinucleotide repeat
expansions underlying polyglutamine disorders (Huntington's disease, SCAs, DRPLA).
The substitution is length- and reading-frame-preserving (30 bp in, 30 bp out), so the
total window remains 8,192 bp. All sequence outside the patch is identical between
original and perturbed.

- Annotations: GENCODE v45 / GRCh38; all CDS exons (all ranks); 9,705 unique genes.
- Window layout: first complete CDS codon always at position 8,102;
  patch always at positions 8,162–8,192 (`patch_start_in_seq`–`patch_end_in_seq`).
  For exons with phase 1 or 2, the 1–2 split-codon bases from the preceding exon are
  placed immediately before position 8,102, so the upstream genomic context is
  8,102 bp (phase 0), 8,101 bp (phase 1), or 8,100 bp (phase 2).
---

## Schema

All configs share the key columns:

| Column | Description |
|---|---|
| `original_sequence` | Real, unperturbed genomic sequence — **positive** |
| `sequence` | Structurally altered sequence — **negative** |
| `cds_start_in_seq` / `cds_end_in_seq` | CDS boundaries within the window (bp offset) |
| `chr`, `strand` | Genomic locus |
| `gene_name`, `transcript_id` | GENCODE annotation |
| `benchmark_id` | Unique row identifier |

Config-specific columns (e.g. `patch_start_in_seq`, `n_codons_changed`,
`fraction_codons_changed`, `codon_usage_source`) are described in the dataset info above.

---

## Usage

```python
from datasets import load_dataset

# Synonymous codon substitution — human
syn_human = load_dataset(
    "HuggingFaceBio/perturbation-bench", "syn_human", split="test"
)

# Synonymous codon substitution — mouse
syn_mouse = load_dataset(
    "HuggingFaceBio/perturbation-bench", "syn_mouse", split="test"
)

# CAG motif insertion
motif = load_dataset(
    "HuggingFaceBio/perturbation-bench", "motif_human", split="test"
)
```

---

## Evaluation

A ready-to-run scorer for Carbon, GENERator, and Evo2 is available at
[`evaluation/perturbation_tasks.py`](https://github.com/huggingface/carbon)
in the Carbon release repository.

```bash
python evaluation/perturbation_tasks.py \
    --task syn_human \
    --model HuggingFaceBio/Carbon-3B \
    --bf16

python evaluation/perturbation_tasks.py \
    --task motif_human \
    --model arcinstitute/evo2_7b --backend evo2 \
    --bf16
```