perturbation-bench / README.md
loubnabnl's picture
loubnabnl HF Staff
Update README.md
76df1ac verified
metadata
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_seqpatch_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

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 in the Carbon release repository.

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